11-01-2012 10:12 AM
Hi - could you explain exactly what you are trying to achieve?
you include files with the #include directive. If you don't #include it - it will be excluded.
you can always use other pre-processor directives to create conditional compiles .. e.g. #ifdef ... #endif which will be evaulated before the compilation actually starts.
Hope this helps a bit.
11-01-2012 10:47 AM
We have a lot of C code shared across multiple platforms, multiple projects etc.
The code is split into various folders on disk + under version control.
Not all the code in a particular folder is applicable to every app.
In effect its a library of source code where individual apps pick and choose which bits they need depending on functionality of that app.
Because we are dealing with Eclipse, it thinks that practically any file on your hard disk should be part of a project. It therefore decides all by itself that every single file in a folder pointed at must be part of your project - even if you only want a subset of the files.
In the case of regular Eclipse you can right click the file and set the 'Exclude resource from build' in the properties. for the file This means it wont compile the file even though its listed in the Project Explorer. Not great but it works.
In Momentics-Eclipse you can right click the file, set the Exlude from build and it completly ignores the setting. When you build it insists that it compile the file even though you know i) its not going to work, ii) you dont want it compiled, iii) you told the IDE not to compile it etc
So how do you tell Momentics NOT to compile some/any files that happen to exist in a folder in the build of a project ?
11-01-2012 10:58 AM
Ah - I think I understand the issue now - thanks.
I think the problem is not in Momentics, but rather in the .pro file which, by default has all headers and sources included from the main src folder. This is actually what gets used when you make a build. When you open the .pro file - you will see something like INCLUDES+= /src/*.h which will include all .h files from that folder.
So - you have to do this per project and then you should be able to use INCLUDES+= and INCLUDES-= to achieve what you want.
Not elegant - I know - struggling myself with Eclipse. I wish the BB10 team opted for a version of QtCreator. I think it's a much nicer IDE and with the Qt backing in BB10 anyway - it would have been a great choice.
11-01-2012 01:10 PM
Here is the example in my project
INCLUDEPATH += ../src
SOURCES += ../src/*.cpp ../src/model/*.cpp ../src/service/*.cpp ../src/qjson/*.cpp ../src/qjson/*.cc
HEADERS += ../src/*.hpp ../src/*.h ../src/model/*.hpp ../src/service/*.h ../src/qjson/*.h ../src/qjson/*.yy
11-01-2012 02:11 PM
So basically - you would group the files logically into folders, then in your .pro file - include or not include the entire folder. that should solve the problem.
11-01-2012 02:50 PM
well no, not really.
Folder content is primarly driven by 'project' which has nothing to do with Eclipse/Momentics etc, and often very little to do with an end product. This in turn is managed by our Version Control. Changing folder content and or re-directing files from Version control to other folders so a specific product whilst technically possible is highly undesirable.
As far as I can see what we actually need to do is simply list the files explictly in the .pro file that we want to be compiled. Assuming that works, thats fine + no different to marking files as Excluded from product in the IDE.
We made the fundamentally flawed assumption that Eclipse/Momentics was vagely sensible....+ that because Momentics is Eclipse it would be vagely working the same -
11-01-2012 02:58 PM
Listing files individually should certainly work. The .pro files are used in standard Qt development and I think that's were those are coming from.
In Qt - a .pro file can include other .pro files. So traditionally - what I have been doing in my Qt projects regarding source code libraries is create a .pro file for each "library", then in the main .pro file - you would include the libraries you need which, in turn, will include the files needed.
May be something to look at, but at least now you should know why are the files included and how to remedy the problem.
Hope my answers helped.