|
|
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 |
mdelfede
Messages: 1308 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 #33855 is a reply to message #33851] |
Mon, 19 September 2011 16: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
|
|
|
|
Re: Excluding files from build depending on flags [message #33857 is a reply to message #33856] |
Mon, 19 September 2011 18:01 |
|
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 |
mdelfede
Messages: 1308 Registered: September 2007
|
Ultimate Contributor |
|
|
Hi all
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 |
|
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 |
|
fudadmin
Messages: 1321 Registered: November 2005 Location: Kaunas, Lithuania
|
Ultimate Contributor Administrator |
|
|
mdelfede wrote on Mon, 19 September 2011 21:16 | Hi all
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.
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?
|
|
|
|
|
Goto Forum:
Current Time: Fri Nov 01 00:36:23 CET 2024
Total time taken to generate the page: 0.02620 seconds
|
|
|