diff options
Diffstat (limited to 'cmake/opentrack-install.cmake')
| -rw-r--r-- | cmake/opentrack-install.cmake | 118 |
1 files changed, 40 insertions, 78 deletions
diff --git a/cmake/opentrack-install.cmake b/cmake/opentrack-install.cmake index 0dd5cc7d..5aac983b 100644 --- a/cmake/opentrack-install.cmake +++ b/cmake/opentrack-install.cmake @@ -1,96 +1,58 @@ -set(opentrack-perms_ WORLD_READ WORLD_EXECUTE OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE) -set(opentrack-perms PERMISSIONS ${opentrack-perms_}) +include_guard(GLOBAL) +macro(otr_install_misc path) + install(${ARGN} DESTINATION "${path}" PERMISSIONS ${opentrack-perms-file}) +endmacro() -macro(otr_inst2 path) - install(${ARGN} DESTINATION "${path}" ${opentrack-perms}) +macro(otr_install_exec path) + install(${ARGN} DESTINATION "${path}" PERMISSIONS ${opentrack-perms-file}) endmacro() -macro(otr_inst_dir path) +macro(otr_install_dir path) install( DIRECTORY ${ARGN} DESTINATION "${path}" - FILE_PERMISSIONS ${opentrack-perms_} - DIRECTORY_PERMISSIONS ${opentrack-perms_} + FILE_PERMISSIONS ${opentrack-perms-file} + DIRECTORY_PERMISSIONS ${opentrack-perms-dir} + PATTERN ".gtm" EXCLUDE ) endmacro() -function(install_sources) - get_property(source-dirs GLOBAL PROPERTY opentrack-all-source-dirs) - foreach(k ${source-dirs}) - file(RELATIVE_PATH dest "${CMAKE_SOURCE_DIR}" "${k}") - otr_inst_dir("${opentrack-doc-src-pfx}" "${dest}") - endforeach() +function(cleanup_visual_studio_debug) + otr_escape_string(pfx "${CMAKE_INSTALL_PREFIX}") + install(CODE "file(REMOVE_RECURSE \"${pfx}/.vs\")") endfunction() -otr_inst_dir("${opentrack-doc-pfx}" ${CMAKE_SOURCE_DIR}/3rdparty-notices) -otr_inst_dir("${opentrack-doc-pfx}" "${CMAKE_SOURCE_DIR}/settings" "${CMAKE_SOURCE_DIR}/contrib") -otr_inst_dir("${opentrack-doc-src-pfx}" "${CMAKE_SOURCE_DIR}/cmake") -otr_inst_dir("${opentrack-doc-src-pfx}" "${CMAKE_SOURCE_DIR}/bin") +otr_install_dir("${opentrack-doc}" ${CMAKE_SOURCE_DIR}/3rdparty-notices) +otr_install_dir("${opentrack-doc}" "${CMAKE_SOURCE_DIR}/settings" "${CMAKE_SOURCE_DIR}/contrib") +otr_install_dir("${opentrack-libexec}" "${CMAKE_SOURCE_DIR}/presets") if(WIN32) - otr_inst2(. FILES "${CMAKE_SOURCE_DIR}/bin/qt.conf") - otr_inst2(. FILES "${CMAKE_SOURCE_DIR}/bin/cleye.config") - otr_inst2(${opentrack-hier-pfx} FILES "${CMAKE_SOURCE_DIR}/bin/cleye.config") + otr_install_misc(. FILES "${CMAKE_SOURCE_DIR}/bin/qt.conf") + otr_install_misc(. FILES "${CMAKE_SOURCE_DIR}/bin/cleye.config") + otr_install_misc(${opentrack-libexec} FILES "${CMAKE_SOURCE_DIR}/bin/cleye.config") endif() -otr_inst2("${opentrack-doc-pfx}" FILES ${CMAKE_SOURCE_DIR}/README.md) - -otr_inst2("${opentrack-hier-pfx}" FILES "${CMAKE_SOURCE_DIR}/bin/freetrackclient.dll") -otr_inst2("${opentrack-hier-pfx}" FILES - "${CMAKE_SOURCE_DIR}/bin/NPClient.dll" - "${CMAKE_SOURCE_DIR}/bin/NPClient64.dll" - "${CMAKE_SOURCE_DIR}/bin/TrackIR.exe") - -otr_inst2("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/CMakeLists.txt") -otr_inst2("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/README.md") -otr_inst2("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/CONTRIBUTING.md") -otr_inst2("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/WARRANTY.txt") -otr_inst2("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/OPENTRACK-LICENSING.txt") -otr_inst2("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/AUTHORS.md") - -function(merge_translations) - set(SDK_SKIP_TRANSLATION_UPDATE FALSE CACHE BOOL "") - install(CODE "file(REMOVE_RECURSE \"\${CMAKE_INSTALL_PREFIX}/i18n\")") - - set(all-ts-files "") - set(all-qm-files "") - - foreach(i ${opentrack-all-translations}) - get_property(ts-files GLOBAL PROPERTY "opentrack-ts-files-${i}") - #get_property(ts-deps GLOBAL PROPERTY "opentrack-ts-targets-${i}") - - set(ts-files_ "") +otr_install_misc("${opentrack-doc}" FILES ${CMAKE_SOURCE_DIR}/README.md) - foreach(k ${ts-files}) - if(EXISTS "${k}") - list(APPEND ts-files_ "${k}") - endif() - endforeach() +otr_install_misc("${opentrack-doc}" FILES "${CMAKE_SOURCE_DIR}/README.md") +otr_install_misc("${opentrack-doc}" FILES "${CMAKE_SOURCE_DIR}/.github/CONTRIBUTING.md") +otr_install_misc("${opentrack-doc}" FILES "${CMAKE_SOURCE_DIR}/WARRANTY.txt") +otr_install_misc("${opentrack-doc}" FILES "${CMAKE_SOURCE_DIR}/OPENTRACK-LICENSING.txt") +otr_install_misc("${opentrack-doc}" FILES "${CMAKE_SOURCE_DIR}/AUTHORS.md") - set(ts-files "${ts-files_}") +# 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 - foreach(k ${ts-files}) - list(APPEND all-ts-files "${k}") - endforeach() - - if(NOT ".${ts-files}" STREQUAL ".") - if(SDK_SKIP_TRANSLATION_UPDATE) - set(lrelease-deps "") - else() - set(lrelease-deps "${ts-files}") - endif() - - set(qm-output "${CMAKE_CURRENT_BINARY_DIR}/${i}.qm") - list(APPEND all-qm-files "${qm-output}") - add_custom_command(OUTPUT "${qm-output}" - COMMAND "${Qt5_DIR}/../../../bin/lrelease" -nounfinished -silent ${ts-files} -qm "${qm-output}" - DEPENDS ${lrelease-deps} - COMMENT "Running lrelease for ${i}") - set(lang-target "i18n-lang-${i}") - - install(FILES "${qm-output}" DESTINATION "${opentrack-i18n-pfx}" RENAME "${i}.qm" ${opentrack-perms}) - endif() - endforeach() - add_custom_target(i18n ALL DEPENDS ${all-qm-files}) - add_custom_target(force-i18n DEPENDS ${all-ts-files} ${all-qm-files} i18n) -endfunction() +if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") + cleanup_visual_studio_debug() +endif() +# For now copy third party needed files into a seperate direcvtory instead of the plugins directory +if (APPLE) + set(OSX_POST_INSTALL_DIR "/../thirdparty") +endif() +otr_install_exec("${opentrack-libexec}${OSX_POST_INSTALL_DIR}" FILES "${CMAKE_SOURCE_DIR}/bin/freetrackclient.dll") +otr_install_exec("${opentrack-libexec}${OSX_POST_INSTALL_DIR}" FILES "${CMAKE_SOURCE_DIR}/bin/freetrackclient64.dll") +otr_install_exec("${opentrack-libexec}${OSX_POST_INSTALL_DIR}" FILES + "${CMAKE_SOURCE_DIR}/bin/NPClient.dll" + "${CMAKE_SOURCE_DIR}/bin/NPClient64.dll" + "${CMAKE_SOURCE_DIR}/bin/TrackIR.exe") |
