diff options
-rwxr-xr-x | CMakeLists.txt | 2 | ||||
-rw-r--r-- | cmake/opentrack-boilerplate.cmake | 4 | ||||
-rw-r--r-- | cmake/opentrack-hier.cmake | 76 | ||||
-rw-r--r-- | cmake/opentrack-install.cmake | 2 | ||||
-rw-r--r-- | cmake/opentrack-rift.cmake | 65 | ||||
-rw-r--r-- | proto-wine/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tracker-rift-025/CMakeLists.txt | 1 | ||||
-rw-r--r-- | x-plane-plugin/CMakeLists.txt | 1 |
8 files changed, 89 insertions, 63 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index b69f7860..d61eb6be 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,8 +5,8 @@ include(opentrack-build) project(opentrack C CXX) cmake_minimum_required(VERSION 2.8.11) -include(opentrack-word-size) include(opentrack-hier) +include(opentrack-word-size) include(opentrack-policy) include(opentrack-qt) include(opentrack-platform) diff --git a/cmake/opentrack-boilerplate.cmake b/cmake/opentrack-boilerplate.cmake index 970d542d..3b2cadfe 100644 --- a/cmake/opentrack-boilerplate.cmake +++ b/cmake/opentrack-boilerplate.cmake @@ -1,5 +1,3 @@ -include(opentrack-hier) - set(new-hier-path "#pragma once #include <QCoreApplication> #include <QString> @@ -68,6 +66,8 @@ function(opentrack_boilerplate__ n files_ no-library_ static_ no-compat_ compile set(link-mode STATIC) endif() add_library(${n} ${link-mode} ${files_}) + set(all-files ${${n}-c} ${${n}-res} ${${n}-ui} ${${n}-rc}) + install(FILES ${all-files} DESTINATION "${opentrack-doc-src-pfx}/${n}") message(STATUS "module ${n}") endif() if(NOT no-library_) diff --git a/cmake/opentrack-hier.cmake b/cmake/opentrack-hier.cmake index ee2d0bbf..a9c1ee1a 100644 --- a/cmake/opentrack-hier.cmake +++ b/cmake/opentrack-hier.cmake @@ -1,29 +1,51 @@ -if(APPLE)
- set(opentrack-hier-pfx ".")
- set(opentrack-hier-path "/")
- set(opentrack-hier-doc "/")
- set(opentrack-hier-str RUNTIME DESTINATION . LIBRARY DESTINATION .)
- set(opentrack-doc-pfx ".")
-elseif(WIN32)
- set(opentrack-hier-pfx "./modules")
- set(opentrack-hier-path "/modules/")
- set(opentrack-hier-doc "/doc/")
- set(opentrack-doc-pfx "./doc")
- set(opentrack-hier-str RUNTIME DESTINATION ./modules/ LIBRARY DESTINATION ./modules/)
-else()
- set(opentrack-hier-pfx "libexec/opentrack")
- set(opentrack-hier-path "/../libexec/opentrack/")
- set(opentrack-hier-doc "/share/doc/opentrack/")
- set(opentrack-doc-pfx "./share/doc/opentrack")
- set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${opentrack-hier-pfx}")
- set(opentrack-hier-str ARCHIVE DESTINATION lib/opentrack LIBRARY DESTINATION ${opentrack-hier-pfx} RUNTIME DESTINATION bin)
-endif()
+if(NOT opentrack-hier-included)
+ set(opentrack-hier-included TRUE)
-set(opentrack-contrib-pfx "${opentrack-doc-pfx}/contrib")
+ if(APPLE)
+ set(opentrack-hier-pfx ".")
+ set(opentrack-hier-path "/")
+ set(opentrack-hier-doc "/")
+ set(opentrack-hier-str RUNTIME DESTINATION . LIBRARY DESTINATION .)
+ set(opentrack-doc-pfx "./doc")
+ set(opentrack-doc-src-pfx "./source-code")
+ elseif(WIN32)
+ set(opentrack-hier-pfx "./modules")
+ set(opentrack-hier-path "/modules/")
+ set(opentrack-hier-doc "/doc/")
+ set(opentrack-doc-pfx "./doc")
+ set(opentrack-doc-src-pfx "./source-code")
+ set(opentrack-hier-str RUNTIME DESTINATION ./modules/ LIBRARY DESTINATION ./modules/)
+ else()
+ set(opentrack-hier-pfx "libexec/opentrack")
+ set(opentrack-hier-path "/../libexec/opentrack/")
+ set(opentrack-hier-doc "/share/doc/opentrack/")
+ set(opentrack-doc-pfx "./share/doc/opentrack")
+ set(opentrack-doc-src-pfx "./share/doc/opentrack/source-code")
+ set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${opentrack-hier-pfx}")
+ set(opentrack-hier-str ARCHIVE DESTINATION lib/opentrack LIBRARY DESTINATION ${opentrack-hier-pfx} RUNTIME DESTINATION bin)
+ endif()
-set(opentrack-binary-suffix "")
-if(APPLE)
- set(opentrack-binary-suffix ".bin")
-elseif(WIN32)
- set(opentrack-binary-suffix ".exe")
-endif()
+ function(opentrack_escape_string var str)
+ string(REGEX REPLACE "([\$\\\"#])" "\\\\\\1" tmp__ "${str}")
+ set(${var} "${tmp__}" PARENT_SCOPE)
+ endfunction()
+
+ function(opentrack_setup_refresh_install_dir)
+ if((NOT CMAKE_INSTALL_PREFIX STREQUAL "") AND (NOT opentrack-doc-src-pfx STREQUAL ""))
+ opentrack_escape_string(dir "${CMAKE_INSTALL_PREFIX}/${opentrack-doc-src-pfx}/")
+ install(CODE "file(REMOVE_RECURSE \"${dir}\")")
+ endif()
+ endfunction()
+
+ opentrack_setup_refresh_install_dir()
+
+ set(opentrack-contrib-pfx "${opentrack-doc-pfx}/contrib")
+
+ set(opentrack-binary-suffix "")
+ if(APPLE)
+ set(opentrack-binary-suffix ".bin")
+ elseif(WIN32)
+ set(opentrack-binary-suffix ".exe")
+ endif()
+
+endif() # include guard
diff --git a/cmake/opentrack-install.cmake b/cmake/opentrack-install.cmake index a8ab394c..ec3940fc 100644 --- a/cmake/opentrack-install.cmake +++ b/cmake/opentrack-install.cmake @@ -1,5 +1,3 @@ -include(opentrack-hier) - set(opentrack-perms PERMISSIONS WORLD_READ WORLD_EXECUTE OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE) if(WIN32) diff --git a/cmake/opentrack-rift.cmake b/cmake/opentrack-rift.cmake index ce2d8554..d4f8e8e1 100644 --- a/cmake/opentrack-rift.cmake +++ b/cmake/opentrack-rift.cmake @@ -1,32 +1,35 @@ -function(opentrack_rift_boilerplate proj opt) - if(${opt}) - set(link-flags) - set(c-flags) - if(APPLE) - set(link-flags "-framework CoreFoundation -framework CoreGraphics -framework IOKit -framework Quartz") - set(c-flags "-fno-strict-aliasing") - elseif(NOT MSVC) - set(c-flags "-fno-strict-aliasing") +if(NOT opentrack-rift-included) + set(opentrack-rift-included TRUE) + function(opentrack_rift_boilerplate proj opt) + if(${opt}) + set(link-flags) + set(c-flags) + if(APPLE) + set(link-flags "-framework CoreFoundation -framework CoreGraphics -framework IOKit -framework Quartz") + set(c-flags "-fno-strict-aliasing") + elseif(NOT MSVC) + set(c-flags "-fno-strict-aliasing") + endif() + opentrack_boilerplate(${proj} LINK ${link-flags} COMPILE ${c-flags}) + set(proj ${proj}) + target_include_directories(${proj} SYSTEM PUBLIC ${${opt}}/Include ${${opt}}/Src) + set(c-flags) + set(link-flags) + if(MSVC) + set(ext lib) + set(p) + else() + set(ext a) + set(p lib) + endif() + target_link_libraries(${proj} ${${opt}}/libLibOVR.${ext}) + if(WIN32) + target_link_libraries(${proj} winmm setupapi ws2_32 imagehlp wbemuuid) + set(ext) + set(p) + elseif(NOT APPLE) + target_link_libraries(${proj} udev Xinerama) + endif() endif() - opentrack_boilerplate(${proj} LINK ${link-flags} COMPILE ${c-flags}) - set(proj ${proj}) - target_include_directories(${proj} SYSTEM PUBLIC ${${opt}}/Include ${${opt}}/Src) - set(c-flags) - set(link-flags) - if(MSVC) - set(ext lib) - set(p) - else() - set(ext a) - set(p lib) - endif() - target_link_libraries(${proj} ${${opt}}/libLibOVR.${ext}) - if(WIN32) - target_link_libraries(${proj} winmm setupapi ws2_32 imagehlp wbemuuid) - set(ext) - set(p) - elseif(NOT APPLE) - target_link_libraries(${proj} udev Xinerama) - endif() - endif() -endfunction() + endfunction() +endif() diff --git a/proto-wine/CMakeLists.txt b/proto-wine/CMakeLists.txt index 3d1a4972..e2576061 100644 --- a/proto-wine/CMakeLists.txt +++ b/proto-wine/CMakeLists.txt @@ -10,6 +10,7 @@ if(NOT WIN32) set(my-rt) endif() file(GLOB wine-deps ${PROJECT_SOURCE_DIR}/*.cxx) + install(FILES ${wine-deps} DESTINATION "${opentrack-doc-src-pfx}/proto-wine") add_custom_command( OUTPUT opentrack-wrapper-wine.exe.so DEPENDS ${wine-deps} diff --git a/tracker-rift-025/CMakeLists.txt b/tracker-rift-025/CMakeLists.txt index 7891ad4d..ee9ff8aa 100644 --- a/tracker-rift-025/CMakeLists.txt +++ b/tracker-rift-025/CMakeLists.txt @@ -1,3 +1,4 @@ include(opentrack-rift) opentrack_rift_boilerplate(opentrack-tracker-rift-025 SDK_RIFT_025) SET(SDK_RIFT_025 "" CACHE PATH "libOVR 0.2.5 path for Oculus Rift") + diff --git a/x-plane-plugin/CMakeLists.txt b/x-plane-plugin/CMakeLists.txt index 21b6947b..616f60ee 100644 --- a/x-plane-plugin/CMakeLists.txt +++ b/x-plane-plugin/CMakeLists.txt @@ -5,6 +5,7 @@ if(LINUX OR APPLE) if(SDK_XPLANE) # probably librt already included add_library(opentrack-xplane-plugin SHARED ${opentrack-xplane-plugin-c}) + install(FILES ${opentrack-xplane-plugin-c} DESTINATION "${opentrack-doc-src-pfx}/opentrack-xplane-plugin") target_include_directories(opentrack-xplane-plugin SYSTEM PUBLIC ${SDK_XPLANE}/CHeaders ${SDK_XPLANE}/CHeaders/XPLM) set(vis "-fvisibility=hidden") if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE) |