From: Iceyer Date: Mon, 12 Feb 2018 17:14:37 +0000 (+0800) Subject: fix: better static lib support X-Git-Tag: archive/raspbian/5.7.12-2+rpi1^2~130^2~8 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=99886406a0cae849fad23286fdf64bb399e37da0;p=dtkcore.git fix: better static lib support Change-Id: I13c0588a79d8ec66ee5a6d62c28de6341e6f7127 --- diff --git a/src/dtk_build.prf b/src/dtk_build.prf index f71a50e..77cd6ba 100644 --- a/src/dtk_build.prf +++ b/src/dtk_build.prf @@ -63,3 +63,7 @@ isEmpty(INCLUDE_INSTALL_DIR) { DTK_INCLUDEPATH = $$INCLUDE_INSTALL_DIR/libdtk-$${VER_MAJ}.$${VER_MIN}.$${VER_PAT} } +!isEmpty(DTK_STATIC_LIB){ + DEFINES += DTK_STATIC_LIB + CONFIG += staticlib +} diff --git a/src/dtk_cmake.prf b/src/dtk_cmake.prf index 7ee45f9..33bdf9e 100644 --- a/src/dtk_cmake.prf +++ b/src/dtk_cmake.prf @@ -7,13 +7,12 @@ isEmpty(CMAKE_MODULE): error("CMAKE_MODULE must not empty") WORK_DIR=$$_PRO_FILE_PWD_ message("config cmake module: $$CMAKE_MODULE") -message("write cmake file to: $$WORK_DIR") CMAKE_MODULE_INCLUDE_DIR=$$upper($${CMAKE_MODULE})_INCLUDE_DIR INC_DIR = $$replace(includes.path, "/", "\/") CMD = sed -E \'s/$${CMAKE_MODULE_INCLUDE_DIR} \".*\"\\)$/$${CMAKE_MODULE_INCLUDE_DIR} \"$${INC_DIR}\"\\)/\' $$WORK_DIR/../cmake/$${CMAKE_MODULE}/$${CMAKE_MODULE}Config.cmake.in > $$WORK_DIR/../cmake/$${CMAKE_MODULE}/$${CMAKE_MODULE}Config.cmake - +message("write cmake file to: $$WORK_DIR/../cmake/$${CMAKE_MODULE}/$${CMAKE_MODULE}Config.cmake") system($$CMD) | error("config cmake failed") cmake_config.files = $$PWD/../cmake diff --git a/src/dtkcore_global.h b/src/dtkcore_global.h index 6c501b7..927acd0 100644 --- a/src/dtkcore_global.h +++ b/src/dtkcore_global.h @@ -47,7 +47,7 @@ #endif -#if defined(STATIC_LIB) +#if defined(DTK_STATIC_LIB) # define LIBDTKCORESHARED_EXPORT #else #if defined(LIBDTKCORE_LIBRARY) diff --git a/tests/tests.pro b/tests/tests.pro index 9f3008d..12a8940 100644 --- a/tests/tests.pro +++ b/tests/tests.pro @@ -4,6 +4,10 @@ QT -= gui TEMPLATE = app CONFIG += c++11 +!isEmpty(DTK_STATIC_LIB){ + DEFINES += DTK_STATIC_LIB +} + SOURCES += \ main.cpp \ dutiltester.cpp \ diff --git a/tools/settings/settings.pro b/tools/settings/settings.pro index 7dd83df..d51c2ea 100644 --- a/tools/settings/settings.pro +++ b/tools/settings/settings.pro @@ -15,14 +15,19 @@ SOURCES += main.cpp isEmpty(PREFIX){ PREFIX = /usr } +isEmpty(BIN_INSTALL_DIR) { + BIN_INSTALL_DIR=$${PREFIX}/lib/dtk2 +} +!isEmpty(DTK_STATIC_LIB){ + DEFINES += DTK_STATIC_LIB +} -binary.files += $${OUT_PWD}/dtk-settings -binary.path = $${PREFIX}/lib/dtk2 +target.path = $${BIN_INSTALL_DIR} script.files += $${PWD}/../script/*.py -script.path = $${PREFIX}/lib/dtk2 +script.path = $${BIN_INSTALL_DIR} -INSTALLS += binary script +INSTALLS += target script win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../../src/release/ -ldtkcore else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../../src/debug/ -ldtkcore