diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 79 |
1 files changed, 46 insertions, 33 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c82b5e50..cd744a8f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,19 @@ if(GIT_FOUND) git_describe(OPENTRACK__COMMIT --tags --always) endif() +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + set(CMAKE_COMPILER_IS_GNUCC TRUE) + set(CMAKE_COMPILER_IS_GNUCXX TRUE) +endif() + +if(CMAKE_COMPILER_IS_GNUCXX) + if(MINGW32) + set(version-script mingw) + else() + set(version-script posix) + endif() +endif() + if(APPLE) set(apple-frameworks "-stdlib=libc++ -framework Cocoa -framework CoreFoundation -lobjc -lz -framework Carbon") set(CMAKE_SHARED_LINKER_FLAGS " ${apple-frameworks} ${CMAKE_SHARED_LINKER_FLAGS}") @@ -389,24 +402,24 @@ target_link_libraries(opentrack-spline-widget ${MY_QT_LIBS}) add_library(opentrack-filter-accela SHARED ${opentrack-filter-accela-c} ${opentrack-filter-accela-h} ${opentrack-filter-accela-moc} ${opentrack-filter-accela-uih} ${opentrack-filter-accela-rcc}) target_link_libraries(opentrack-filter-accela ${MY_QT_LIBS}) -if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32) +if(CMAKE_COMPILER_IS_GNUCXX) SET_TARGET_PROPERTIES(opentrack-filter-accela - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt") + PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/${version-script}-version-script.txt") endif() add_library(opentrack-filter-ewma SHARED ${opentrack-filter-ewma-uih} ${opentrack-filter-ewma-c} ${opentrack-filter-ewma-h} ${opentrack-filter-ewma-moc} ${opentrack-filter-ewma-rcc}) target_link_libraries(opentrack-filter-ewma ${MY_QT_LIBS}) -if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32) +if(CMAKE_COMPILER_IS_GNUCXX) SET_TARGET_PROPERTIES(opentrack-filter-ewma - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt") + PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/${version-script}-version-script.txt") endif() add_library(opentrack-proto-fgfs SHARED ${opentrack-proto-fgfs-c} ${opentrack-proto-fgfs-h} ${opentrack-proto-fgfs-moc} ${opentrack-proto-fgfs-uih} ${opentrack-proto-fgfs-rcc}) target_link_libraries(opentrack-proto-fgfs ${MY_QT_LIBS}) -if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32) +if(CMAKE_COMPILER_IS_GNUCXX) SET_TARGET_PROPERTIES(opentrack-proto-fgfs - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt") + PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/${version-script}-version-script.txt") endif() if(WIN32 AND SDK_VJOY) @@ -417,18 +430,18 @@ if(WIN32 AND SDK_VJOY) else() target_link_libraries(opentrack-proto-vjoy ${MY_QT_LIBS} "${SDK_VJOY}/VJoy.dll") endif() - if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32) + if(CMAKE_COMPILER_IS_GNUCXX) SET_TARGET_PROPERTIES(opentrack-proto-vjoy - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt -Wl,--enable-stdcall-fixup") + PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/${version-script}-version-script.txt -Wl,--enable-stdcall-fixup") endif() endif() if(UNIX AND SDK_ENABLE_LIBEVDEV) add_library(opentrack-proto-libevdev SHARED ${opentrack-proto-libevdev-c} ${opentrack-proto-libevdev-h} ${opentrack-proto-libevdev-moc} ${opentrack-proto-libevdev-uih} ${opentrack-proto-libevdev-rcc}) target_link_libraries(opentrack-proto-libevdev ${MY_QT_LIBS} evdev) - if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32) + if(CMAKE_COMPILER_IS_GNUCXX) SET_TARGET_PROPERTIES(opentrack-proto-libevdev - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt") + PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/${version-script}-version-script.txt") endif() install(TARGETS opentrack-proto-libevdev RUNTIME DESTINATION . LIBRARY DESTINATION . ) endif() @@ -466,26 +479,26 @@ endif() add_library(opentrack-proto-udp SHARED ${opentrack-proto-udp-c} ${opentrack-proto-udp-h} ${opentrack-proto-udp-moc} ${opentrack-proto-udp-uih} ${opentrack-proto-udp-rcc}) target_link_libraries(opentrack-proto-udp ${MY_QT_LIBS}) -if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32) +if(CMAKE_COMPILER_IS_GNUCXX) SET_TARGET_PROPERTIES(opentrack-proto-udp - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt") + PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/${version-script}-version-script.txt") endif() if(WIN32) add_library(opentrack-tracker-joystick SHARED ${opentrack-tracker-joystick-c} ${opentrack-tracker-joystick-h} ${opentrack-tracker-joystick-moc} ${opentrack-tracker-joystick-uih} ${opentrack-tracker-joystick-rcc}) target_link_libraries(opentrack-tracker-joystick ${MY_QT_LIBS}) - if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32) + if(CMAKE_COMPILER_IS_GNUCXX) SET_TARGET_PROPERTIES(opentrack-tracker-joystick - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt") + PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/${version-script}-version-script.txt") endif() endif() if(NOT WIN32 AND SDK_WINE_PREFIX) add_library(opentrack-proto-wine SHARED ${opentrack-proto-wine-c} ${opentrack-proto-wine-h} ${opentrack-proto-wine-moc} ${opentrack-proto-wine-uih} ${opentrack-proto-wine-rcc}) target_link_libraries(opentrack-proto-wine ${MY_QT_LIBS} opentrack-compat opentrack-csv) - if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32) + if(CMAKE_COMPILER_IS_GNUCXX) SET_TARGET_PROPERTIES(opentrack-proto-wine - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt") + PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/${version-script}-version-script.txt") endif() if(NOT SDK_WINE_NO_WRAPPER) set(my-rt -lrt) @@ -508,34 +521,34 @@ if(NOT WIN32 AND SDK_WINE_PREFIX) endif() endif() -if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32) +if(CMAKE_COMPILER_IS_GNUCXX) SET_TARGET_PROPERTIES(opentrack-proto-fgfs - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt") + PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/${version-script}-version-script.txt") endif() add_library(opentrack-tracker-ht SHARED ${opentrack-tracker-ht-c} ${opentrack-tracker-ht-h} ${opentrack-tracker-ht-moc} ${opentrack-tracker-ht-uih} ${opentrack-tracker-ht-rcc}) target_link_libraries(opentrack-tracker-ht ${MY_QT_LIBS} opentrack-compat) -if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32) +if(CMAKE_COMPILER_IS_GNUCXX) SET_TARGET_PROPERTIES(opentrack-tracker-ht - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt") + PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/${version-script}-version-script.txt") endif() if(SDK_ARUCO_LIBPATH) include_directories(${CMAKE_SOURCE_DIR}/ftnoir_tracker_aruco/include) add_library(opentrack-tracker-aruco SHARED ${opentrack-tracker-aruco-c} ${opentrack-tracker-aruco-h} ${opentrack-tracker-aruco-moc} ${opentrack-tracker-aruco-uih} ${opentrack-tracker-aruco-rcc}) target_link_libraries(opentrack-tracker-aruco ${MY_QT_LIBS} ${SDK_ARUCO_LIBPATH} ${OpenCV_LIBS}) - if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32) + if(CMAKE_COMPILER_IS_GNUCXX) SET_TARGET_PROPERTIES(opentrack-tracker-aruco - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt") + PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/${version-script}-version-script.txt") endif() endif() add_library(opentrack-tracker-hatire SHARED ${opentrack-tracker-hatire-c} ${opentrack-tracker-hatire-h} ${opentrack-tracker-hatire-moc} ${opentrack-tracker-hatire-uih} ${opentrack-tracker-hatire-rcc}) target_link_libraries(opentrack-tracker-hatire ${MY_QT_LIBS}) install(TARGETS opentrack-tracker-hatire RUNTIME DESTINATION . LIBRARY DESTINATION . ) -if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32) +if(CMAKE_COMPILER_IS_GNUCXX) SET_TARGET_PROPERTIES(opentrack-tracker-hatire - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt") + PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/${version-script}-version-script.txt") endif() if(WIN32) @@ -557,9 +570,9 @@ if(APPLE) SET_TARGET_PROPERTIES(opentrack-tracker-pt PROPERTIES COMPILE_FLAGS "-std=c++11") endif() -if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32) +if(CMAKE_COMPILER_IS_GNUCXX) SET_TARGET_PROPERTIES(opentrack-tracker-pt - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt") + PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/${version-script}-version-script.txt") endif() @@ -572,9 +585,9 @@ endif() add_library(opentrack-tracker-udp SHARED ${opentrack-tracker-udp-c} ${opentrack-tracker-udp-h} ${opentrack-tracker-udp-moc} ${opentrack-tracker-udp-uih} ${opentrack-tracker-udp-rcc}) target_link_libraries(opentrack-tracker-udp ${MY_QT_LIBS}) -if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32) +if(CMAKE_COMPILER_IS_GNUCXX) SET_TARGET_PROPERTIES(opentrack-tracker-udp - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt") + PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/${version-script}-version-script.txt") endif() if(SDK_RIFT) @@ -588,17 +601,17 @@ if(SDK_RIFT) if(WIN32) target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/libLibOVR.a" winmm.lib setupapi.lib) else() - if (NOT APPLE) + if(NOT APPLE) target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/libLibOVR.a" udev Xinerama) else() target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/libLibOVR.a") endif() endif() endif() - if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32) + if(CMAKE_COMPILER_IS_GNUCXX) SET_TARGET_PROPERTIES(opentrack-tracker-rift PROPERTIES - LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt" + LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/${version-script}-version-script.txt" COMPILE_FLAGS "-fno-strict-aliasing" ) endif() @@ -640,9 +653,9 @@ if(SDK_HYDRA) ) target_link_libraries(opentrack-tracker-hydra "${SDK_HYDRA}/lib/${sixense-plat}${underscore-sixtyfour}/release${underscore-dll}/libsixense${underscore-sixtyfour}.${soext}" "${SDK_HYDRA}/lib/${sixense-plat}${underscore-sixtyfour}/release${underscore-dll}/libsixense_utils${underscore-sixtyfour}.${soext}") endif() - if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32) + if(CMAKE_COMPILER_IS_GNUCXX) SET_TARGET_PROPERTIES(opentrack-tracker-hydra - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt") + PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/${version-script}-version-script.txt") endif() endif() |