diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2014-10-19 23:02:37 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2014-10-19 23:02:37 +0200 |
commit | baf216ec3e74c4202274bac6741a207bb357e0d9 (patch) | |
tree | 18e960e96ed31b1a2b410b1fe9158da384d91deb | |
parent | 709dac6140502566fac4156b83b998895dc07377 (diff) |
build issues
-rw-r--r-- | CMakeLists.txt | 271 | ||||
-rw-r--r-- | qxt-mini/qxtglobal.h | 2 |
2 files changed, 130 insertions, 143 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b96e239..f9ee1743 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,13 +2,9 @@ project(opentrack) cmake_minimum_required(VERSION 2.8.11) cmake_policy(SET CMP0020 NEW) -if(MSVC) - message(FATAL_ERROR "Support for MSVC removed due to incomplete C++11 support") -endif() - include(CMakeParseArguments) -set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_SOURCE_DIR}/cmake/") +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/) include(GetGitRevisionDescription) include(FindPkgConfig) find_package(Git QUIET) @@ -16,29 +12,7 @@ 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) -endif() - -if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE) - if(MINGW) - 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}") - set(CMAKE_STATIC_LINKER_FLAGS " ${apple-frameworks} ${CMAKE_STATIC_LINKER_FLAGS}") - set(CMAKE_EXE_LINKER_FLAGS " ${apple-frameworks} ${CMAKE_EXE_LINKER_FLAGS}") - set(CMAKE_MODULE_LINKER_FLAGS " ${apple-frameworks} ${CMAKE_MODULE_LINKER_FLAGS}") -endif() - +#INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) SET(CMAKE_SKIP_INSTALL_RPATH FALSE) @@ -48,94 +22,53 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC OFF) set(CMAKE_POSITION_INDEPENDENT_CODE ON) -# note, hatire supports both ftnoir and opentrack -# don't remove without being sure as hell -sh 20140922 -add_definitions(-DOPENTRACK_API) - -if(CMAKE_COMPILER_IS_GNUCXX OR APPLE) - set(CMAKE_CXX_FLAGS " -std=c++11 ${CMAKE_CXX_FLAGS} ") -endif() - -if(UNIX) - set(SDK_ENABLE_LIBEVDEV FALSE CACHE BOOL "libevdev virtual joystick protocol support (probably Linux only)") -endif() -if(WIN32) - SET(SDK_CONSOLE_DEBUG FALSE CACHE BOOL "Console build") -endif() - -IF(WIN32) - SET(SDK_VJOY "" CACHE PATH "VJoy SDK path") -ENDIF() -SET(SDK_HYDRA "" CACHE PATH "libSixense path") -SET(SDK_HYDRA_AMD64 FALSE CACHE BOOL "whether target is amd64 (else ia-32)") - -SET(SDK_RIFT "" CACHE PATH "libOVR path") - -include_directories(${CMAKE_SOURCE_DIR}) - find_package(OpenCV REQUIRED) +include_directories(${OpenCV_INCLUDE_DIRS}) find_package(Qt5 REQUIRED COMPONENTS Core Xml Network Widgets Gui ${maybe-serial-port} QUIET) 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}) +set(my-qt-deps) +if(WIN32) # hack to avoid breakage on buildbot + set(my-qt-deps ws2_32) +endif() +set(MY_QT_LIBS ${Qt5Widgets_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5Xml_LIBRARIES} ${Qt5Core_LIBRARIES} ${my-qt-deps}) -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") +#include_directories(${CMAKE_SOURCE_DIR}) -if(WIN32) - set(SDK_SIMCONNECT "" CACHE PATH "Path to SimConnect SDK") - set(SDK_FSUIPC "" CACHE PATH "Path to FSUIPC") -endif() +# note, hatire supports both ftnoir and opentrack +# don't remove without being sure as hell -sh 20140922 +add_definitions(-DOPENTRACK_API) -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") +if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") + set(CMAKE_COMPILER_IS_GNUCC TRUE) + set(CMAKE_COMPILER_IS_GNUCXX TRUE) endif() -if(SDK_XPLANE) - INCLUDE_DIRECTORIES("${SDK_XPLANE}/CHeaders" "${SDK_XPLANE}/CHeaders/XPLM") +if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE) + if(MINGW) + set(version-script mingw) + else() + set(version-script posix) + endif() 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(SDK_FSUIPC AND WIN32) - include_directories("${SDK_FSUIPC}") - link_directories("${SDK_FSUIPC}") +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}") + set(CMAKE_STATIC_LINKER_FLAGS " ${apple-frameworks} ${CMAKE_STATIC_LINKER_FLAGS}") + set(CMAKE_EXE_LINKER_FLAGS " ${apple-frameworks} ${CMAKE_EXE_LINKER_FLAGS}") + set(CMAKE_MODULE_LINKER_FLAGS " ${apple-frameworks} ${CMAKE_MODULE_LINKER_FLAGS}") endif() -# Qxt bundled :: sorry for this, but gentoo ebuild is broken -if(APPLE) - set(qxt-mini-c qxt-mini/plat/qxtglobalshortcut_mac.cpp qxt-mini/qxtglobalshortcut.cpp) - include_directories("qxt-mini/") -else() - if(UNIX) - set(qxt-mini-c qxt-mini/plat/qxtglobalshortcut_x11.cpp qxt-mini/qxtglobalshortcut.cpp) - include_directories("qxt-mini/") - endif() +if(CMAKE_COMPILER_IS_GNUCXX OR APPLE) + set(CMAKE_CXX_FLAGS " -std=c++11 ${CMAKE_CXX_FLAGS} ") endif() -# qt being broken as usual +# qt broken as usual set(EXTRA-MOCS opentrack/options.hpp) -function(link_with_dinput8 n) - if(WIN32) - target_link_libraries(${n} dinput8 dxguid strmiids) - endif() -endfunction() - macro(opentrack_module n dir) file(GLOB ${n}-c ${dir}/*.cpp ${dir}/*.c ${dir}/*.h ${dir}/*.hpp ${EXTRA-MOCS}) file(GLOB ${n}-res ${dir}/*.rc) @@ -170,11 +103,62 @@ macro(opentrack_library n dir) install(TARGETS ${n} RUNTIME DESTINATION . LIBRARY DESTINATION .) endmacro() -opentrack_module(opentrack-compat compat) -opentrack_module(opentrack-xplane-plugin x-plane-plugin) +if(UNIX) + set(SDK_ENABLE_LIBEVDEV FALSE CACHE BOOL "libevdev virtual joystick protocol support (probably Linux only)") +endif() + +IF(WIN32) + SET(SDK_VJOY "" CACHE PATH "VJoy SDK path") + SET(SDK_CONSOLE_DEBUG FALSE CACHE BOOL "Console build") +ENDIF() + +IF("${CMAKE_SYSTEM}" MATCHES "Linux" OR APPLE) + set(SDK_XPLANE "" CACHE PATH "Path to X-Plane SDK") +endif() + +SET(SDK_HYDRA "" CACHE PATH "libSixense path") +SET(SDK_HYDRA_AMD64 FALSE CACHE BOOL "whether target is amd64 (else ia-32)") +SET(SDK_RIFT "" CACHE PATH "libOVR path") + +set(SDK_ARUCO_LIBPATH "" CACHE FILEPATH "Path to Aruco static library") + +if(WIN32) + set(SDK_SIMCONNECT "" CACHE PATH "Path to SimConnect SDK") + set(SDK_FSUIPC "" CACHE PATH "Path to FSUIPC") +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() + +#include_directories(${CMAKE_SOURCE_DIR}) + +function(link_with_dinput8 n) + if(WIN32) + target_link_libraries(${n} dinput8 dxguid strmiids) + endif() +endfunction() + +if(SDK_XPLANE) + INCLUDE_DIRECTORIES(${SDK_XPLANE}/CHeaders ${SDK_XPLANE}/CHeaders/XPLM) +endif() -# freetrack +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}) + link_directories(${SDK_FSUIPC}) +endif() + +opentrack_module(opentrack-compat compat) +opentrack_module(opentrack-xplane-plugin x-plane-plugin) opentrack_module(freetrackclient freetrackclient) if(SDK_XPLANE) @@ -198,35 +182,23 @@ if(SDK_XPLANE) endif() endif() -# some boilerplate - -if(QT_USE_FILE) - INCLUDE(${QT_USE_FILE}) -endif() - add_library(opentrack-compat STATIC ${opentrack-compat-c}) if(NOT WIN32 AND NOT APPLE) target_link_libraries(opentrack-compat rt) endif() -# hack to avoid breakage on buildbot -set(my-qt-deps) -if(WIN32) - set(my-qt-deps ws2_32) -endif() - -set(MY_QT_LIBS ${Qt5Widgets_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5Xml_LIBRARIES} ${Qt5Core_LIBRARIES} ${my-qt-deps}) - opentrack_module(opentrack-csv ftnoir_csv) add_library(opentrack-csv STATIC ${opentrack-csv-c}) target_link_libraries(opentrack-csv ${MY_QT_LIBS}) opentrack_module(opentrack-pose-widget ftnoir_posewidget) +include_directories(ftnoir_posewidget/) opentrack_qt(opentrack-pose-widget) add_library(opentrack-pose-widget STATIC ${opentrack-pose-widget-all}) target_link_libraries(opentrack-pose-widget ${MY_QT_LIBS}) opentrack_module(opentrack-spline-widget qfunctionconfigurator) +include_directories(qfunctionconfigurator/) opentrack_qt(opentrack-spline-widget) add_library(opentrack-spline-widget STATIC ${opentrack-spline-widget-all}) target_link_libraries(opentrack-spline-widget ${MY_QT_LIBS}) @@ -251,7 +223,7 @@ if(SDK_VJOY) set(link-flags "-Wl,--enable-stdcall-fixup") endif() opentrack_library(opentrack-proto-vjoy ftnoir_protocol_vjoy LINK ${link-flags}) - target_link_libraries(opentrack-proto-vjoy ${MY_QT_LIBS} "${SDK_VJOY}/VJoy.dll") + target_link_libraries(opentrack-proto-vjoy ${MY_QT_LIBS} ${SDK_VJOY}/VJoy.dll) endif() if(SDK_ENABLE_LIBEVDEV) @@ -265,13 +237,13 @@ endif() if(SDK_FSUIPC) opentrack_library(opentrack-proto-fsuipc ftnoir_protocol_fsuipc) - target_link_libraries(opentrack-proto-fsuipc "${SDK_FSUIPC}/FSUIPC_User.lib") + target_link_libraries(opentrack-proto-fsuipc ${SDK_FSUIPC}/FSUIPC_User.lib) endif() if(SDK_SIMCONNECT) opentrack_library(opentrack-proto-simconnect ftnoir_protocol_sc) - include_directories("${SDK_SIMCONNECT}/inc") - target_link_libraries(opentrack-proto-simconnect "${SDK_SIMCONNECT}/lib/SimConnect.lib") + include_directories(${SDK_SIMCONNECT}/inc) + target_link_libraries(opentrack-proto-simconnect ${SDK_SIMCONNECT}/lib/SimConnect.lib) endif() if(WIN32) @@ -299,15 +271,15 @@ if(SDK_WINE_PREFIX) if(APPLE) set(my-rt) endif() - file(GLOB wine-deps "${CMAKE_SOURCE_DIR}/ftnoir_protocol_wine/*.cxx") + file(GLOB wine-deps ${CMAKE_SOURCE_DIR}/ftnoir_protocol_wine/*.cxx) add_custom_command( OUTPUT opentrack-wrapper-wine.exe.so DEPENDS ${wine-deps} - COMMAND "${SDK_WINE_PREFIX}/bin/wineg++" -g -O2 -m32 -std=c++11 -o + COMMAND ${SDK_WINE_PREFIX}/bin/wineg++ -g -O2 -m32 -std=c++11 -o opentrack-wrapper-wine.exe -I "${CMAKE_SOURCE_DIR}" - "${CMAKE_SOURCE_DIR}/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx" - "${CMAKE_SOURCE_DIR}/ftnoir_protocol_wine/opentrack-wrapper-wine-posix.cxx" - "${CMAKE_SOURCE_DIR}/ftnoir_protocol_wine/opentrack-wrapper-wine-windows.cxx" + ${CMAKE_SOURCE_DIR}/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx + ${CMAKE_SOURCE_DIR}/ftnoir_protocol_wine/opentrack-wrapper-wine-posix.cxx + ${CMAKE_SOURCE_DIR}/ftnoir_protocol_wine/opentrack-wrapper-wine-windows.cxx ${my-rt}) add_custom_target(wine-wrapper ALL DEPENDS opentrack-wrapper-wine.exe.so) add_dependencies(opentrack-proto-wine wine-wrapper) @@ -335,8 +307,8 @@ opentrack_library(opentrack-tracker-udp ftnoir_tracker_udp) opentrack_library(opentrack-tracker-freepie-udp ftnoir_tracker_freepie-udp) if(SDK_RIFT) - include_directories("${SDK_RIFT}/Include") - include_directories("${SDK_RIFT}/Src") + include_directories(${SDK_RIFT}/Include) + include_directories(${SDK_RIFT}/Src) set(link-flags) set(c-flags) if(APPLE) @@ -345,21 +317,21 @@ if(SDK_RIFT) else() set(c-flags "-fno-strict-aliasing") endif() - opentrack_library(opentrack-tracker-rift ftnoir_tracker_rift LINK "${link-flags}" COMPILE "${c-flags}") + opentrack_library(opentrack-tracker-rift ftnoir_tracker_rift LINK ${link-flags} COMPILE ${c-flags}) if(WIN32) - target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/libLibOVR.a" winmm setupapi ws2_32 imagehlp wbemuuid) + target_link_libraries(opentrack-tracker-rift ${SDK_RIFT}/libLibOVR.a winmm setupapi ws2_32 imagehlp wbemuuid) else() if(NOT APPLE) - target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/libLibOVR.a" udev Xinerama) + target_link_libraries(opentrack-tracker-rift ${SDK_RIFT}/libLibOVR.a udev Xinerama) else() - target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/libLibOVR.a") + target_link_libraries(opentrack-tracker-rift ${SDK_RIFT}/libLibOVR.a) endif() endif() endif() if(SDK_HYDRA) - include_directories("${SDK_HYDRA}/include") - include_directories("${SDK_HYDRA}/include/sixense_utils") + include_directories(${SDK_HYDRA}/include) + include_directories(${SDK_HYDRA}/include/sixense_utils) opentrack_library(opentrack-tracker-hydra ftnoir_tracker_hydra) if(WIN32) target_link_libraries(opentrack-tracker-hydra @@ -390,14 +362,17 @@ if(SDK_HYDRA) endif() endif() -if(WIN32 AND NOT SDK_CONSOLE_DEBUG) - set(opentrack-win32-executable WIN32) -else() - set(opentrack-win32-executable "") -endif() if(UNIX OR APPLE) - add_library(opentrack-qxt-mini STATIC ${qxt-mini-c}) - SET_TARGET_PROPERTIES(opentrack-qxt-mini PROPERTIES COMPILE_FLAGS "-DBUILD_QXT_CORE=42 -DBUILD_QXT_WIDGETS=42 -DBUILD_QXT_GUI=42") + # Qxt bundled :: sorry for this, but gentoo ebuild is broken + include_directories("qxt-mini/") + if(APPLE) + set(qxt-plat mac) + else() + set(qxt-plat x11) + endif() + file(GLOB qxt-mini-c qxt-mini/*.h qxt-mini/qxtglobalshortcut.cpp qxt-mini/plat/qxtglobalshortcut_${qxt-plat}.cpp) + opentrack_qt(qxt-mini) + add_library(opentrack-qxt-mini STATIC ${qxt-mini-all}) target_link_libraries(opentrack-qxt-mini ${MY_QT_LIBS}) if(NOT APPLE) target_link_libraries(opentrack-qxt-mini X11) @@ -408,9 +383,20 @@ opentrack_module(opentrack-api opentrack) opentrack_qt(opentrack-api) add_library(opentrack-api STATIC ${opentrack-api-all}) +if(WIN32 AND NOT SDK_CONSOLE_DEBUG) + set(opentrack-win32-executable WIN32) +else() + set(opentrack-win32-executable "") +endif() + opentrack_module(opentrack facetracknoir) +list(APPEND opentrack-c qxt-mini/qxtglobalshortcut.h) opentrack_qt(opentrack) add_executable(opentrack ${opentrack-win32-executable} ${opentrack-all}) + +if(NOT WIN32) + set_target_properties(opentrack PROPERTIES SUFFIX ".bin") +endif() target_link_libraries(opentrack opentrack-api opentrack-version opentrack-pose-widget opentrack-spline-widget) if(APPLE) @@ -421,7 +407,6 @@ if(UNIX OR APPLE) target_link_libraries(opentrack opentrack-qxt-mini) endif() target_link_libraries(opentrack-api ${OpenCV_LIBS} ${MY_QT_LIBS}) -include_directories(${OpenCV_INCLUDE_DIRS}) link_with_dinput8(opentrack) @@ -429,7 +414,7 @@ if(CMAKE_SYSTEM STREQUAL LINUX) link_libraries(rt) endif() -target_link_libraries(opentrack ${QXT_QXTCORE_LIB_RELEASE} ${QXT_QXTWIDGETS_LIB_RELEASE} ${MY_QT_LIBS}) +target_link_libraries(opentrack ${MY_QT_LIBS}) if(NOT WIN32) target_link_libraries(opentrack-api dl) @@ -439,18 +424,18 @@ endif() # make install -install(FILES "${CMAKE_SOURCE_DIR}/README.md" DESTINATION .) +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(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 .) diff --git a/qxt-mini/qxtglobal.h b/qxt-mini/qxtglobal.h index 7d5abfbe..fa592181 100644 --- a/qxt-mini/qxtglobal.h +++ b/qxt-mini/qxtglobal.h @@ -51,6 +51,8 @@ #define QXT_DLLEXPORT DO_NOT_USE_THIS_ANYMORE +#define QXT_STATIC + #if !defined(QXT_STATIC) && !defined(QXT_DOXYGEN_RUN) # if defined(BUILD_QXT_CORE) # define QXT_CORE_EXPORT Q_DECL_EXPORT |