diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-07-15 17:53:24 +0200 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-07-15 17:53:24 +0200 |
commit | 3b3e9f649a1fbd7bd67685bd5f24b45024ed4d6d (patch) | |
tree | b84c6487de997b818020483ded9acfe27a284536 | |
parent | Update Building.md (diff) | |
download | smolbote-3b3e9f649a1fbd7bd67685bd5f24b45024ed4d6d.tar.xz |
Add vendor.cmake
-rw-r--r-- | CMakeLists.txt | 24 | ||||
-rw-r--r-- | data/poi.ico | bin | 0 -> 45842 bytes | |||
-rw-r--r-- | data/windows.rc | 1 | ||||
-rw-r--r-- | plugins/ConfigurationEditor/CMakeLists.txt | 4 | ||||
-rw-r--r-- | plugins/ProfileEditor/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/CMakeLists.txt | 16 | ||||
-rw-r--r-- | vendor.cmake | 32 |
7 files changed, 52 insertions, 29 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a41bfe0..42f7c74 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,9 @@ project(smolbote) include(FeatureSummary) +set(VENDOR "${CMAKE_SOURCE_DIR}/vendor.cmake" CACHE FILEPATH "vendor configuration path") +include(${VENDOR}) + # Options option(MercurialRepo "Get version information from .hg" ON) option(CompilerWarnings "Compiler warnings" ON) @@ -44,23 +47,7 @@ if (UseLibCpp) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++") endif (UseLibCpp) -# detect version and commit from mercurial -if (MercurialRepo AND EXISTS "${PROJECT_SOURCE_DIR}/.hg") - execute_process(COMMAND hg log -r '.' --template={latesttag}.{latesttagdistance} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerInfo OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND hg log -r '.' --template={bookmarks} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerBookmark OUTPUT_STRIP_TRAILING_WHITESPACE) - # remove bookmark if it's not set - if(VcsBookmark STREQUAL "") - unset(VcsBookmark) - endif() - execute_process(COMMAND hg identify --id WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerCommit OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND hg identify --num WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerRevision OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND hg identify --branch WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerBranch OUTPUT_STRIP_TRAILING_WHITESPACE) -else() - set(VerInfo "0.0.0") - set(VerCommit "00000000") - set(VerRevision "0") - set(VerBranch "unknown") -endif() + # configure a header file to pass version information # if repo is missing or option is turned off, version.h.in can be configured @@ -89,6 +76,9 @@ if (Tests) endif() # Summarize +message("=== Configuration summary ===") feature_summary(WHAT ALL) +message("Building ${poi_NAME}") message("Version='${VerInfo}' bookmark='${VerBookmark}' commit='${VerCommit}'") +message("vendor.cmake: ${VENDOR}") message("C++ flags: ${CMAKE_CXX_FLAGS}") diff --git a/data/poi.ico b/data/poi.ico Binary files differnew file mode 100644 index 0000000..69d15e2 --- /dev/null +++ b/data/poi.ico diff --git a/data/windows.rc b/data/windows.rc new file mode 100644 index 0000000..050404d --- /dev/null +++ b/data/windows.rc @@ -0,0 +1 @@ +IDI_ICON1 ICON DISCARDABLE "poi.ico" diff --git a/plugins/ConfigurationEditor/CMakeLists.txt b/plugins/ConfigurationEditor/CMakeLists.txt index ed88877..0df613f 100644 --- a/plugins/ConfigurationEditor/CMakeLists.txt +++ b/plugins/ConfigurationEditor/CMakeLists.txt @@ -24,7 +24,7 @@ target_link_libraries(ConfigurationEditorPlugin ) if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") - install(TARGETS ConfigurationEditorPlugin RUNTIME DESTINATION bin/plugins CONFIGURATIONS Release) + install(TARGETS ConfigurationEditorPlugin RUNTIME DESTINATION ${PLUGIN_DESTINATION} CONFIGURATIONS Release) else() - install(TARGETS ConfigurationEditorPlugin LIBRARY DESTINATION lib/smolbote CONFIGURATIONS Release) + install(TARGETS ConfigurationEditorPlugin LIBRARY DESTINATION ${PLUGIN_DESTINATION} CONFIGURATIONS Release) endif() diff --git a/plugins/ProfileEditor/CMakeLists.txt b/plugins/ProfileEditor/CMakeLists.txt index 4f3e026..be65d8e 100644 --- a/plugins/ProfileEditor/CMakeLists.txt +++ b/plugins/ProfileEditor/CMakeLists.txt @@ -27,7 +27,7 @@ target_link_libraries(ProfileEditorPlugin ) if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") - install(TARGETS ProfileEditorPlugin RUNTIME DESTINATION bin/plugins CONFIGURATIONS Release) + install(TARGETS ProfileEditorPlugin RUNTIME DESTINATION ${PLUGIN_DESTINATION} CONFIGURATIONS Release) else() - install(TARGETS ProfileEditorPlugin LIBRARY DESTINATION lib/smolbote CONFIGURATIONS Release) + install(TARGETS ProfileEditorPlugin LIBRARY DESTINATION ${PLUGIN_DESTINATION} CONFIGURATIONS Release) endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8095cd6..5c7b6df 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -46,19 +46,19 @@ set(poi_SRC ) if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") - add_executable(poi WIN32 ${poi_SRC}) + add_executable(${poi_NAME} WIN32 ${poi_SRC} ../data/windows.rc) else() - add_executable(poi ${poi_SRC}) + add_executable(${poi_NAME} ${poi_SRC}) endif() -target_include_directories(poi +target_include_directories(${poi_NAME} PRIVATE ${Boost_INCLUDE_DIRS} PRIVATE ../3rd-party PRIVATE ../lib ../plugins PRIVATE ../lib/configuration PRIVATE ../lib/web) -target_link_libraries(poi +target_link_libraries(${poi_NAME} Qt5::Core Qt5::Widgets Qt5::Concurrent Qt5::WebEngineWidgets ${Boost_LIBRARIES} SingleApplication @@ -69,16 +69,16 @@ target_link_libraries(poi ) if(Plasma) - target_link_libraries(poi KF5::WindowSystem) - target_compile_definitions(poi + target_link_libraries(${poi_NAME} KF5::WindowSystem) + target_compile_definitions(${poi_NAME} PRIVATE PLASMA_BLUR # give the main window a translucent background and blur ) endif(Plasma) -target_compile_definitions(poi +target_compile_definitions(${poi_NAME} PRIVATE QAPPLICATION_CLASS=QApplication PRIVATE QTBUG_65223_WORKAROUND #PRIVATE QTBUG_68224_WORKAROUND ) -install(TARGETS poi RUNTIME DESTINATION bin CONFIGURATIONS Release) +install(TARGETS ${poi_NAME} RUNTIME DESTINATION ${BINARY_DESTINATION} CONFIGURATIONS Release) diff --git a/vendor.cmake b/vendor.cmake new file mode 100644 index 0000000..17191e5 --- /dev/null +++ b/vendor.cmake @@ -0,0 +1,32 @@ +# Build configuration + +# install paths +set(BINARY_DESTINATION bin) +if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") + set(PLUGIN_DESTINATION bin/plugins) +else() + set(PLUGIN_DESTINATION lib/smolbote) +endif() + +# executable name +set(poi_NAME poi) + +# detect version and commit from mercurial +if (MercurialRepo AND EXISTS "${PROJECT_SOURCE_DIR}/.hg") + execute_process(COMMAND hg log -r '.' --template={latesttag}.{latesttagdistance} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerInfo OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND hg log -r '.' --template={bookmarks} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerBookmark OUTPUT_STRIP_TRAILING_WHITESPACE) + # remove bookmark if it's not set + if(VcsBookmark STREQUAL "") + unset(VcsBookmark) + endif() + + execute_process(COMMAND hg identify --id WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerCommit OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND hg identify --num WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerRevision OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND hg identify --branch WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerBranch OUTPUT_STRIP_TRAILING_WHITESPACE) +else() + set(VerInfo "0.2.2") + #set(VerBookmark "stable") + set(VerCommit "00000000") + set(VerRevision "0") + set(VerBranch "unknown") +endif() |