QMake manager KDevelop question
Kris Wong
wongk at seapine.com
Wed Oct 24 12:22:23 UTC 2007
> our approach uses the .qmake.cache for setting the build type and also
> setting up the build-directories. Here's an example:
>
> .qmake.cache:
> CUSTOM_BUILD_TYPE= release
> contains(CUSTOM_BUILD_TYPE, release){
> CONFIG_STRING=release
> }
> contains(CUSTOM_BUILD_TYPE, checked){
> CONFIG_STRING=checked
> DEFINES += _DEBUG
> }
> [...]
>
> There's also a check for the BUILD_TYPE setting:
> options = $$find(CUSTOM_BUILD_TYPE, "debug") $$find(CUSTOM_BUILD_TYPE,
> "release") $$find(CUSTOM_BUILD_TYPE, "checked")
> !count(options, 1){
> error( CUSTOM_BUILD_TYPE needs to have release OR debug OR
> checked set!)
> }
>
> The temporary output directories are set with:
> MOC_DIR = tmp/$$CONFIG_STRING
> OBJECTS_DIR = tmp/$$CONFIG_STRING
> RCC_DIR = tmp
> UI_DIR = uic
>
> Each .pro file includes (after setting up all of its stuff like
> sources, dependencies) a .pri file which sets the CONFIG variable for
> qt, and adjusts the TARGET name as well as the dependencies.
>
> example for the debug case:
> contains(CUSTOM_BUILD_TYPE, debug ){
> message("building debug")
> TARGETDEPS ~= s|\.a\b|d.a|g
> LIBS ~= s|\.a\b|d.a|g
> TARGET = $$join(TARGET,,,"d")
> message( "Target set to $$TARGET" )
> CONFIG -= release
> CONFIG += debug
> }
>
We do sort of a similar thing. We use a custom variable called MODE. We can then check:
equals(MODE, Release)
If this is true, it's a release build, any other value is a debug build. Our build directories are as such:
MOC_DIR = $$DESTDIR/moc
UI_DIR = $$DESTDIR/ui
etc...
DESTDIR would be set based on MODE. The qmake command would then be:
"qmake" for a debug build and
"qmake "MODE=Release"" for a release build
Kris Wong
More information about the KDevelop-devel
mailing list