Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ TheIDE » U++ TheIDE: Packages » Excluding files from build depending on flags
Excluding files from build depending on flags [message #33851] Mon, 19 September 2011 12:35 Go to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
I have a library with some files that must be compiled JUST for windows and other JUST for Linux; they've no guards inside, so they should be excluded/included my build system.

Is it possible to add this feature inside package organizer ?

Ciao

Max
Re: Excluding files from build depending on flags [message #33852 is a reply to message #33851] Mon, 19 September 2011 12:41 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
mdelfede wrote on Mon, 19 September 2011 11:35

I have a library with some files that must be compiled JUST for windows and other JUST for Linux; they've no guards inside, so they should be excluded/included my build system.

Is it possible to add this feature inside package organizer ?

Ciao

Max



Why is it not enough using example how files in CtrlCore are compiled?
Re: Excluding files from build depending on flags [message #33853 is a reply to message #33852] Mon, 19 September 2011 14:52 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
fudadmin wrote on Mon, 19 September 2011 12:41



Why is it not enough using example how files in CtrlCore are compiled?



Could you please translate your sentence in an usable example ?

Max
Re: Excluding files from build depending on flags [message #33854 is a reply to message #33853] Mon, 19 September 2011 15:38 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
there are files in CtrlCore like Win32Wnd.cpp and similar Win32*.cpp which have all the code inside them surrounded by
#ifdef PLATFORM_WIN32
...
...
...
#endif

and accordingly X11Wnd.cpp and similar X11*.cpp
which have all the code inside them surrounded by
#ifdef PLATFORM_X11
...
...
...
#endif

As I understand, the whole code inside those files is excluded from compilation according to the platform. Sorry if I am not able to catch other reasons what would you like to achieve.
Re: Excluding files from build depending on flags [message #33855 is a reply to message #33851] Mon, 19 September 2011 16:15 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Hi Max,

I was facing similar solution when making the portaudio plugin. I solved it by leaving the platform specific files out of package, just including them conditionally inside of pa_upp_platform.c:
#ifdef flagPOSIX
        #include "os/unix/pa_unix_hostapis.c"
        #include "os/unix/pa_unix_util.c"
#else
        #include "os/win/pa_win_hostapis.c"
        #include "os/win/pa_win_util.c"
        #include "os/win/pa_win_waveformat.c"
        #include "os/win/pa_win_coinitialize.c"
//      #include "os/win/pa_x86_plain_converters.c"
#endif


It is an ugly workaround, but it works. Of course having the ability to compile files conditionally would be a nice feature to have.

Best regards,
Honza
Re: Excluding files from build depending on flags [message #33856 is a reply to message #33855] Mon, 19 September 2011 16:52 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
dolik.rce wrote on Mon, 19 September 2011 15:15

Hi Max,

I was facing similar solution when making the portaudio plugin. I solved it by leaving the platform specific files out of package, just including them conditionally inside of pa_upp_platform.c:
#ifdef flagPOSIX
        #include "os/unix/pa_unix_hostapis.c"
        #include "os/unix/pa_unix_util.c"
#else
        #include "os/win/pa_win_hostapis.c"
        #include "os/win/pa_win_util.c"
        #include "os/win/pa_win_waveformat.c"
        #include "os/win/pa_win_coinitialize.c"
//      #include "os/win/pa_x86_plain_converters.c"
#endif


It is an ugly workaround, but it works. Of course having the ability to compile files conditionally would be a nice feature to have.

Best regards,
Honza


Settings for individual files would be maybe good. But then this topic should have been started (or moved?) to the ide wishlist?

Honza, but these workarounds are only needed for external projects? Or do you see them used for your own projects?

Also, for external projects there is a possibility to create separate packages for different platforms...
Re: Excluding files from build depending on flags [message #33857 is a reply to message #33856] Mon, 19 September 2011 18:01 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

fudadmin wrote on Mon, 19 September 2011 16:52

Settings for individual files would be maybe good. But then this topic should have been started (or moved?) to the ide wishlist?
Yes, it would be probably a better place.

fudadmin wrote on Mon, 19 September 2011 16:52

Honza, but these workarounds are only needed for external projects? Or do you see them used for your own projects?
Yes, I only needed this becuase I wanted to use unmodified 3rd party sources (to allow simple updates in future).

fudadmin wrote on Mon, 19 September 2011 16:52

Also, for external projects there is a possibility to create separate packages for different platforms...
That is probably the cleanest solution - I just didn't think of it at the time. Altough it might feel a bit strange when creating separate package for each platform containing just a few files...

Honza
Re: Excluding files from build depending on flags [message #33861 is a reply to message #33857] Mon, 19 September 2011 22:16 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
Hi all Smile

Fudadmin : the problem is *not* how to do it with your code, is to import external libraries without patching them, if possible.
As I said in my post, GUARDS ARE NOT INCLUDED inside those library files.

To make importing of external libs easier, we're missing :

1) Ability to exclude a file from build (or maybe, force include some if it has a weird extension).
The freetype library, for example, has many c files included by others; I had to leave them out of packaged managed files... it works but it's not an optimal solution

2) a way to thell Upp where to search include files if they're in a weird location/have a weird format. FTGL and fretype had many of those, I had to patch almost all includes, and that's bad when you maintain a package.

3) a way to conditionally disable compilation of some modules. Most unix libs are configured by configure file which exclude/include some modules in makefile, depending on platform. That could be done by flag-dependence in Upp.

First problem is easy to solve; about the second, I don't know... maybe it's enough to append a package-dependent path to include search when building the package.

I'm importing OpenCascade libraries, which are a real nightmare... they've got all those problems and many more.
I'm doing it with an application that reads the whole library sources, patch them and writes to Upp package destination.... as they're thousands of files, a manual approach would be almost impossible.

Max

[Updated on: Mon, 19 September 2011 22:20]

Report message to a moderator

Re: Excluding files from build depending on flags [message #33862 is a reply to message #33861] Mon, 19 September 2011 22:54 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Just an idea:

What about kind of "metapackage", that would use the "native" makefile (or scons, waf, etc.) based compilation? It should be possible to trigger it as a custom build step. The only thing you would need to do manually would be to specify the resulting object files to be linked to the executable, using custom link options in package organizer (on this level you could also use flags to manage platform dependent files). The .c/cpp sources would have to stay out of the project, but I believe in most cases having headers is enough for Assist++.

What do you think about that? IMHO it would avoid a lot of work and also keep the updates very simple...

Honza

[Updated on: Mon, 19 September 2011 22:55]

Report message to a moderator

Re: Excluding files from build depending on flags [message #33866 is a reply to message #33861] Tue, 20 September 2011 01:39 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
mdelfede wrote on Mon, 19 September 2011 21:16

Hi all Smile

Fudadmin : the problem is *not* how to do it with your code, is to import external libraries without patching them, if possible.
As I said in my post, GUARDS ARE NOT INCLUDED inside those library files.

Max



Sorry, Max, I didn't understand from your question. The word "external" was not mentioned. Smile

Recently myself I was dealing with this kind/similar problems by writing bash-sed-awk scripts to automatically create upp packages to manage archlinux PKGBUILDS.
another posiblity is to write usc macros.

But, yes, I agree, more flexibility and options would be good. So we can conclude that the current packages build system doesnt allow "Excluding files from build depending on flags" and this topic should go to a wishlist section? Smile
Re: Excluding files from build depending on flags [message #33868 is a reply to message #33851] Tue, 20 September 2011 09:45 Go to previous messageGo to next message
mr_ped is currently offline  mr_ped
Messages: 825
Registered: November 2005
Location: Czech Republic - Praha
Experienced Contributor
I already did post such topic long time ago. Wink (too busy to search now)
Re: Excluding files from build depending on flags [message #33870 is a reply to message #33868] Tue, 20 September 2011 12:02 Go to previous message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
mr_ped wrote on Tue, 20 September 2011 09:45

I already did post such topic long time ago. Wink (too busy to search now)


Me too Smile.

The problem was to find something portable thinking in that in next future it would be possible to compile U++ without TheIDE.


Best regards
IƱaki
Previous Topic: Where I find other templates?
Next Topic: Cannot add packages to main package
Goto Forum:
  


Current Time: Fri Mar 29 11:29:31 CET 2024

Total time taken to generate the page: 0.02032 seconds