diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-10-27 12:51:49 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-10-27 12:51:49 +0200 |
commit | 841d3b28d6bda2fca3275ade618c28627b0565c2 (patch) | |
tree | 7df9c73e92a3b17a882ef972dee070bb6d089824 | |
parent | efbfb1fa5bd5d3331587404f2fe2c853af95899d (diff) |
cmake: cleanup
Don't install any source code components.
-rw-r--r-- | cmake/opentrack-hier.cmake | 7 | ||||
-rw-r--r-- | cmake/opentrack-i18n.cmake | 25 | ||||
-rw-r--r-- | cmake/opentrack-install.cmake | 56 | ||||
-rw-r--r-- | cmake/opentrack-platform.cmake | 22 |
4 files changed, 45 insertions, 65 deletions
diff --git a/cmake/opentrack-hier.cmake b/cmake/opentrack-hier.cmake index 8f778bb2..734ba183 100644 --- a/cmake/opentrack-hier.cmake +++ b/cmake/opentrack-hier.cmake @@ -44,13 +44,6 @@ function(otr_escape_string var str) set(${var} "${tmp__}" PARENT_SCOPE)
endfunction()
-function(otr_setup_refresh_install_dir)
- if((NOT CMAKE_INSTALL_PREFIX STREQUAL "") AND (NOT opentrack-doc-src-pfx STREQUAL ""))
- otr_escape_string(dir "${CMAKE_INSTALL_PREFIX}/${opentrack-doc-src-pfx}/")
- install(CODE "file(REMOVE_RECURSE \"${dir}\")")
- endif()
-endfunction()
-
set(opentrack-contrib-pfx "${opentrack-doc-pfx}/contrib")
set(opentrack-binary-suffix "")
diff --git a/cmake/opentrack-i18n.cmake b/cmake/opentrack-i18n.cmake index 543d1eea..c23d5d1d 100644 --- a/cmake/opentrack-i18n.cmake +++ b/cmake/opentrack-i18n.cmake @@ -1,3 +1,5 @@ +add_custom_target(i18n ALL) + function(otr_i18n_for_target_directory n) set(k "opentrack-${n}") @@ -25,32 +27,22 @@ function(otr_i18n_for_target_directory n) . -ts "${t}" COMMAND "${CMAKE_COMMAND}" -E copy "${t}" "${t2}" - DEPENDS ${input} ${t} + DEPENDS "${input}" "${t}" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" COMMENT "Running lupdate for ${n}/${i}") set(target-name "i18n-lang-${i}-module-${n}") list(APPEND target-names "${target-name}") - add_custom_target(${target-name} DEPENDS "${t2}" "${t}" COMMENT "") - add_dependencies("opentrack-${n}" "${target-name}") + add_custom_target(${target-name} DEPENDS "${t2}" COMMENT "") set_property(GLOBAL APPEND PROPERTY "opentrack-ts-files-${i}" "${t2}") set_property(GLOBAL APPEND PROPERTY "opentrack-ts-module-${n}" "${target-name}") endforeach() - add_custom_target("i18n-module-${n}" DEPENDS ${target-names}) + #add_custom_target("i18n-module-${n}" DEPENDS ${target-names}) endfunction() function(otr_merge_translations) otr_escape_string(i18n-pfx "${opentrack-i18n-pfx}") install(CODE "file(REMOVE_RECURSE \"\${CMAKE_INSTALL_PREFIX}/${i18n-pfx}\")") - get_property(variant GLOBAL PROPERTY opentrack-variant) - if(NOT ".${variant}" STREQUAL ".default") - set(force-skip-update TRUE) - else() - set(force-skip-update FALSE) - endif() - - set(all-qm-files "") - get_property(all-modules GLOBAL PROPERTY opentrack-all-modules) set(all-ts-targets "") @@ -65,7 +57,6 @@ function(otr_merge_translations) get_property(lrelease-binary TARGET "${Qt5_LRELEASE_EXECUTABLE}" PROPERTY IMPORTED_LOCATION) set(qm-output "${CMAKE_CURRENT_BINARY_DIR}/${i}.qm") - list(APPEND all-qm-files "${qm-output}") # whines about duplicate messages since tracker-pt-base is static if(WIN32) @@ -82,13 +73,15 @@ function(otr_merge_translations) ${ts-files} -qm "${qm-output}" ${to-null} - DEPENDS ${all-ts-targets} ${ts-files} + DEPENDS ${all-ts-targets} COMMENT "Running lrelease for ${i}") + add_custom_target("i18n-qm-${i}" DEPENDS "${qm-output}") + add_dependencies(i18n "i18n-qm-${i}") + install(FILES "${qm-output}" DESTINATION "${CMAKE_INSTALL_PREFIX}/${opentrack-i18n-pfx}" PERMISSIONS ${opentrack-perms-file}) endforeach() - add_custom_target(i18n ALL DEPENDS ${all-qm-files}) endfunction() diff --git a/cmake/opentrack-install.cmake b/cmake/opentrack-install.cmake index 45f6ce18..d15951e9 100644 --- a/cmake/opentrack-install.cmake +++ b/cmake/opentrack-install.cmake @@ -14,32 +14,35 @@ macro(otr_install_dir path) ) endmacro() +function(otr_setup_refresh_install_dir) + if((NOT CMAKE_INSTALL_PREFIX STREQUAL "") AND (NOT opentrack-doc-src-pfx STREQUAL "")) + otr_escape_string(dir "${CMAKE_INSTALL_PREFIX}/${opentrack-doc-src-pfx}/") + install(CODE "file(REMOVE_RECURSE \"${dir}\")") + endif() +endfunction() + function(install_sources) - if(FALSE) - otr_setup_refresh_install_dir() - get_property(source-dirs GLOBAL PROPERTY opentrack-all-source-dirs) - foreach(k ${source-dirs}) - file(RELATIVE_PATH dest "${CMAKE_SOURCE_DIR}" "${k}") - otr_install_dir("${opentrack-doc-src-pfx}" "${dest}") - endforeach() + otr_setup_refresh_install_dir() + get_property(source-dirs GLOBAL PROPERTY opentrack-all-source-dirs) + foreach(k ${source-dirs}) + file(RELATIVE_PATH dest "${CMAKE_SOURCE_DIR}" "${k}") + otr_install_dir("${opentrack-doc-src-pfx}" "${dest}") + endforeach() - otr_install_dir("${opentrack-doc-src-pfx}" "${CMAKE_SOURCE_DIR}/cmake") - otr_install_dir("${opentrack-doc-src-pfx}" "${CMAKE_SOURCE_DIR}/bin") + otr_install_dir("${opentrack-doc-src-pfx}" "${CMAKE_SOURCE_DIR}/cmake") + otr_install_dir("${opentrack-doc-src-pfx}" "${CMAKE_SOURCE_DIR}/bin") - otr_install_misc("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/CMakeLists.txt") - otr_install_misc("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/README.md") - otr_install_misc("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/.github/CONTRIBUTING.md") - otr_install_misc("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/WARRANTY.txt") - otr_install_misc("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/OPENTRACK-LICENSING.txt") - otr_install_misc("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/AUTHORS.md") - endif() + otr_install_misc("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/CMakeLists.txt") + otr_install_misc("${opentrack-doc-pfx}" FILES "${CMAKE_SOURCE_DIR}/README.md") + otr_install_misc("${opentrack-doc-pfx}" FILES "${CMAKE_SOURCE_DIR}/.github/CONTRIBUTING.md") + otr_install_misc("${opentrack-doc-pfx}" FILES "${CMAKE_SOURCE_DIR}/WARRANTY.txt") + otr_install_misc("${opentrack-doc-pfx}" FILES "${CMAKE_SOURCE_DIR}/OPENTRACK-LICENSING.txt") + otr_install_misc("${opentrack-doc-pfx}" FILES "${CMAKE_SOURCE_DIR}/AUTHORS.md") endfunction() function(cleanup_visual_studio_debug) - #if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") - otr_escape_string(pfx "${CMAKE_INSTALL_PREFIX}") - install(CODE "file(REMOVE_RECURSE \"${pfx}/.vs\")") - #endif() + otr_escape_string(pfx "${CMAKE_INSTALL_PREFIX}") + install(CODE "file(REMOVE_RECURSE \"${pfx}/.vs\")") endfunction() otr_install_dir("${opentrack-doc-pfx}" ${CMAKE_SOURCE_DIR}/3rdparty-notices) @@ -53,17 +56,16 @@ endif() otr_install_misc("${opentrack-doc-pfx}" FILES ${CMAKE_SOURCE_DIR}/README.md) -otr_install_misc("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/CMakeLists.txt") -otr_install_misc("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/README.md") -otr_install_misc("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/.github/CONTRIBUTING.md") -otr_install_misc("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/WARRANTY.txt") -otr_install_misc("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/OPENTRACK-LICENSING.txt") -otr_install_misc("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/AUTHORS.md") +otr_install_misc("${opentrack-doc-pfx}" FILES "${CMAKE_SOURCE_DIR}/README.md") +otr_install_misc("${opentrack-doc-pfx}" FILES "${CMAKE_SOURCE_DIR}/.github/CONTRIBUTING.md") +otr_install_misc("${opentrack-doc-pfx}" FILES "${CMAKE_SOURCE_DIR}/WARRANTY.txt") +otr_install_misc("${opentrack-doc-pfx}" FILES "${CMAKE_SOURCE_DIR}/OPENTRACK-LICENSING.txt") +otr_install_misc("${opentrack-doc-pfx}" FILES "${CMAKE_SOURCE_DIR}/AUTHORS.md") # this must be done last because the files may be in use already # do it last so in case of file-in-use failure, the rest is installed -if(MSVC AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") +if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") cleanup_visual_studio_debug() endif() diff --git a/cmake/opentrack-platform.cmake b/cmake/opentrack-platform.cmake index 2df0bfe0..365aba62 100644 --- a/cmake/opentrack-platform.cmake +++ b/cmake/opentrack-platform.cmake @@ -37,7 +37,7 @@ if(APPLE) endif() endif() -if(MSVC AND MSVC_VERSION LESS "1900" AND NOT ".${CMAKE_CXX_COMPILER_ID}" STREQUAL ".Clang") +if(MSVC AND MSVC_VERSION LESS "1915" AND NOT ".${CMAKE_CXX_COMPILER_ID}" STREQUAL ".Clang") message(FATAL_ERROR "Visual Studio too old. Use Visual Studio 2017 Preview or newer.") endif() @@ -72,11 +72,9 @@ if(MSVC) add_definitions(-D_SILENCE_CXX17_NEGATORS_DEPRECATION_WARNING) add_definitions(-D_SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING) - if(MSVC_VERSION GREATER 1909) # visual studio 2017 - set(__stuff "-permissive-") - set(CMAKE_CXX_FLAGS "${__stuff} ${CMAKE_CXX_FLAGS}") - set(CMAKE_C_FLAGS "${__stuff} ${CMAKE_CXX_FLAGS}") - endif() + set(__stuff "-permissive- -diagnostics:caret") + set(CMAKE_CXX_FLAGS "${__stuff} ${CMAKE_CXX_FLAGS}") + set(CMAKE_C_FLAGS "${__stuff} ${CMAKE_CXX_FLAGS}") if(opentrack-64bit) set(ent "-HIGHENTROPYVA") @@ -114,13 +112,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) include_directories("${CMAKE_SOURCE_DIR}") -if(CMAKE_COMPILER_IS_GNUCXX AND UNIX) +if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE) set(_common "-fvisibility=hidden") set(CMAKE_C_FLAGS "${_common} ${CMAKE_C_FLAGS}") - set(CMAKE_CXX_FLAGS "${_common} ${CMAKE_CXX_FLAGS}") - if(NOT APPLE) - set(CMAKE_CXX_FLAGS "-fuse-cxa-atexit ${CMAKE_CXX_FLAGS}") - endif() + set(CMAKE_CXX_FLAGS "${_common} -fuse-cxa-atexit ${CMAKE_CXX_FLAGS}") endif() if(APPLE) @@ -149,13 +144,10 @@ if(MINGW) endif() # assume binutils -if(LINUX) +if(UNIX AND NOT APPLE) foreach (i SHARED MODULE EXE) set(CMAKE_${i}_LINKER_FLAGS "-Wl,-z,relro,-z,now,--exclude-libs,ALL ${CMAKE_${i}_LINKER_FLAGS}") endforeach() -endif() - -if(UNIX AND NOT APPLE) include(opentrack-pkg-config) endif() |