diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 626 |
1 files changed, 193 insertions, 433 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e9ade02..776473b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,8 @@ project(opentrack) cmake_minimum_required(VERSION 2.8) +include(CMakeParseArguments) + set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_SOURCE_DIR}/cmake/") include(GetGitRevisionDescription) find_package(Git QUIET) @@ -8,6 +10,8 @@ if(GIT_FOUND) git_describe(OPENTRACK__COMMIT --tags --always) endif() +include_directories(${CMAKE_SOURCE_DIR}) + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") set(CMAKE_COMPILER_IS_GNUCC TRUE) set(CMAKE_COMPILER_IS_GNUCXX TRUE) @@ -110,54 +114,54 @@ if(MINGW) set(Qt5Gui_gdi32_LIBRARY ${SDK_MINGW_PREFIX}/mingw/lib/libgdi32.a) endif() - find_package(OpenCV REQUIRED) - set(maybe-serial-port) - if(SDK_HATIRE) - set(maybe-serial-port SerialPort) - endif() +find_package(OpenCV REQUIRED) +set(maybe-serial-port) +if(SDK_HATIRE) + set(maybe-serial-port SerialPort) +endif() - find_package(Qt5 REQUIRED COMPONENTS Core Xml Network Widgets Gui ${maybe-serial-port} QUIET) - cmake_policy(SET CMP0020 NEW) - include_directories(${Qt5Core_INCLUDE_DIRS} ${Qt5Xml_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS}) - add_definitions(${Qt5Core_DEFINITIONS} ${Qt5Xml_DEFINITIONS} ${Qt5Gui_DEFINITIONS} ${Qt5Widgets_DEFINITIONS} ${Qt5Network_DEFINITIONS}) +find_package(Qt5 REQUIRED COMPONENTS Core Xml Network Widgets Gui ${maybe-serial-port} QUIET) +cmake_policy(SET CMP0020 NEW) +include_directories(${Qt5Core_INCLUDE_DIRS} ${Qt5Xml_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS}) +add_definitions(${Qt5Core_DEFINITIONS} ${Qt5Xml_DEFINITIONS} ${Qt5Gui_DEFINITIONS} ${Qt5Widgets_DEFINITIONS} ${Qt5Network_DEFINITIONS}) - INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) - INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/qfunctionconfigurator) - INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/ftnoir_posewidget) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/qfunctionconfigurator) +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/ftnoir_posewidget) - set(SDK_ARUCO_LIBPATH "" CACHE FILEPATH "Path to Aruco static library") +set(SDK_ARUCO_LIBPATH "" CACHE FILEPATH "Path to Aruco static library") - SET(SDK_OPENCV_STATIC FALSE CACHE BOOL "Whether OpenCV is statically linked") - if(WIN32) - set(SDK_SIMCONNECT "" CACHE PATH "Path to SimConnect SDK") - set(SDK_DIRECTX "" CACHE PATH "Path to DirectX SDK") - set(SDK_FSUIPC "" CACHE PATH "Path to FSUIPC") - if(SDK_DIRECTX) - include_directories("${SDK_DIRECTX}/Include") - link_directories("${SDK_DIRECTX}/Lib") - endif() +SET(SDK_OPENCV_STATIC FALSE CACHE BOOL "Whether OpenCV is statically linked") +if(WIN32) + set(SDK_SIMCONNECT "" CACHE PATH "Path to SimConnect SDK") + set(SDK_DIRECTX "" CACHE PATH "Path to DirectX SDK") + set(SDK_FSUIPC "" CACHE PATH "Path to FSUIPC") + if(SDK_DIRECTX) + include_directories("${SDK_DIRECTX}/Include") + link_directories("${SDK_DIRECTX}/Lib") endif() +endif() - if(NOT WIN32) - set(SDK_WINE_PREFIX "" CACHE PATH "Path where Wine is installed") - set(SDK_WINE_NO_WRAPPER FALSE CACHE BOOL "Don't build wrapper, for instance X-Plane is native Linux app") - endif() - IF("${CMAKE_SYSTEM}" MATCHES "Linux" OR APPLE) - set(SDK_XPLANE "" CACHE PATH "Path to X-Plane SDK") - endif() +if(NOT WIN32) + set(SDK_WINE_PREFIX "" CACHE PATH "Path where Wine is installed") + set(SDK_WINE_NO_WRAPPER FALSE CACHE BOOL "Don't build wrapper, for instance X-Plane is native Linux app") +endif() +IF("${CMAKE_SYSTEM}" MATCHES "Linux" OR APPLE) + set(SDK_XPLANE "" CACHE PATH "Path to X-Plane SDK") +endif() - if(SDK_XPLANE) - INCLUDE_DIRECTORIES("${SDK_XPLANE}/CHeaders" "${SDK_XPLANE}/CHeaders/XPLM") - endif() +if(SDK_XPLANE) + INCLUDE_DIRECTORIES("${SDK_XPLANE}/CHeaders" "${SDK_XPLANE}/CHeaders/XPLM") +endif() - if(WIN32) - if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) - set(CMAKE_RC_COMPILER_INIT i686-w64-mingw32-windres) - SET(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>") - endif() - ENABLE_LANGUAGE(RC) - endif(WIN32) +if(WIN32) + if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) + set(CMAKE_RC_COMPILER_INIT i686-w64-mingw32-windres) + SET(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>") + endif() + ENABLE_LANGUAGE(RC) +endif(WIN32) if(SDK_FSUIPC AND WIN32) include_directories("${SDK_FSUIPC}") @@ -174,177 +178,90 @@ else() include_directories("qxt-mini/") endif() endif() -# main app - -file(GLOB opentrack-lib-c "opentrack-api/*.cpp" "facetracknoir/global-settings.cpp") -file(GLOB opentrack-lib-h "opentrack-api/*.h" "facetracknoir/global-settings.h") -file(GLOB opentrack-bin-c "facetracknoir/*.cpp" "facetracknoir/*.rc") -file(GLOB opentrack-bin-h "facetracknoir/*.h") -file(GLOB opentrack-bin-ui "facetracknoir/*.ui") -file(GLOB opentrack-bin-rc "facetracknoir/*.qrc") -QT5_WRAP_UI(opentrack-bin-uih ${opentrack-bin-ui}) -QT5_ADD_RESOURCES(opentrack-bin-rcc ${opentrack-bin-rc}) +# qt being broken as usual +set(EXTRA-MOCS "${CMAKE_SOURCE_DIR}/facetracknoir/options.h") + +function(link_with_dinput8 n) + if(WIN32) + if(MSVC) + target_link_libraries(${n} + "${CMAKE_SOURCE_DIR}/dinput/dinput8.lib" + "${CMAKE_SOURCE_DIR}/dinput/dxguid.lib" + "${CMAKE_SOURCE_DIR}/dinput/strmiids.lib" + uuid) + else() + target_link_libraries(${n} dinput8 dxguid strmiids) + endif() + endif() +endfunction() + +macro(opentrack_module n dir) + file(GLOB ${n}-c "${dir}/*.cpp" "${dir}/*.h" "${dir}/*.rc" ${EXTRA-MOCS}) + file(GLOB ${n}-ui "${dir}/*.ui") + file(GLOB ${n}-rc "${dir}/*.qrc") + QT5_WRAP_UI(${n}-uih ${${n}-ui}) + QT5_ADD_RESOURCES(${n}-rcc ${${n}-rc}) +endmacro() + +macro(opentrack_library n) + cmake_parse_arguments(foolib "" "LINK;COMPILE" "" ${ARGN}) + if(NOT " ${foolib_UNPARSED_ARGUMENTS}" STREQUAL " ") + message(FATAL_ERROR "opentrack_library bad formals") + endif() + add_library(${n} SHARED ${${n}-c} ${${n}-uih} ${${n}-rcc}) + target_link_libraries(${n} ${MY_QT_LIBS}) + if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE) + SET_TARGET_PROPERTIES(${n} PROPERTIES + LINK_FLAGS "${foolib_LINK} -Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/${version-script}-version-script.txt" + COMPILE_FLAGS "${foolib_COMPILE}" + ) + else() + set_target_properties(${n} PROPERTIES LINK_FLAGS "${foolib_LINK}" COMPILE_FLAGS "${foolib_COMPILE}") + endif() + install(TARGETS ${n} RUNTIME DESTINATION . LIBRARY DESTINATION .) +endmacro() -file(GLOB opentrack-pose-widget-c "ftnoir_posewidget/*.cpp") -file(GLOB opentrack-pose-widget-h "ftnoir_posewidget/*.h") -file(GLOB opentrack-pose-widget-rc "ftnoir_posewidget/*.qrc") -QT5_ADD_RESOURCES(opentrack-pose-widget-rcc ${opentrack-pose-widget-rc}) +file(GLOB opentrack-lib-c "opentrack-api/*.cpp" "facetracknoir/global-settings.cpp" "opentrack-api/*.h" "facetracknoir/global-settings.h") -file(GLOB opentrack-spline-widget-c "qfunctionconfigurator/*.cpp") -file(GLOB opentrack-spline-widget-h "qfunctionconfigurator/*.h") +opentrack_module(opentrack-bin facetracknoir) +opentrack_module(opentrack-pose-widget ftnoir_posewidget) +opentrack_module(opentrack-spline-widget qfunctionconfigurator) # filters -file(GLOB opentrack-filter-accela-c "ftnoir_filter_accela/*.cpp") -file(GLOB opentrack-filter-accela-h "ftnoir_filter_accela/*.h") -file(GLOB opentrack-filter-accela-ui "ftnoir_filter_accela/*.ui") -file(GLOB opentrack-filter-accela-rc "ftnoir_filter_accela/*.qrc") -QT5_WRAP_UI(opentrack-filter-accela-uih ${opentrack-filter-accela-ui}) -QT5_ADD_RESOURCES(opentrack-filter-accela-rcc ${opentrack-filter-accela-rc}) - -file(GLOB opentrack-filter-kalman-c "ftnoir_filter_kalman/*.cpp") -file(GLOB opentrack-filter-kalman-h "ftnoir_filter_kalman/*.h") -file(GLOB opentrack-filter-kalman-ui "ftnoir_filter_kalman/*.ui") -file(GLOB opentrack-filter-kalman-rc "ftnoir_filter_kalman/*.qrc") -QT5_WRAP_UI(opentrack-filter-kalman-uih ${opentrack-filter-kalman-ui}) -QT5_ADD_RESOURCES(opentrack-filter-kalman-rcc ${opentrack-filter-kalman-rc}) - -file(GLOB opentrack-filter-ewma-c "ftnoir_filter_ewma2/*.cpp") -file(GLOB opentrack-filter-ewma-h "ftnoir_filter_ewma2/*.h") -file(GLOB opentrack-filter-ewma-ui "ftnoir_filter_ewma2/*.ui") -file(GLOB opentrack-filter-ewma-rc "ftnoir_filter_ewma2/*.qrc") -QT5_WRAP_UI(opentrack-filter-ewma-uih ${opentrack-filter-ewma-ui}) -QT5_ADD_RESOURCES(opentrack-filter-ewma-rcc ${opentrack-filter-ewma-rc}) +opentrack_module(opentrack-filter-accela ftnoir_filter_accela) +opentrack_module(opentrack-filter-kalman ftnoir_filter_kalman) +opentrack_module(opentrack-filter-ewma ftnoir_filter_ewma2) # protocols -file(GLOB opentrack-proto-fgfs-c "ftnoir_protocol_fg/*.cpp") -file(GLOB opentrack-proto-fgfs-h "ftnoir_protocol_fg/*.h") -file(GLOB opentrack-proto-fgfs-ui "ftnoir_protocol_fg/*.ui") -file(GLOB opentrack-proto-fgfs-rc "ftnoir_protocol_fg/*.qrc") -QT5_WRAP_UI(opentrack-proto-fgfs-uih ${opentrack-proto-fgfs-ui}) -QT5_ADD_RESOURCES(opentrack-proto-fgfs-rcc ${opentrack-proto-fgfs-rc}) - -file(GLOB opentrack-proto-fsuipc-c "ftnoir_protocol_fsuipc/*.cpp") -file(GLOB opentrack-proto-fsuipc-h "ftnoir_protocol_fsuipc/*.h") -file(GLOB opentrack-proto-fsuipc-ui "ftnoir_protocol_fsuipc/*.ui") -file(GLOB opentrack-proto-fsuipc-rc "ftnoir_protocol_fsuipc/*.qrc") -QT5_WRAP_UI(opentrack-proto-fsuipc-uih ${opentrack-proto-fsuipc-ui}) -QT5_ADD_RESOURCES(opentrack-proto-fsuipc-rcc ${opentrack-proto-fsuipc-rc}) - -file(GLOB opentrack-proto-freetrack-c "ftnoir_protocol_ft/*.cpp") -file(GLOB opentrack-proto-freetrack-h "ftnoir_protocol_ft/*.h") -file(GLOB opentrack-proto-freetrack-ui "ftnoir_protocol_ft/*.ui") -file(GLOB opentrack-proto-freetrack-rc "ftnoir_protocol_ft/*.qrc") -QT5_WRAP_UI(opentrack-proto-freetrack-uih ${opentrack-proto-freetrack-ui}) -QT5_ADD_RESOURCES(opentrack-proto-freetrack-rcc ${opentrack-proto-freetrack-rc}) - -file(GLOB opentrack-proto-udp-c "ftnoir_protocol_ftn/*.cpp") -file(GLOB opentrack-proto-udp-h "ftnoir_protocol_ftn/*.h") -file(GLOB opentrack-proto-udp-ui "ftnoir_protocol_ftn/*.ui") -file(GLOB opentrack-proto-udp-rc "ftnoir_protocol_ftn/*.qrc") -QT5_WRAP_UI(opentrack-proto-udp-uih ${opentrack-proto-udp-ui}) -QT5_ADD_RESOURCES(opentrack-proto-udp-rcc ${opentrack-proto-udp-rc}) - -file(GLOB opentrack-proto-wine-c "ftnoir_protocol_wine/*.cpp") -file(GLOB opentrack-proto-wine-h "ftnoir_protocol_wine/*.h") -file(GLOB opentrack-proto-wine-ui "ftnoir_protocol_wine/*.ui") -file(GLOB opentrack-proto-wine-rc "ftnoir_protocol_wine/*.qrc") -QT5_WRAP_UI(opentrack-proto-wine-uih ${opentrack-proto-wine-ui}) -QT5_ADD_RESOURCES(opentrack-proto-wine-rcc ${opentrack-proto-wine-rc}) - -file(GLOB opentrack-proto-win32-mouse-c "ftnoir_protocol_mouse/*.cpp") -file(GLOB opentrack-proto-win32-mouse-h "ftnoir_protocol_mouse/*.h") -file(GLOB opentrack-proto-win32-mouse-ui "ftnoir_protocol_mouse/*.ui") -file(GLOB opentrack-proto-win32-mouse-rc "ftnoir_protocol_mouse/*.qrc") -QT5_WRAP_UI(opentrack-proto-win32-mouse-uih ${opentrack-proto-win32-mouse-ui}) -QT5_ADD_RESOURCES(opentrack-proto-win32-mouse-rcc ${opentrack-proto-win32-mouse-rc}) - -file(GLOB opentrack-proto-simconnect-c "ftnoir_protocol_sc/*.cpp" "ftnoir_protocol_sc/ftnoir-protocol-sc.rc") -file(GLOB opentrack-proto-simconnect-h "ftnoir_protocol_sc/*.h") -file(GLOB opentrack-proto-simconnect-ui "ftnoir_protocol_sc/*.ui") -file(GLOB opentrack-proto-simconnect-rc "ftnoir_protocol_sc/*.qrc") -QT5_WRAP_UI(opentrack-proto-simconnect-uih ${opentrack-proto-simconnect-ui}) -QT5_ADD_RESOURCES(opentrack-proto-simconnect-rcc ${opentrack-proto-simconnect-rc}) - -file(GLOB opentrack-proto-vjoy-c "ftnoir_protocol_vjoy/*.cpp") -file(GLOB opentrack-proto-vjoy-h "ftnoir_protocol_vjoy/*.h") -file(GLOB opentrack-proto-vjoy-ui "ftnoir_protocol_vjoy/*.ui") -file(GLOB opentrack-proto-vjoy-rc "ftnoir_protocol_vjoy/*.qrc") -QT5_WRAP_UI(opentrack-proto-vjoy-uih ${opentrack-proto-vjoy-ui}) -QT5_ADD_RESOURCES(opentrack-proto-vjoy-rcc ${opentrack-proto-vjoy-rc}) - -file(GLOB opentrack-proto-libevdev-c "ftnoir_protocol_libevdev/*.cpp") -file(GLOB opentrack-proto-libevdev-h "ftnoir_protocol_libevdev/*.h") -file(GLOB opentrack-proto-libevdev-ui "ftnoir_protocol_libevdev/*.ui") -file(GLOB opentrack-proto-libevdev-rc "ftnoir_protocol_libevdev/*.qrc") -QT5_WRAP_UI(opentrack-proto-libevdev-uih ${opentrack-proto-libevdev-ui}) -QT5_ADD_RESOURCES(opentrack-proto-libevdev-rcc ${opentrack-proto-libevdev-rc}) +opentrack_module(opentrack-proto-fgfs ftnoir_protocol_fg) +opentrack_module(opentrack-proto-fsuipc ftnoir_protocol_fsuipc) +opentrack_module(opentrack-proto-freetrack ftnoir_protocol_ft) +opentrack_module(opentrack-proto-udp ftnoir_protocol_ftn) +opentrack_module(opentrack-proto-wine ftnoir_protocol_wine) +opentrack_module(opentrack-proto-win32-mouse ftnoir_protocol_mouse) +opentrack_module(opentrack-proto-simconnect ftnoir_protocol_sc) +opentrack_module(opentrack-proto-vjoy ftnoir_protocol_vjoy) +opentrack_module(opentrack-proto-libevdev ftnoir_protocol_libevdev) # trackers -file(GLOB opentrack-tracker-ht-c "ftnoir_tracker_ht/*.cpp") -file(GLOB opentrack-tracker-ht-h "ftnoir_tracker_ht/*.h") -file(GLOB opentrack-tracker-ht-ui "ftnoir_tracker_ht/*.ui") -file(GLOB opentrack-tracker-ht-rc "ftnoir_tracker_ht/*.qrc") -QT5_WRAP_UI(opentrack-tracker-ht-uih ${opentrack-tracker-ht-ui}) -QT5_ADD_RESOURCES(opentrack-tracker-ht-rcc ${opentrack-tracker-ht-rc}) - -file(GLOB opentrack-tracker-aruco-c "ftnoir_tracker_aruco/*.cpp") -file(GLOB opentrack-tracker-aruco-h "ftnoir_tracker_aruco/*.h") -file(GLOB opentrack-tracker-aruco-ui "ftnoir_tracker_aruco/*.ui") -file(GLOB opentrack-tracker-aruco-rc "ftnoir_tracker_aruco/*.qrc") -QT5_WRAP_UI(opentrack-tracker-aruco-uih ${opentrack-tracker-aruco-ui}) -QT5_ADD_RESOURCES(opentrack-tracker-aruco-rcc ${opentrack-tracker-aruco-rc}) - -file(GLOB opentrack-tracker-pt-c "FTNoIR_Tracker_PT/*.cpp") -file(GLOB opentrack-tracker-pt-h "FTNoIR_Tracker_PT/*.h") -file(GLOB opentrack-tracker-pt-ui "FTNoIR_Tracker_PT/*.ui") -file(GLOB opentrack-tracker-pt-rc "FTNoIR_Tracker_PT/*.qrc") -QT5_WRAP_UI(opentrack-tracker-pt-uih ${opentrack-tracker-pt-ui}) -QT5_ADD_RESOURCES(opentrack-tracker-pt-rcc ${opentrack-tracker-pt-rc}) - -file(GLOB opentrack-tracker-udp-c "ftnoir_tracker_udp/*.cpp") -file(GLOB opentrack-tracker-udp-h "ftnoir_tracker_udp/*.h") -file(GLOB opentrack-tracker-udp-ui "ftnoir_tracker_udp/*.ui") -file(GLOB opentrack-tracker-udp-rc "ftnoir_tracker_udp/*.qrc") -QT5_WRAP_UI(opentrack-tracker-udp-uih ${opentrack-tracker-udp-ui}) -QT5_ADD_RESOURCES(opentrack-tracker-udp-rcc ${opentrack-tracker-udp-rc}) - -file(GLOB opentrack-tracker-joystick-c "ftnoir_tracker_joystick/*.cpp") -file(GLOB opentrack-tracker-joystick-h "ftnoir_tracker_joystick/*.h") -file(GLOB opentrack-tracker-joystick-ui "ftnoir_tracker_joystick/*.ui") -file(GLOB opentrack-tracker-joystick-rc "ftnoir_tracker_joystick/*.qrc") -QT5_WRAP_UI(opentrack-tracker-joystick-uih ${opentrack-tracker-joystick-ui}) -QT5_ADD_RESOURCES(opentrack-tracker-joystick-rcc ${opentrack-tracker-joystick-rc}) - -file(GLOB opentrack-tracker-rift-c "ftnoir_tracker_rift/*.cpp") -file(GLOB opentrack-tracker-rift-h "ftnoir_tracker_rift/*.h") -file(GLOB opentrack-tracker-rift-ui "ftnoir_tracker_rift/*.ui") -file(GLOB opentrack-tracker-rift-rc "ftnoir_tracker_rift/*.qrc") -QT5_WRAP_UI(opentrack-tracker-rift-uih ${opentrack-tracker-rift-ui}) -QT5_ADD_RESOURCES(opentrack-tracker-rift-rcc ${opentrack-tracker-rift-rc}) - -file(GLOB opentrack-tracker-hydra-c "ftnoir_tracker_hydra/*.cpp") -file(GLOB opentrack-tracker-hydra-h "ftnoir_tracker_hydra/*.h") -file(GLOB opentrack-tracker-hydra-ui "ftnoir_tracker_hydra/*.ui") -file(GLOB opentrack-tracker-hydra-rc "ftnoir_tracker_hydra/*.qrc") -QT5_WRAP_UI(opentrack-tracker-hydra-uih ${opentrack-tracker-hydra-ui}) -QT5_ADD_RESOURCES(opentrack-tracker-hydra-rcc ${opentrack-tracker-hydra-rc}) - -file(GLOB opentrack-tracker-hatire-c "ftnoir_tracker_hatire/*.cpp") -file(GLOB opentrack-tracker-hatire-h "ftnoir_tracker_hatire/*.h") -file(GLOB opentrack-tracker-hatire-ui "ftnoir_tracker_hatire/*.ui") -file(GLOB opentrack-tracker-hatire-rc "ftnoir_tracker_hatire/*.qrc") -QT5_WRAP_UI(opentrack-tracker-hatire-uih ${opentrack-tracker-hatire-ui}) -QT5_ADD_RESOURCES(opentrack-tracker-hatire-rcc ${opentrack-tracker-hatire-rc}) - -file(GLOB opentrack-csv-c "ftnoir_csv/*.cpp") +opentrack_module(opentrack-tracker-ht ftnoir_tracker_ht) +opentrack_module(opentrack-tracker-aruco ftnoir_tracker_aruco) +opentrack_module(opentrack-tracker-pt FTNoIR_Tracker_PT) +opentrack_module(opentrack-tracker-udp ftnoir_tracker_udp) +opentrack_module(opentrack-tracker-joystick ftnoir_tracker_joystick) +opentrack_module(opentrack-tracker-rift ftnoir_tracker_rift) +opentrack_module(opentrack-tracker-hydra ftnoir_tracker_hydra) +opentrack_module(opentrack-tracker-hatire ftnoir_tracker_hatire) + +file(GLOB opentrack-csv-c "ftnoir_csv/*.cpp" "ftnoir_csv/*.h") # compat lib for POSIX/win32 -file(GLOB opentrack-compat-c "compat/*.cpp") +file(GLOB opentrack-compat-c "compat/*.cpp" "compat/*.h") # x-plane plugin file(GLOB opentrack-xplane-plugin-c "x-plane-plugin/*.c") @@ -380,13 +297,7 @@ if(QT_USE_FILE) INCLUDE(${QT_USE_FILE}) endif() -if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) - SET (CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS_INIT} -rdynamic CACHE STRING "Flags used by the linker during the creation of dll's.") - SET (CMAKE_MODULE_LINKER_FLAGS ${CMAKE_MODULE_LINKER_FLAGS_INIT} -rdynamic CACHE STRING "Flags used by the linker during the creation of modules.") - SET (CMAKE_MODULE_LINKER_FLAGS ${CMAKE_MODULE_LINKER_FLAGS_INIT} -rdynamic CACHE STRING "Flags used by the linker during the creation of modules.") -endif() - -add_library(opentrack-compat SHARED ${opentrack-compat-c} ${opentrack-compat-h}) +add_library(opentrack-compat SHARED ${opentrack-compat-c}) if(NOT WIN32 AND NOT APPLE) target_link_libraries(opentrack-compat rt) endif() @@ -413,121 +324,73 @@ else() ${Qt5Network_LIBRARIES} ${Qt5Xml_LIBRARIES} ${Qt5Core_LIBRARIES} ${maybe-hatire} ${my-qt-deps}) endif() -add_library(opentrack-csv SHARED ${opentrack-csv-c} ${opentrack-csv-h}) +add_library(opentrack-csv SHARED ${opentrack-csv-c}) target_link_libraries(opentrack-csv ${MY_QT_LIBS}) -add_library(opentrack-pose-widget SHARED ${opentrack-pose-widget-c} ${opentrack-pose-widget-h} ${opentrack-pose-widget-moc} ${opentrack-pose-widget-rcc}) +add_library(opentrack-pose-widget SHARED ${opentrack-pose-widget-c} ${opentrack-pose-widget-rcc}) target_link_libraries(opentrack-pose-widget ${MY_QT_LIBS}) -add_library(opentrack-spline-widget SHARED ${opentrack-spline-widget-c} ${opentrack-spline-widget-h} ${opentrack-spline-widget-moc}) +add_library(opentrack-spline-widget SHARED ${opentrack-spline-widget-c}) 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}) - -add_library(opentrack-filter-kalman SHARED ${opentrack-filter-kalman-c} ${opentrack-filter-kalman-h} ${opentrack-filter-kalman-moc} ${opentrack-filter-kalman-uih} ${opentrack-filter-kalman-rcc}) -target_link_libraries(opentrack-filter-kalman ${MY_QT_LIBS} ${OpenCV_LIBS}) - -if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE) - SET_TARGET_PROPERTIES(opentrack-filter-kalman - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/${version-script}-version-script.txt") -endif() - -if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE) - SET_TARGET_PROPERTIES(opentrack-filter-accela - 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}) +opentrack_library(opentrack-filter-accela) +opentrack_library(opentrack-filter-kalman) +opentrack_library(opentrack-filter-ewma) -if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE) - SET_TARGET_PROPERTIES(opentrack-filter-ewma - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/${version-script}-version-script.txt") -endif() +target_link_libraries(opentrack-filter-kalman ${OpenCV_LIBS}) -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 APPLE) - SET_TARGET_PROPERTIES(opentrack-proto-fgfs - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/${version-script}-version-script.txt") -endif() +opentrack_library(opentrack-proto-fgfs) -if(WIN32 AND SDK_VJOY) +if(SDK_VJOY) include_directories(${SDK_VJOY}) - add_library(opentrack-proto-vjoy SHARED ${opentrack-proto-vjoy-c} ${opentrack-proto-vjoy-h} ${opentrack-proto-vjoy-moc} ${opentrack-proto-vjoy-uih} ${opentrack-proto-vjoy-rcc}) + opentrack_library(opentrack-proto-vjoy) if(MSVC) target_link_libraries(opentrack-proto-vjoy ${MY_QT_LIBS} "${SDK_VJOY}/VJoy.lib") else() target_link_libraries(opentrack-proto-vjoy ${MY_QT_LIBS} "${SDK_VJOY}/VJoy.dll") endif() - if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE) - SET_TARGET_PROPERTIES(opentrack-proto-vjoy - 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 APPLE) - SET_TARGET_PROPERTIES(opentrack-proto-libevdev - 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 . ) +if(SDK_ENABLE_LIBEVDEV) + opentrack_library(opentrack-proto-libevdev) + target_link_libraries(opentrack-proto-libevdev evdev) endif() -if(WIN32) - if(SDK_FSUIPC) - add_library(opentrack-proto-fsuipc SHARED ${opentrack-proto-fsuipc-c} ${opentrack-proto-fsuipc-h} ${opentrack-proto-fsuipc-moc} ${opentrack-proto-fsuipc-uih} ${opentrack-proto-fsuipc-rcc}) - target_link_libraries(opentrack-proto-fsuipc ${MY_QT_LIBS} "${SDK_FSUIPC}/FSUIPC_User.lib") - if(MSVC) - set_target_properties(opentrack-proto-fsuipc PROPERTIES LINK_FLAGS "/NODEFAULTLIB:libc") - else() - set_target_properties(opentrack-proto-fsuipc PROPERTIES LINK_FLAGS "-Wl,--exclude-all-symbols") - endif() +if(SDK_FSUIPC) + if(MSVC) + set(link-flags "/NODEFAULTLIB:libc") endif() + opentrack_library(opentrack-proto-fsuipc LINK "${link-flags}") + target_link_libraries(opentrack-proto-fsuipc "${SDK_FSUIPC}/FSUIPC_User.lib") +endif() - if(SDK_SIMCONNECT) - add_library(opentrack-proto-simconnect SHARED ${opentrack-proto-simconnect-c} ${opentrack-proto-simconnect-h} ${opentrack-proto-simconnect-moc} ${opentrack-proto-simconnect-uih} ${opentrack-proto-simconnect-rcc}) - target_link_libraries(opentrack-proto-simconnect ${MY_QT_LIBS}) - include_directories("${SDK_SIMCONNECT}/inc") - target_link_libraries(opentrack-proto-simconnect "${SDK_SIMCONNECT}/lib/SimConnect.lib") - endif() +if(SDK_SIMCONNECT) + opentrack_library(opentrack-proto-simconnect) + include_directories("${SDK_SIMCONNECT}/inc") + target_link_libraries(opentrack-proto-simconnect "${SDK_SIMCONNECT}/lib/SimConnect.lib") +endif() - add_library(opentrack-proto-freetrack SHARED ${opentrack-proto-freetrack-c} ${opentrack-proto-freetrack-h} ${opentrack-proto-freetrack-moc} ${opentrack-proto-freetrack-uih} ${opentrack-proto-freetrack-rcc}) - target_link_libraries(opentrack-proto-freetrack opentrack-csv ${MY_QT_LIBS} opentrack-compat) +if(WIN32) + opentrack_library(opentrack-proto-freetrack) + target_link_libraries(opentrack-proto-freetrack opentrack-csv opentrack-compat) + opentrack_library(opentrack-proto-win32-mouse) +endif() - add_library(opentrack-proto-win32-mouse SHARED ${opentrack-proto-win32-mouse-c} ${opentrack-proto-win32-mouse-h} ${opentrack-proto-win32-mouse-moc} ${opentrack-proto-win32-mouse-uih} ${opentrack-proto-win32-mouse-rcc}) - target_link_libraries(opentrack-proto-win32-mouse ${MY_QT_LIBS}) - add_library(freetrackclient SHARED ${opentrack-freetrack-c} ${opentrack-freetrack-h}) +if(WIN32) + add_library(freetrackclient SHARED ${opentrack-freetrack-c}) if(CMAKE_COMPILER_IS_GNUCC) set_target_properties(freetrackclient PROPERTIES LINK_FLAGS "-Wl,--enable-stdcall-fixup -fno-lto -Wl,-kill-at" PREFIX "" COMPILE_FLAGS "-fno-lto") endif() 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 APPLE) - SET_TARGET_PROPERTIES(opentrack-proto-udp - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/${version-script}-version-script.txt") -endif() +opentrack_library(opentrack-proto-udp) 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 APPLE) - SET_TARGET_PROPERTIES(opentrack-tracker-joystick - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/${version-script}-version-script.txt") - endif() + opentrack_library(opentrack-tracker-joystick) 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 APPLE) - SET_TARGET_PROPERTIES(opentrack-proto-wine - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/${version-script}-version-script.txt") - endif() +if(SDK_WINE_PREFIX) + opentrack_library(opentrack-proto-wine) + target_link_libraries(opentrack-proto-wine opentrack-compat opentrack-csv) if(NOT SDK_WINE_NO_WRAPPER) set(my-rt -lrt) if(APPLE) @@ -549,26 +412,13 @@ if(NOT WIN32 AND SDK_WINE_PREFIX) endif() endif() -if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE) - SET_TARGET_PROPERTIES(opentrack-proto-fgfs - 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 APPLE) - SET_TARGET_PROPERTIES(opentrack-tracker-ht - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/${version-script}-version-script.txt") -endif() +opentrack_library(opentrack-tracker-ht) +target_link_libraries(opentrack-tracker-ht opentrack-compat) 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 APPLE) - SET_TARGET_PROPERTIES(opentrack-tracker-aruco - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/${version-script}-version-script.txt") - endif() + opentrack_library(opentrack-tracker-aruco) + target_link_libraries(opentrack-tracker-aruco ${SDK_ARUCO_LIBPATH} ${OpenCV_LIBS}) if(WIN32 AND MSVC) target_link_libraries(opentrack-tracker-aruco "${CMAKE_SOURCE_DIR}/dinput/dxguid.lib" @@ -578,91 +428,54 @@ if(SDK_ARUCO_LIBPATH) endif() if(SDK_HATIRE) - 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 APPLE) - SET_TARGET_PROPERTIES(opentrack-tracker-hatire - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/${version-script}-version-script.txt") - endif() -endif() - -if(WIN32) - target_link_libraries(opentrack-tracker-ht - "${CMAKE_SOURCE_DIR}/dinput/dxguid.lib" - "${CMAKE_SOURCE_DIR}/dinput/strmiids.lib" - uuid) - target_link_libraries(opentrack-tracker-joystick - "${CMAKE_SOURCE_DIR}/dinput/dinput8.lib" - "${CMAKE_SOURCE_DIR}/dinput/dxguid.lib" - "${CMAKE_SOURCE_DIR}/dinput/strmiids.lib" - uuid) -endif() - -add_library(opentrack-tracker-pt SHARED ${opentrack-tracker-pt-c} ${opentrack-tracker-pt-h} ${opentrack-tracker-pt-moc} ${opentrack-tracker-pt-uih} ${opentrack-tracker-pt-rcc}) -target_link_libraries(opentrack-tracker-pt ${MY_QT_LIBS} ${OpenCV_LIBS}) - -if(APPLE) - SET_TARGET_PROPERTIES(opentrack-tracker-pt PROPERTIES COMPILE_FLAGS "-std=c++11") + opentrack_library(opentrack-tracker-hatire) endif() -if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE) - SET_TARGET_PROPERTIES(opentrack-tracker-pt - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/${version-script}-version-script.txt") -endif() +link_with_dinput8(opentrack-tracker-ht) +link_with_dinput8(opentrack-tracker-joystick) +opentrack_library(opentrack-tracker-pt) +target_link_libraries(opentrack-tracker-pt ${OpenCV_LIBS}) -if(WIN32) - target_link_libraries(opentrack-tracker-pt - "${CMAKE_SOURCE_DIR}/dinput/dxguid.lib" - "${CMAKE_SOURCE_DIR}/dinput/strmiids.lib" - uuid) -endif() +link_with_dinput8(opentrack-tracker-pt) -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 APPLE) - SET_TARGET_PROPERTIES(opentrack-tracker-udp - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/${version-script}-version-script.txt") -endif() +opentrack_library(opentrack-tracker-udp) if(SDK_RIFT) include_directories("${SDK_RIFT}/Include") include_directories("${SDK_RIFT}/Src") - add_library(opentrack-tracker-rift SHARED ${opentrack-tracker-rift-c} ${opentrack-tracker-rift-h} ${opentrack-tracker-rift-moc} ${opentrack-tracker-rift-uih} ${opentrack-tracker-rift-rcc}) - target_link_libraries(opentrack-tracker-rift ${MY_QT_LIBS}) - if(MSVC) - target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/Lib/Win32/libovr.lib" winmm.lib setupapi.lib) - set_target_properties(opentrack-tracker-rift PROPERTIES LINK_FLAGS "/NODEFAULTLIB:LIBCMT") + 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") + else() + if(MSVC) + set(link-flags "/NODEFAULTLIB:LIBCMT") + else() + set(c-flags "-fno-strict-aliasing") + endif() + endif() + opentrack_library(opentrack-tracker-rift LINK "${link-flags}" COMPILE "${c-flags}") + if(MSVC) + target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/Lib/Win32/libovr.lib" winmm.lib setupapi.lib) + else() + if(WIN32) + target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/libLibOVR.a" winmm setupapi) + else() + if(NOT APPLE) + target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/libLibOVR.a" udev Xinerama) else() - if(WIN32) - target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/libLibOVR.a" winmm.lib setupapi.lib) - else() - 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() + target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/libLibOVR.a") endif() - if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE) - SET_TARGET_PROPERTIES(opentrack-tracker-rift - PROPERTIES - LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/${version-script}-version-script.txt" - COMPILE_FLAGS "-fno-strict-aliasing" - ) - endif() - if(APPLE) - SET_TARGET_PROPERTIES(opentrack-tracker-rift - PROPERTIES LINK_FLAGS "-framework CoreFoundation -framework CoreGraphics -framework IOKit -framework Quartz") endif() endif() +endif() if(SDK_HYDRA) include_directories("${SDK_HYDRA}/include") include_directories("${SDK_HYDRA}/include/sixense_utils") - add_library(opentrack-tracker-hydra SHARED ${opentrack-tracker-hydra-c} ${opentrack-tracker-hydra-h} ${opentrack-tracker-hydra-moc} ${opentrack-tracker-hydra-uih} ${opentrack-tracker-hydra-rcc}) - target_link_libraries(opentrack-tracker-hydra ${MY_QT_LIBS}) + opentrack_library(opentrack-tracker-hydra) if(WIN32) target_link_libraries(opentrack-tracker-hydra "${SDK_HYDRA}/lib/win32/release_dll/sixense.lib" @@ -690,10 +503,6 @@ 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 APPLE) - SET_TARGET_PROPERTIES(opentrack-tracker-hydra - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/${version-script}-version-script.txt") - endif() endif() if(WIN32 AND NOT SDK_CONSOLE_DEBUG) @@ -709,7 +518,7 @@ if(UNIX OR APPLE) target_link_libraries(opentrack-qxt-mini X11) endif() endif() -add_executable(opentrack ${opentrack-win32-executable} ${opentrack-bin-c} ${opentrack-bin-h} ${opentrack-bin-moc} ${opentrack-bin-uih} ${opentrack-bin-rcc}) +add_executable(opentrack ${opentrack-win32-executable} ${opentrack-bin-c} ${opentrack-bin-uih} ${opentrack-bin-rcc}) set_target_properties(opentrack PROPERTIES COMPILE_DEFINITIONS OPENTRACK_VERSION=\"${OPENTRACK__COMMIT}\") set(OPENTRACK_COMMIT_VERSION \"${OPENTRACK__COMMIT}\") configure_file("${CMAKE_SOURCE_DIR}/opentrack-version.h" "${CMAKE_BINARY_DIR}/opentrack-version.h" @ONLY NEWLINE_STYLE UNIX) @@ -718,7 +527,7 @@ if(APPLE) SET_TARGET_PROPERTIES(opentrack-qxt-mini PROPERTIES LINK_FLAGS "-framework Carbon -framework CoreFoundation") endif() -add_library(opentrack-api SHARED ${opentrack-lib-c} ${opentrack-lib-h} ${opentrack-lib-moc}) +add_library(opentrack-api SHARED ${opentrack-lib-c}) target_link_libraries(opentrack-api ${MY_QT_LIBS}) if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE) SET_TARGET_PROPERTIES(opentrack-api PROPERTIES @@ -740,14 +549,8 @@ if(UNIX OR APPLE) install(TARGETS opentrack-qxt-mini RUNTIME DESTINATION . LIBRARY DESTINATION . ) endif() -if(WIN32) - target_link_libraries(opentrack "${CMAKE_SOURCE_DIR}/dinput/dinput8.lib" - "${CMAKE_SOURCE_DIR}/dinput/dxguid.lib" - "${CMAKE_SOURCE_DIR}/dinput/strmiids.lib" - winmm - uuid - ) -endif() +link_with_dinput8(opentrack) + if(MSVC) SET_TARGET_PROPERTIES(opentrack PROPERTIES LINK_FLAGS "/ENTRY:mainCRTStartup") endif() @@ -773,11 +576,13 @@ install(FILES "${CMAKE_SOURCE_DIR}/README.md" DESTINATION .) if(SDK_XPLANE) install(TARGETS opentrack-xplane-plugin RUNTIME DESTINATION . LIBRARY DESTINATION . ) endif() + if(WIN32) install(DIRECTORY "${CMAKE_SOURCE_DIR}/bin/tracker-ht" DESTINATION .) install(TARGETS freetrackclient RUNTIME DESTINATION . LIBRARY DESTINATION . ) endif() - install(DIRECTORY "${CMAKE_SOURCE_DIR}/3rdparty-notices" DESTINATION .) + +install(DIRECTORY "${CMAKE_SOURCE_DIR}/3rdparty-notices" DESTINATION .) install(FILES "${CMAKE_SOURCE_DIR}/bin/NPClient.dll" "${CMAKE_SOURCE_DIR}/bin/NPClient64.dll" "${CMAKE_SOURCE_DIR}/bin/TrackIR.exe" DESTINATION .) install(DIRECTORY "${CMAKE_SOURCE_DIR}/bin/settings" "${CMAKE_SOURCE_DIR}/facetracknoir/clientfiles" DESTINATION .) @@ -785,69 +590,24 @@ install(DIRECTORY "${CMAKE_SOURCE_DIR}/bin/settings" "${CMAKE_SOURCE_DIR}/facetr if(NOT WIN32 AND SDK_WINE_PREFIX) install(FILES "${CMAKE_BINARY_DIR}/opentrack-wrapper-wine.exe.so" DESTINATION .) - install(TARGETS opentrack-proto-wine RUNTIME DESTINATION . LIBRARY DESTINATION . ) -endif() - -install(TARGETS opentrack-tracker-pt RUNTIME DESTINATION . LIBRARY DESTINATION . ) - -if(SDK_ARUCO_LIBPATH) - install(TARGETS opentrack-tracker-aruco RUNTIME DESTINATION . LIBRARY DESTINATION . ) endif() install(TARGETS - opentrack-proto-fgfs - opentrack-proto-udp opentrack-api opentrack-compat opentrack-csv opentrack-pose-widget opentrack-spline-widget - opentrack-filter-accela - opentrack-filter-kalman - opentrack-filter-ewma - opentrack-tracker-ht - opentrack-tracker-udp RUNTIME DESTINATION . LIBRARY DESTINATION . ) -install(TARGETS - opentrack - DESTINATION . -) - -if(WIN32) - install(TARGETS opentrack-tracker-joystick RUNTIME DESTINATION . LIBRARY DESTINATION . ) -endif() +install(TARGETS opentrack DESTINATION .) -if(WIN32 AND SDK_VJOY) - install(TARGETS opentrack-proto-vjoy RUNTIME DESTINATION . LIBRARY DESTINATION . ) +if(SDK_VJOY) install(FILES "${SDK_VJOY}/VJoy.dll" DESTINATION .) endif() -if(SDK_RIFT) - install(TARGETS opentrack-tracker-rift RUNTIME DESTINATION . LIBRARY DESTINATION . ) -endif() - -if(SDK_HYDRA) - install( - TARGETS opentrack-tracker-hydra - RUNTIME DESTINATION . LIBRARY DESTINATION . - ) -endif() - if(WIN32) install(FILES "${CMAKE_SOURCE_DIR}/bin/cleye.config" DESTINATION .) - if(SDK_SIMCONNECT) - install(TARGETS opentrack-proto-simconnect RUNTIME DESTINATION . LIBRARY DESTINATION . ) - endif() - install(TARGETS - opentrack-proto-freetrack - opentrack-proto-win32-mouse - RUNTIME DESTINATION . LIBRARY DESTINATION . - ) - if(SDK_FSUIPC) - install(TARGETS opentrack-proto-fsuipc RUNTIME DESTINATION . LIBRARY DESTINATION .) - endif() - endif() if(MSVC) |