diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2015-07-25 07:27:03 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2015-07-25 07:49:19 +0200 |
commit | 24538cf3a3a91481851618791b11be81437563e4 (patch) | |
tree | 4bcc9b97721170829038fe778633382c3e8754bc | |
parent | 0f445ac2661b5454d491936bb780196b13d1f4ea (diff) |
move portability classes to compat library
29 files changed, 67 insertions, 72 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 6be4e425..e6a3afc3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,10 +112,10 @@ macro(opentrack_library n dir) set(link-mode STATIC) endif() add_library(${n} ${link-mode} ${${n}-all}) - target_link_libraries(${n} opentrack-api ${MY_QT_LIBS}) + target_link_libraries(${n} opentrack-api ${MY_QT_LIBS} opentrack-compat) if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE) SET_TARGET_PROPERTIES(${n} PROPERTIES - LINK_FLAGS "${foolib_LINK} ${foolib_GNU-LINK} -Wl,--as-needed -Wl,--version-script=\"${CMAKE_SOURCE_DIR}/opentrack/${version-script}-version-script.txt\"" + LINK_FLAGS "${foolib_LINK} ${foolib_GNU-LINK} -Wl,--as-needed -Wl,--version-script=\"${CMAKE_SOURCE_DIR}/opentrack-compat/${version-script}-version-script.txt\"" COMPILE_FLAGS "${foolib_COMPILE} ${foolib_GNU-COMPILE} -fvisibility=hidden -fvisibility-inlines-hidden" ) else() @@ -125,7 +125,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) @@ -194,13 +196,19 @@ opentrack_qt(opentrack-api) add_library(opentrack-api STATIC ${opentrack-api-all}) opentrack_compat(opentrack-api) target_link_libraries(opentrack-api ${MY_QT_LIBS}) - if(NOT WIN32) target_link_libraries(opentrack-api dl) else() target_link_libraries(opentrack-api winmm) endif() +opentrack_module(opentrack-compat opentrack-compat) +add_library(opentrack-compat STATIC ${opentrack-compat-c}) +opentrack_compat(opentrack-compat) # uh... +if(NOT WIN32 AND NOT APPLE) + target_link_libraries(opentrack-compat rt) +endif() + # ---- # conditional targets @@ -217,7 +225,6 @@ if(WIN32) ENABLE_LANGUAGE(RC) endif(WIN32) -opentrack_module(opentrack-compat compat) opentrack_module(opentrack-xplane-plugin x-plane-plugin) if(SDK_XPLANE) @@ -244,12 +251,6 @@ if(SDK_XPLANE) endif() endif() -add_library(opentrack-compat STATIC ${opentrack-compat-c}) -opentrack_compat(opentrack-compat) # uh... -if(NOT WIN32 AND NOT APPLE) - target_link_libraries(opentrack-compat rt) -endif() - opentrack_module(opentrack-csv csv) add_library(opentrack-csv STATIC ${opentrack-csv-c}) opentrack_compat(opentrack-csv) @@ -377,7 +378,7 @@ if(OpenCV_FOUND) 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} ${OpenCV_LIBS}) + target_link_libraries(opentrack-tracker-ht ${SDK_HT} ${SDK_HT_FLANDMARK} ${OpenCV_LIBS}) link_with_dinput8(opentrack-tracker-ht) target_include_directories(opentrack-tracker-ht SYSTEM PUBLIC ${OpenCV_INCLUDE_DIRS}) endif() diff --git a/facetracknoir/facetracknoir.rc b/facetracknoir/facetracknoir.rc index 655baa9d..020ffe97 100644 --- a/facetracknoir/facetracknoir.rc +++ b/facetracknoir/facetracknoir.rc @@ -1,2 +1,2 @@ -#include <windows.h>
-IDI_ICON1 ICON "facetracknoir.ico"
+#include <windows.h> +IDI_ICON1 ICON "facetracknoir.ico" diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.h b/ftnoir_filter_accela/ftnoir_filter_accela.h index 54845bfe..318cf909 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.h +++ b/ftnoir_filter_accela/ftnoir_filter_accela.h @@ -14,7 +14,7 @@ #include "opentrack/options.hpp" using namespace options; -#include "opentrack/timer.hpp" +#include "opentrack-compat/timer.hpp" struct settings_accela : opts { value<int> rot_threshold, trans_threshold, ewma, rot_deadzone, trans_deadzone; diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.h b/ftnoir_protocol_ft/ftnoir_protocol_ft.h index f80a511b..6010de90 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft.h +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft.h @@ -44,7 +44,7 @@ #include <QString> #include <QMutex> #include <QMutexLocker> -#include "compat/compat.h" +#include "opentrack-compat/shm.h" #include "opentrack/options.hpp" #include "freetrackclient/fttypes.h" using namespace options; diff --git a/ftnoir_protocol_sc/scserver.manifest b/ftnoir_protocol_sc/scserver.manifest index 60311d6e..d342cfda 100644 --- a/ftnoir_protocol_sc/scserver.manifest +++ b/ftnoir_protocol_sc/scserver.manifest @@ -1,13 +1,13 @@ -<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
-<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
- <dependency>
- <dependentAssembly>
- <assemblyIdentity type='win32' name='Microsoft.FlightSimulator.SimConnect' version='10.0.61259.0' processorArchitecture='x86' publicKeyToken='67c7c14424d61b5b' />
- </dependentAssembly>
- </dependency>
- <dependency>
- <dependentAssembly>
- <assemblyIdentity type='win32' name='Microsoft.VC80.CRT' version='8.0.50608.0' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
- </dependentAssembly>
- </dependency>
-</assembly>
+<?xml version='1.0' encoding='UTF-8' standalone='yes'?> +<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'> + <dependency> + <dependentAssembly> + <assemblyIdentity type='win32' name='Microsoft.FlightSimulator.SimConnect' version='10.0.61259.0' processorArchitecture='x86' publicKeyToken='67c7c14424d61b5b' /> + </dependentAssembly> + </dependency> + <dependency> + <dependentAssembly> + <assemblyIdentity type='win32' name='Microsoft.VC80.CRT' version='8.0.50608.0' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' /> + </dependentAssembly> + </dependency> +</assembly> diff --git a/ftnoir_protocol_wine/ftnoir_protocol_wine.h b/ftnoir_protocol_wine/ftnoir_protocol_wine.h index 528c4dd3..72897f1f 100644 --- a/ftnoir_protocol_wine/ftnoir_protocol_wine.h +++ b/ftnoir_protocol_wine/ftnoir_protocol_wine.h @@ -9,7 +9,7 @@ #include <QMutexLocker> #include <QFile> #include "opentrack/plugin-api.hpp" -#include "compat/compat.h" +#include "opentrack-compat/shm.h" #include "ftnoir_protocol_wine/wine-shm.h" class FTNoIR_Protocol : public IProtocol diff --git a/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx b/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx index 026135f0..ffe8938d 100644 --- a/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx +++ b/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx @@ -6,13 +6,13 @@ #include <cstdio> #include "freetrackclient/fttypes.h" #include "ftnoir_protocol_wine/wine-shm.h" -#include "opentrack/export.hpp" +#include "opentrack-compat/export.hpp" enum Axis { TX = 0, TY, TZ, Yaw, Pitch, Roll }; -#include "compat/compat.h" +#include "opentrack-compat/shm.h" void create_registry_key(void); diff --git a/ftnoir_protocol_wine/opentrack-wrapper-wine-posix.cxx b/ftnoir_protocol_wine/opentrack-wrapper-wine-posix.cxx index 6f43f899..50cce728 100644 --- a/ftnoir_protocol_wine/opentrack-wrapper-wine-posix.cxx +++ b/ftnoir_protocol_wine/opentrack-wrapper-wine-posix.cxx @@ -3,5 +3,5 @@ #endif #define PortableLockedShm ShmPosix -#include "compat/compat.h" -#include "compat/compat.cpp" +#include "opentrack-compat/shm.h" +#include "opentrack-compat/shm.cpp" diff --git a/ftnoir_protocol_wine/opentrack-wrapper-wine-windows.cxx b/ftnoir_protocol_wine/opentrack-wrapper-wine-windows.cxx index 6592fbe6..19ee8ffd 100644 --- a/ftnoir_protocol_wine/opentrack-wrapper-wine-windows.cxx +++ b/ftnoir_protocol_wine/opentrack-wrapper-wine-windows.cxx @@ -3,8 +3,8 @@ #endif #define PortableLockedShm ShmWine -#include "compat/compat.h" -#include "compat/compat.cpp" +#include "opentrack-compat/shm.h" +#include "opentrack-compat/shm.cpp" #include "wine-shm.h" static void write_path(const char* key, const char* subkey) diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 05f3e3a4..08ddd3b2 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -17,7 +17,7 @@ #include <opencv2/highgui/highgui.hpp> #include <opencv2/videoio.hpp> #include "opentrack/camera-names.hpp" -#include "opentrack/sleep.hpp" +#include "opentrack-compat/sleep.hpp" typedef struct { int width; diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp index ad13d716..cc9d2ba1 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp @@ -4,7 +4,7 @@ #include "opentrack/plugin-api.hpp" #include <cmath> #include "opentrack/camera-names.hpp" -#include "opentrack/sleep.hpp" +#include "opentrack-compat/sleep.hpp" typedef struct { int width; diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.h b/ftnoir_tracker_ht/ftnoir_tracker_ht.h index 32fb6949..16fdbe5c 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.h +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.h @@ -10,7 +10,7 @@ #include "headtracker-ftnoir.h" #include "ui_ht-trackercontrols.h" #include "ht_video_widget.h" -#include "compat/compat.h" +#include "opentrack-compat/shm.h" #include <QObject> #include "opentrack/options.hpp" #include "opentrack/plugin-api.hpp" diff --git a/ftnoir_tracker_pt/camera.cpp b/ftnoir_tracker_pt/camera.cpp index 4619f695..9e11b815 100644 --- a/ftnoir_tracker_pt/camera.cpp +++ b/ftnoir_tracker_pt/camera.cpp @@ -8,7 +8,7 @@ #include "camera.h" #include <string> #include <QDebug> -#include "opentrack/sleep.hpp" +#include "opentrack-compat/sleep.hpp" void Camera::set_device_index(int index) { diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.h b/ftnoir_tracker_pt/ftnoir_tracker_pt.h index b303a913..3291c7fc 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.h +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.h @@ -14,7 +14,7 @@ #include "point_extractor.h" #include "point_tracker.h" #include "pt_video_widget.h" -#include "opentrack/timer.hpp" +#include "opentrack-compat/timer.hpp" #include "opentrack/opencv-camera-dialog.hpp" #include <QThread> diff --git a/ftnoir_tracker_pt/point_extractor.cpp b/ftnoir_tracker_pt/point_extractor.cpp index 4791dcc2..7174d719 100644 --- a/ftnoir_tracker_pt/point_extractor.cpp +++ b/ftnoir_tracker_pt/point_extractor.cpp @@ -9,7 +9,7 @@ #include <QDebug> #ifdef DEBUG_EXTRACTION -# include "opentrack/timer.hpp" +# include "opentrack-compat/timer.hpp" #endif PointExtractor::PointExtractor(){ diff --git a/ftnoir_tracker_pt/point_tracker.h b/ftnoir_tracker_pt/point_tracker.h index 7c710704..323eade4 100644 --- a/ftnoir_tracker_pt/point_tracker.h +++ b/ftnoir_tracker_pt/point_tracker.h @@ -15,7 +15,7 @@ # include <memory> #endif #include <vector> -#include "opentrack/timer.hpp" +#include "opentrack-compat/timer.hpp" #include "ftnoir_tracker_pt_settings.h" #include <QObject> diff --git a/opentrack/export.hpp b/opentrack-compat/export.hpp index f0983b75..f0983b75 100644 --- a/opentrack/export.hpp +++ b/opentrack-compat/export.hpp diff --git a/opentrack/mingw-version-script.txt b/opentrack-compat/mingw-version-script.txt index fe20ad37..fe20ad37 100644 --- a/opentrack/mingw-version-script.txt +++ b/opentrack-compat/mingw-version-script.txt diff --git a/opentrack/posix-version-script.txt b/opentrack-compat/posix-version-script.txt index 97edb9aa..97edb9aa 100644 --- a/opentrack/posix-version-script.txt +++ b/opentrack-compat/posix-version-script.txt diff --git a/opentrack/qcopyable-mutex.hpp b/opentrack-compat/qcopyable-mutex.hpp index f7f36f93..f7f36f93 100644 --- a/opentrack/qcopyable-mutex.hpp +++ b/opentrack-compat/qcopyable-mutex.hpp diff --git a/compat/compat.cpp b/opentrack-compat/shm.cpp index 9000b453..b18a9933 100644 --- a/compat/compat.cpp +++ b/opentrack-compat/shm.cpp @@ -6,7 +6,7 @@ */ #include <cstring> -#include "compat.h" +#include "shm.h" #if defined(_WIN32) PortableLockedShm::PortableLockedShm(const char* shmName, const char* mutexName, int mapSize) diff --git a/compat/compat.h b/opentrack-compat/shm.h index 17a0d843..17a0d843 100644 --- a/compat/compat.h +++ b/opentrack-compat/shm.h diff --git a/opentrack/sleep.hpp b/opentrack-compat/sleep.hpp index 27920842..27920842 100644 --- a/opentrack/sleep.hpp +++ b/opentrack-compat/sleep.hpp diff --git a/opentrack/timer.hpp b/opentrack-compat/timer.hpp index fd710499..fd710499 100644 --- a/opentrack/timer.hpp +++ b/opentrack-compat/timer.hpp diff --git a/opentrack/plugin-api.hpp b/opentrack/plugin-api.hpp index b0da4950..572b7f31 100644 --- a/opentrack/plugin-api.hpp +++ b/opentrack/plugin-api.hpp @@ -8,7 +8,7 @@ #pragma once -#include "export.hpp" +#include "../opentrack-compat/export.hpp" #include <QString> #include <QWidget> #include <QFrame> @@ -59,7 +59,7 @@ struct IFilter // optional destructor virtual ~IFilter() {} // perform filtering step. - // you have to take care of dt on your own, try "opentrack/timer.hpp" + // you have to take care of dt on your own, try "opentrack-compat/timer.hpp" virtual void filter(const double *input, double *output) = 0; }; diff --git a/opentrack/pose.hpp b/opentrack/pose.hpp deleted file mode 100644 index 93d467a9..00000000 --- a/opentrack/pose.hpp +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -#include <utility> -#include <algorithm> -#include "./plugin-api.hpp" - -class Pose { -private: - static constexpr double pi = 3.141592653; - static constexpr double d2r = pi/180.0; - static constexpr double r2d = 180./pi; - - double axes[6]; -public: - Pose() : axes {0,0,0, 0,0,0} {} - - inline operator double*() { return axes; } - inline operator const double*() const { return axes; } - - inline double& operator()(int i) { return axes[i]; } - inline double operator()(int i) const { return axes[i]; } -}; diff --git a/opentrack/tracker.h b/opentrack/tracker.h index 453357c4..c5c39797 100644 --- a/opentrack/tracker.h +++ b/opentrack/tracker.h @@ -10,10 +10,9 @@ #include <vector> -#include "timer.hpp" +#include "opentrack-compat/timer.hpp" #include "plugin-support.hpp" #include "mappings.hpp" -#include "pose.hpp" #include "simple-mat.hpp" #include "selected-libraries.hpp" @@ -24,6 +23,23 @@ #include <QMutex> #include <QThread> +class Pose { +private: + static constexpr double pi = 3.141592653; + static constexpr double d2r = pi/180.0; + static constexpr double r2d = 180./pi; + + double axes[6]; +public: + Pose() : axes {0,0,0, 0,0,0} {} + + inline operator double*() { return axes; } + inline operator const double*() const { return axes; } + + inline double& operator()(int i) { return axes[i]; } + inline double operator()(int i) const { return axes[i]; } +}; + class Tracker : private QThread { Q_OBJECT private: diff --git a/opentrack/version.cc b/opentrack/version.cc index 026ad057..13bc5dc5 100644 --- a/opentrack/version.cc +++ b/opentrack/version.cc @@ -1,4 +1,4 @@ -#include "opentrack/export.hpp" +#include "opentrack-compat/export.hpp" #ifdef __cplusplus extern "C" diff --git a/qfunctionconfigurator/functionconfig.h b/qfunctionconfigurator/functionconfig.h index 7ead2c5d..a8b46597 100644 --- a/qfunctionconfigurator/functionconfig.h +++ b/qfunctionconfigurator/functionconfig.h @@ -14,7 +14,7 @@ #include <QSettings> #include <QMutex> #include <vector> -#include "opentrack/qcopyable-mutex.hpp" +#include "opentrack-compat/qcopyable-mutex.hpp" class Map { private: |