Skip to content

Commit

Permalink
fix: better static lib support
Browse files Browse the repository at this point in the history
Change-Id: I13c0588a79d8ec66ee5a6d62c28de6341e6f7127
  • Loading branch information
Iceyer committed Feb 12, 2018
1 parent 137b913 commit 9988640
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 deletions.
4 changes: 4 additions & 0 deletions src/dtk_build.prf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
3 changes: 1 addition & 2 deletions src/dtk_cmake.prf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/dtkcore_global.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#endif


#if defined(STATIC_LIB)
#if defined(DTK_STATIC_LIB)
# define LIBDTKCORESHARED_EXPORT
#else
#if defined(LIBDTKCORE_LIBRARY)
Expand Down
4 changes: 4 additions & 0 deletions tests/tests.pro
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ QT -= gui
TEMPLATE = app
CONFIG += c++11

!isEmpty(DTK_STATIC_LIB){
DEFINES += DTK_STATIC_LIB
}

SOURCES += \
main.cpp \
dutiltester.cpp \
Expand Down
13 changes: 9 additions & 4 deletions tools/settings/settings.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9988640

Please sign in to comment.