diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-07-07 11:40:57 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-07-07 11:40:57 +0200 |
commit | 74034c5bc3447cf628d13ca692beec7ffc0ce4cd (patch) | |
tree | 7ce191ecf80e7f86118eefb227d9b89391975244 | |
parent | 7a3569f80051d48ac427849c30b2f5685b368b71 (diff) |
cmake: check word size
-rwxr-xr-x | CMakeLists.txt | 2 | ||||
-rw-r--r-- | cmake/opentrack-word-size.cmake | 12 | ||||
-rw-r--r-- | tracker-hydra/CMakeLists.txt | 17 |
3 files changed, 20 insertions, 11 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 9a6eb704..139cb001 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,8 @@ project(opentrack C CXX) cmake_minimum_required(VERSION 2.8.11) include(CMakeParseArguments) +include(opentrack-word-size) +include(opentrack-hier) include(opentrack-policy) include(opentrack-qt) include(opentrack-platform) diff --git a/cmake/opentrack-word-size.cmake b/cmake/opentrack-word-size.cmake new file mode 100644 index 00000000..c670ed59 --- /dev/null +++ b/cmake/opentrack-word-size.cmake @@ -0,0 +1,12 @@ +include(CheckTypeSize)
+check_type_size(void* opentrack-word-size BUILTIN_TYPES_ONLY LANGUAGE C)
+message(STATUS "detected word size is ${opentrack-word-size}")
+if(opentrack-word-size LESS 4)
+ message(FATAL_ERROR "word size either misdetected or really less than 4")
+endif()
+set(opentrack-word-size ${opentrack-word-size})
+if(opentrack-word-size EQUAL 8)
+ set(opentrack-64bit TRUE)
+else()
+ set(opentrack-64bit FALSE)
+endif()
diff --git a/tracker-hydra/CMakeLists.txt b/tracker-hydra/CMakeLists.txt index 85d9177f..13613625 100644 --- a/tracker-hydra/CMakeLists.txt +++ b/tracker-hydra/CMakeLists.txt @@ -1,9 +1,12 @@ -SET(SDK_HYDRA "" CACHE PATH "libSixense path for Razer Hydra") +set(SDK_HYDRA "" CACHE PATH "libSixense path for Razer Hydra") if(SDK_HYDRA) - include(opentrack-hier) opentrack_boilerplate(opentrack-tracker-hydra) target_include_directories(opentrack-tracker-hydra SYSTEM PUBLIC ${SDK_HYDRA}/include ${SDK_HYDRA}/include/sixense_utils) - set(six4 "") + if(opentrack-64bit) + set(six4 _x64) + else() + set(six4 "") + endif() if(WIN32) if(MSVC) set(dir lib) @@ -22,19 +25,11 @@ if(SDK_HYDRA) set(under-dll _dll) set(soext dylib) set(plat osx) - set(six4 _x64) else() set(dest ${opentrack-hier-pfx}) set(under-dll) set(soext so) set(plat linux) - if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR - CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64" - ) - set(six4 _x64) - else() - set(six4) - endif() endif() target_link_libraries(opentrack-tracker-hydra "${SDK_HYDRA}/lib/${plat}${six4}/release${under-dll}/libsixense${six4}.${soext}") install(FILES "${SDK_HYDRA}/lib/${plat}${six4}/release${under-dll}/libsixense${six4}.${soext}" DESTINATION ${opentrack-hier-pfx} ${opentrack-perms}) |