Debug/release folders with subdir template preventing from finding lib
-
Hello,
i currently have a project with a structure like this :- project.pro
- app
- mylib
the issue is how to link the libmylib.a for my app.exe, ignoring the debug/release folders
i'm programming with qtcreator on windows with mingw.
but i need my code to be able to be compiled on command line on a linux machine, on windows i get this build structure :build_dir :
- app
-
- release
-
- debug
- mylib
-
- release
-
-
- libmylib.a
-
-
- debug
-
-
- libmylib.a
-
and on linux, i got this :
build dir :
- app
- mylib
-
- libmylib.a
so, from the point of view of app.pro, the path to libmylib.a changed depending on the system, preventing me to link correctly with the same .pro files on both systems.
I have two questions :- is it possible to ignore the build / release directories (automatically append them depending on the build option) ?
- is it possible on command line, to call qmake on a certain way to get the exact same structure qtcreatot generates on windows ?
-
-
Hi,
In project file:
#configure var (path where the compiler is saving result) DESTDIR win32-g++:CONFIG(release, debug|release): DESTDIR = $$OUT_PWD/release linux-g++:CONFIG(release, debug|release): DESTDIR = $$OUT_PWD win32-g++:CONFIG(debug, debug|release): DESTDIR = $$OUT_PWD/debug linux-g++:CONFIG(debug, debug|release): DESTDIR = $$OUT_PWD #configure var PATHCOPY win32-g++:PATHCOPY = C:/myfolder/lib linux-g++:PATHCOPY = /opt/myfolder/lib #after compilation will automatically copy to PATHCOPY QMAKE_POST_LINK = $${QMAKE_COPY} $$DESTDIR/$$TARGET $$PATHCOPY/$$TARGET
-
Finally fixed it, i used a .qmake.conf file to store the root directory in a shared variable, for those who are interested, here are my 3 .pro files :
TEMPLATE = subdirs CONFIG += ordered c++11 SUBDIRS = ircbot \ myApp myApp.depends = ircbot
DESTDIR = $$lib_dir TARGET = mylib TEMPLATE = lib CONFIG += staticlib SOURCES += ... HEADERS += ... FORMS += ...
DESTDIR = $$bin_dir TARGET = myApp TEMPLATE = app LIBS += $$lib_dir/libmylib.a INCLUDEPATH += ../mylib SOURCES = ... HEADERS += ... FORMS += ...
and finally, the .qmake.conf file :
lib_dir=$$PWD/lib bin_dir=$$PWD/bin
this successfully creates this project structure :
- bin
-
- myApp.exe
- lib
-
- mylib.a
- project.pro
- .qmake.conf
- myApp
- mylib
+ a build directory anywhere i want