diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 75 |
1 files changed, 46 insertions, 29 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index b483000d..8674e907 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC OFF) set(CMAKE_POSITION_INDEPENDENT_CODE ON) -find_package(OpenCV 3.0) +find_package(OpenCV 3.0 REQUIRED) find_package(Qt5 REQUIRED COMPONENTS Core Xml Network Widgets Gui QUIET) find_package(Qt5 COMPONENTS SerialPort QUIET) @@ -102,18 +102,26 @@ function(opentrack_compat target) endfunction() macro(opentrack_library n dir) - cmake_parse_arguments(foolib "" "LINK;COMPILE;GNU-LINK;GNU-COMPILE" "" ${ARGN}) + cmake_parse_arguments(foolib "" "LINK;COMPILE;GNU-LINK;GNU-COMPILE;STATIC" "" ${ARGN}) if(NOT " ${foolib_UNPARSED_ARGUMENTS}" STREQUAL " ") message(FATAL_ERROR "opentrack_library bad formals") endif() opentrack_module(${n} ${dir}) opentrack_qt(${n}) - add_library(${n} SHARED ${${n}-all}) + set(link-mode SHARED) + if (foolib_STATIC) + set(link-mode STATIC) + endif() + add_library(${n} ${link-mode} ${${n}-all}) target_link_libraries(${n} ${MY_QT_LIBS}) if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE) + set(visibility "-fvisibility=hidden -fvisibility-inlines-hidden") + if (foolib_STATIC) + set(visibility) + endif() SET_TARGET_PROPERTIES(${n} PROPERTIES LINK_FLAGS "${foolib_LINK} ${foolib_GNU-LINK} -Wl,--version-script=\"${CMAKE_SOURCE_DIR}/opentrack/${version-script}-version-script.txt\"" - COMPILE_FLAGS "${foolib_COMPILE} ${foolib_GNU-COMPILE} -fvisibility=hidden -fvisibility-inlines-hidden" + COMPILE_FLAGS "${foolib_COMPILE} ${foolib_GNU-COMPILE} ${visibility}" ) else() set(link-flags) @@ -122,7 +130,9 @@ macro(opentrack_library n dir) endif() set_target_properties(${n} PROPERTIES LINK_FLAGS "${link-flags} ${foolib_LINK}" COMPILE_FLAGS "${foolib_COMPILE}") endif() - install(TARGETS ${n} RUNTIME DESTINATION . LIBRARY DESTINATION .) + if (NOT foolib_STATIC) + install(TARGETS ${n} RUNTIME DESTINATION . LIBRARY DESTINATION .) + endif() endmacro() function(link_with_dinput8 n) @@ -271,10 +281,9 @@ set_target_properties(opentrack-version PROPERTIES COMPILE_DEFINITIONS "OPENTRACK_VERSION=\"${OPENTRACK__COMMIT}\"") -opentrack_library(opentrack-filter-accela ftnoir_filter_accela) +opentrack_library(opentrack-filter-accela ftnoir_filter_accela STATIC TRUE) target_link_libraries(opentrack-filter-accela opentrack-spline-widget) -opentrack_library(opentrack-filter-kalman ftnoir_filter_kalman) -opentrack_library(opentrack-filter-ewma ftnoir_filter_ewma2) +#opentrack_library(opentrack-filter-ewma ftnoir_filter_ewma2) opentrack_library(opentrack-proto-fgfs ftnoir_protocol_fg) @@ -320,16 +329,16 @@ endif() opentrack_library(opentrack-proto-udp ftnoir_protocol_ftn) if(WIN32) - opentrack_library(opentrack-tracker-joystick ftnoir_tracker_joystick) + #opentrack_library(opentrack-tracker-joystick ftnoir_tracker_joystick) endif() -if(Qt5SerialPort_FOUND) +if(Qt5SerialPort_FOUND AND FALSE) opentrack_library(opentrack-tracker-hatire ftnoir_tracker_hatire) target_link_libraries(opentrack-tracker-hatire ${Qt5SerialPort_LIBRARIES}) target_include_directories(opentrack-tracker-hatire SYSTEM PUBLIC ${Qt5SerialPort_INCLUDE_DIRS}) endif() -if(SDK_WINE_PREFIX) +if(SDK_WINE_PREFIX AND FALSE) opentrack_library(opentrack-proto-wine ftnoir_protocol_wine) target_link_libraries(opentrack-proto-wine opentrack-compat opentrack-csv) if(NOT SDK_WINE_NO_WRAPPER) @@ -353,36 +362,40 @@ if(SDK_WINE_PREFIX) endif() endif() -opentrack_library(opentrack-tracker-udp ftnoir_tracker_udp) -opentrack_library(opentrack-tracker-freepie-udp ftnoir_tracker_freepie-udp) +#opentrack_library(opentrack-tracker-udp ftnoir_tracker_udp) +#opentrack_library(opentrack-tracker-freepie-udp ftnoir_tracker_freepie-udp) if(OpenCV_FOUND) - opentrack_library(opentrack-tracker-pt ftnoir_tracker_pt) + opentrack_library(opentrack-tracker-pt ftnoir_tracker_pt STATIC YES) target_link_libraries(opentrack-tracker-pt ${OpenCV_LIBS}) target_include_directories(opentrack-tracker-pt SYSTEM PUBLIC ${OpenCV_INCLUDE_DIRS}) link_with_dinput8(opentrack-tracker-pt) if(SDK_ARUCO_LIBPATH) - opentrack_library(opentrack-tracker-aruco ftnoir_tracker_aruco) - target_link_libraries(opentrack-tracker-aruco ${SDK_ARUCO_LIBPATH} ${OpenCV_LIBS}) - target_include_directories(opentrack-tracker-aruco SYSTEM PUBLIC ${OpenCV_INCLUDE_DIRS}) + #opentrack_library(opentrack-tracker-aruco ftnoir_tracker_aruco) + #target_link_libraries(opentrack-tracker-aruco ${SDK_ARUCO_LIBPATH} ${OpenCV_LIBS}) + #target_include_directories(opentrack-tracker-aruco SYSTEM PUBLIC ${OpenCV_INCLUDE_DIRS}) endif() - target_link_libraries(opentrack-filter-kalman ${OpenCV_LIBS}) - target_include_directories(opentrack-filter-kalman SYSTEM PUBLIC ${OpenCV_INCLUDE_DIRS}) +#target_link_libraries(opentrack-filter-kalman ${OpenCV_LIBS}) +#target_include_directories(opentrack-filter-kalman SYSTEM PUBLIC ${OpenCV_INCLUDE_DIRS}) - if(SDK_HT AND SDK_HT_FLANDMARK) - opentrack_library(opentrack-tracker-ht ftnoir_tracker_ht) - target_link_libraries(opentrack-tracker-ht opentrack-compat ${SDK_HT} ${SDK_HT_FLANDMARK}) - link_with_dinput8(opentrack-tracker-ht) - target_link_libraries(opentrack-tracker-ht ${OpenCV_LIBS}) - target_include_directories(opentrack-tracker-ht SYSTEM PUBLIC ${OpenCV_INCLUDE_DIRS}) - endif() +#if(SDK_HT AND SDK_HT_FLANDMARK) +#opentrack_library(opentrack-tracker-ht ftnoir_tracker_ht) +#target_link_libraries(opentrack-tracker-ht opentrack-compat ${SDK_HT} ${SDK_HT_FLANDMARK}) +#link_with_dinput8(opentrack-tracker-ht) +#target_link_libraries(opentrack-tracker-ht ${OpenCV_LIBS}) +#target_include_directories(opentrack-tracker-ht SYSTEM PUBLIC ${OpenCV_INCLUDE_DIRS}) +#endif() endif() -link_with_dinput8(opentrack-tracker-joystick) +#opentrack_library(opentrack-tracker-ht ftnoir_tracker_ht) +#target_link_libraries(opentrack-tracker-ht opentrack-compat) +#link_with_dinput8(opentrack-tracker-ht) + +#link_with_dinput8(opentrack-tracker-joystick) -if(SDK_RIFT) +if(SDK_RIFT AND FALSE) set(link-flags) set(c-flags) if(APPLE) @@ -413,7 +426,7 @@ if(SDK_RIFT) endif() endif() -if(SDK_HYDRA) +if(SDK_HYDRA AND FALSE) opentrack_library(opentrack-tracker-hydra ftnoir_tracker_hydra) target_include_directories(opentrack-tracker-hydra SYSTEM PUBLIC ${SDK_HYDRA}/include ${SDK_HYDRA}/include/sixense_utils) if(WIN32) @@ -482,11 +495,13 @@ else() endif() opentrack_module(opentrack facetracknoir) + if(UNIX OR APPLE) list(APPEND opentrack-c qxt-mini/qxtglobalshortcut.h) endif() opentrack_qt(opentrack) add_executable(opentrack ${opentrack-win32-executable} ${opentrack-all}) +target_link_libraries(opentrack opentrack-filter-accela opentrack-tracker-pt) opentrack_compat(opentrack) if(NOT WIN32) set_target_properties(opentrack PROPERTIES SUFFIX ".bin") @@ -500,6 +515,8 @@ endif() if(UNIX OR APPLE) target_link_libraries(opentrack opentrack-qxt-mini) endif() +target_include_directories(opentrack SYSTEM PUBLIC ${OpenCV_INCLUDE_DIRS}) +target_link_libraries(opentrack ${OpenCV_LIBS}) link_with_dinput8(opentrack) target_link_libraries(opentrack ${MY_QT_LIBS}) |