From 74034c5bc3447cf628d13ca692beec7ffc0ce4cd Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 7 Jul 2016 11:40:57 +0200 Subject: cmake: check word size --- CMakeLists.txt | 2 ++ cmake/opentrack-word-size.cmake | 12 ++++++++++++ tracker-hydra/CMakeLists.txt | 17 ++++++----------- 3 files changed, 20 insertions(+), 11 deletions(-) create mode 100644 cmake/opentrack-word-size.cmake 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}) -- cgit v1.2.3