|
|
Home » U++ TheIDE » U++ TheIDE: Packages » Add/Remove flags disfunction [BUG?]
Add/Remove flags disfunction [BUG?] [message #36414] |
Thu, 24 May 2012 22:05  |
|
Hi,
I hit a weird behavior of the "Add/Remove flags" feature of the Package organizer. It seems totally broken to me
I vaguely remember it used to work well, but now I wasn't able to add any flag no matter how many ways I tried. I even tried to look in the code of theide, tracked down all functions that manipulate with the flag variable after reading it from upp file, but I couldn't spot any place where it would be applied. Am I missing something really badly, or did this just quietly disappear from theide?
Simplistic testcase: Let's have a file #test.cpp
#ifndef flagGUI
#error "GUI is undefined"
#endif
#ifndef flagPOSIX
#error "POSIX is undefined"
#endif
#ifndef flagTEST_GUI
#error "TEST_GUI is undefined"
#endif
#ifndef flagTEST_POSIX
#error "TEST_POSIX is undefined"
#endif
int main(){}
in a package defined by flags(GUI) TEST_GUI;
flags(POSIX) TEST_POSIX;
file
test.cpp;
mainconfig
"" = "GUI"; I would expect it to pass the compilation, but what I get is Quote: | ----- flagtest ( GUI MAIN GCC DEBUG SHARED DEBUG_FULL BLITZ LINUX POSIX )
cd /home/h/MyApps/flagtest
test.cpp
c++ -c -I"/home/h/MyApps" -I"/home/h/upp.sandbox" -I"/home/h/upp-production/uppsrc" -I"/usr/include/freetype2" -I"
/usr/include/gtk-2.0" -I"/usr/include/glib-2.0" -I"/usr/lib/glib-2.0/include" -I"/usr/lib/gtk-2.0/include" -I"/
usr/include/cairo" -I"/usr/include/pango-1.0" -I"/usr/include/atk-1.0" -I"/usr/X11R6/include" -I"/usr/X11R6/inc
lude/freetype2" -I"/usr/X11R6/include/gtk-2.0" -I"/usr/X11R6/include/glib-2.0" -I"/usr/X11R6/lib/glib-2.0/inclu
de" -I"/usr/X11R6/lib/gtk-2.0/include" -I"/usr/X11R6/include/cairo" -I"/usr/X11R6/include/pango-1.0" -I"/usr/X1
1R6/include/atk-1.0" -I"/usr/include/c++/4.6.1" -I"/usr/include/c++/4.6.1/i686-pc-linux-gnu" -I"/usr/include/we
bkit-1.0" -I"/usr/include/libsoup-2.4" -I"/usr/include/libxml2" -I"/usr/include/gdk-pixbuf-2.0" -I"/usr/include
/webkit-1.0" -I"/usr/include/opencv" -DflagGUI -DflagMAIN -DflagGCC -DflagDEBUG -DflagSHARED -DflagDEBUG_FULL -
DflagBLITZ -DflagLINUX -DflagPOSIX -DbmYEAR=2012 -DbmMONTH=5 -DbmDAY=24 -DbmHOUR=21 -DbmMINUTE=59 -DbmSECOND=45
-ggdb -g2 -fexceptions -D_DEBUG -O0 -fno-PIC -x c++ "/home/h/MyApps/flagtest/test.cpp" -o "/home/h/.upp/_ou
t/MyApps/flagtest/GCC.Debug.Debug_Full.Gui.Main.Shared/test. o "
compiled in (0:00.08)
/home/h/MyApps/flagtest/test.cpp:8:3: error: #error "TEST_GUI is undefined"
/home/h/MyApps/flagtest/test.cpp:11:3: error: #error "TEST_POSIX is undefined"
|
I see the same problem on both Linux with gcc and windows with MSC. For windows of course use WIN32 instead of POSIX 
Best regards,
Honza
|
|
|
|
|
Re: Add/Remove flags disfunction [BUG?] [message #42499 is a reply to message #42497] |
Thu, 20 March 2014 00:46   |
omari
Messages: 276 Registered: March 2010
|
Experienced Member |
|
|
Hi,
there is a set of flags added in "ide/Core/Host.cpp"
this flags is defined at theide compile time, regardless of the current configuration.
void LocalHost::AddFlags(Index<String>& cfg)
{
#if defined(PLATFORM_WIN32)
cfg.Add("WIN32");
#endif
#ifdef PLATFORM_LINUX
cfg.Add("LINUX");
#endif
#ifdef PLATFORM_POSIX
cfg.Add("POSIX");
#endif
...
if theide is compiled under Linux, then the flags LINUX and POSIX are always defined, even with a build method that define WIN32 only (for example).
this methode is called in "ide/Builders/Build.cpp",
Index<String> MakeBuild::PackageConfig(const Workspace& wspc, int package,
const VectorMap<String, String>& bm, String mainparam,
Host& host, Builder& b, String *target)
{
...
host.AddFlags(cfg);
b.AddFlags(cfg);
...
Hope it helps!
best regards
omari.
regards
omari.
|
|
|
|
|
|
Re: Add/Remove flags disfunction [BUG?] [message #42513 is a reply to message #42511] |
Thu, 20 March 2014 19:13   |
|
Alboni wrote on Thu, 20 March 2014 18:00 | Ok, I narrowed it down a bit.
There seems to be a problem when more than 1 flag is added in the same line. I added the portaudio package to a random project and hit compile without adding any extra flags to the main configuration.
|
Hi Alboni,
It seems that this particular thing was never supported by TheIDE I must have overlook it, when I was writing the portaudio plugin... But it is I think it is a good feature to have, so I'll try to create a patch.
I haven't yet looked at the other issue with dotted flags, but I'm sure that it used to work. So I'll try to fix that as well, if it is broken.
Best regards,
Honza
|
|
|
Re: Add/Remove flags disfunction [BUG?] [message #42514 is a reply to message #42513] |
Thu, 20 March 2014 19:27   |
|
Ok,I'm blind...
Multiple flags (and other options) are supported, but there must be a comma, not space. I will fix it in portaudio, and perhaps other packages where I might have made this mistake...
Honza
PS: Actually, there is a small bug, it doesn't work with comma either, because theide quotes the string... But I guess it doesn't really matter, as it is splitted into two lines when the .upp file is saved after being edited. So it is probably easier and more consistent to write it on separate lines right away..
[Updated on: Thu, 20 March 2014 19:40] Report message to a moderator
|
|
|
|
|
|
|
|
Re: Add/Remove flags disfunction [BUG?] [message #42520 is a reply to message #42517] |
Thu, 20 March 2014 21:56   |
|
Alboni wrote on Thu, 20 March 2014 21:26 | ok, here a test with a dot
|
Ok, I see it now I mistakenly thought that you were adding it in to the 'mainconf', but you try to make it work in Add/Remove flags... That is not supported at the moment, but thinking about it, it would be good. It doesn't look trivial to implement, though, so it'll probably take me some time.
Regarding the issue with two flags separated by comma: TheIDE eagerly quotes the string, saving it as flags(WHEN) "FLAG1,FLAG2" If you manually edit it to remove the quotes, like: then the code actually works Unfortunately, the code that writes and reads this is used across multiple other options (link flags, uses, targets etc.) where the quoting is necessary. Another issue with this is that the code that saves the additional flags breaks it apart and saves it into two separate lines as soon as you do any changes in the .upp file. So it is probably easier to just add multiple lines... But I'll try to think of some simple way to make it work anyways, perhaps it'll be possible without duplicating too much code.
Honza
|
|
|
|
|
Goto Forum:
Current Time: Tue Apr 29 12:42:43 CEST 2025
Total time taken to generate the page: 0.01562 seconds
|
|
|