summaryrefslogtreecommitdiffhomepage
path: root/compat
diff options
context:
space:
mode:
Diffstat (limited to 'compat')
-rw-r--r--compat/camera-names.cpp4
-rw-r--r--compat/camera-names.hpp4
-rw-r--r--compat/euler.cpp6
-rw-r--r--compat/euler.hpp6
-rw-r--r--compat/export.hpp28
-rw-r--r--compat/linkage-macros.hpp15
-rw-r--r--compat/linkage.hpp11
-rw-r--r--compat/nan.cpp6
-rw-r--r--compat/nan.hpp6
-rw-r--r--compat/shm.h2
-rw-r--r--compat/timer.hpp2
11 files changed, 50 insertions, 40 deletions
diff --git a/compat/camera-names.cpp b/compat/camera-names.cpp
index add8c094..22dcdd8f 100644
--- a/compat/camera-names.cpp
+++ b/compat/camera-names.cpp
@@ -17,7 +17,7 @@
#include <QDebug>
-OPENTRACK_COMPAT_EXPORT int camera_name_to_index(const QString &name)
+OTR_COMPAT_EXPORT int camera_name_to_index(const QString &name)
{
auto list = get_camera_names();
int ret = list.indexOf(name);
@@ -26,7 +26,7 @@ OPENTRACK_COMPAT_EXPORT int camera_name_to_index(const QString &name)
return ret;
}
-OPENTRACK_COMPAT_EXPORT QList<QString> get_camera_names()
+OTR_COMPAT_EXPORT QList<QString> get_camera_names()
{
QList<QString> ret;
#if defined(_WIN32)
diff --git a/compat/camera-names.hpp b/compat/camera-names.hpp
index ae0c6b25..97184c8c 100644
--- a/compat/camera-names.hpp
+++ b/compat/camera-names.hpp
@@ -13,6 +13,6 @@
#include "export.hpp"
-OPENTRACK_COMPAT_EXPORT QList<QString> get_camera_names();
-OPENTRACK_COMPAT_EXPORT int camera_name_to_index(const QString &name);
+OTR_COMPAT_EXPORT QList<QString> get_camera_names();
+OTR_COMPAT_EXPORT int camera_name_to_index(const QString &name);
diff --git a/compat/euler.cpp b/compat/euler.cpp
index a1034bc9..ab119d3e 100644
--- a/compat/euler.cpp
+++ b/compat/euler.cpp
@@ -3,7 +3,7 @@
namespace euler {
-euler_t OPENTRACK_COMPAT_EXPORT rmat_to_euler(const rmat& R)
+euler_t OTR_COMPAT_EXPORT rmat_to_euler(const rmat& R)
{
using std::atan2;
using std::sqrt;
@@ -21,7 +21,7 @@ euler_t OPENTRACK_COMPAT_EXPORT rmat_to_euler(const rmat& R)
}
// tait-bryan angles, not euler
-rmat OPENTRACK_COMPAT_EXPORT euler_to_rmat(const euler_t& input)
+rmat OTR_COMPAT_EXPORT euler_to_rmat(const euler_t& input)
{
const double H = -input(0);
const double P = -input(1);
@@ -54,7 +54,7 @@ rmat OPENTRACK_COMPAT_EXPORT euler_to_rmat(const euler_t& input)
}
// https://en.wikipedia.org/wiki/Davenport_chained_rotations#Tait.E2.80.93Bryan_chained_rotations
-void OPENTRACK_COMPAT_EXPORT tait_bryan_to_matrices(const euler_t& input,
+void OTR_COMPAT_EXPORT tait_bryan_to_matrices(const euler_t& input,
rmat& r_roll,
rmat& r_pitch,
rmat& r_yaw)
diff --git a/compat/euler.hpp b/compat/euler.hpp
index 6a1ea1a4..c50cf052 100644
--- a/compat/euler.hpp
+++ b/compat/euler.hpp
@@ -13,11 +13,11 @@ using dvec3 = Mat<double, 3, 1>;
using rmat = dmat<3, 3>;
using euler_t = dmat<3, 1>;
-rmat OPENTRACK_COMPAT_EXPORT euler_to_rmat(const euler_t& input);
+rmat OTR_COMPAT_EXPORT euler_to_rmat(const euler_t& input);
-euler_t OPENTRACK_COMPAT_EXPORT rmat_to_euler(const rmat& R);
+euler_t OTR_COMPAT_EXPORT rmat_to_euler(const rmat& R);
-void OPENTRACK_COMPAT_EXPORT tait_bryan_to_matrices(const euler_t& input,
+void OTR_COMPAT_EXPORT tait_bryan_to_matrices(const euler_t& input,
rmat& r_roll,
rmat& r_pitch,
rmat& r_yaw);
diff --git a/compat/export.hpp b/compat/export.hpp
index ba10f131..4bd6952f 100644
--- a/compat/export.hpp
+++ b/compat/export.hpp
@@ -1,27 +1,11 @@
+// generates export.hpp for each module from compat/linkage.hpp
+
#pragma once
-#ifdef BUILD_compat
-# ifdef _WIN32
-# define OPENTRACK_COMPAT_LINKAGE __declspec(dllexport)
-# else
-# define OPENTRACK_COMPAT_LINKAGE
-# endif
+#include "compat/linkage-macros.hpp"
-# ifndef _MSC_VER
-# define OPENTRACK_COMPAT_EXPORT __attribute__ ((visibility ("default"))) OPENTRACK_COMPAT_LINKAGE
-# else
-# define OPENTRACK_COMPAT_EXPORT OPENTRACK_COMPAT_LINKAGE
-# endif
+#ifdef BUILD_COMPAT
+# define OTR_COMPAT_EXPORT OTR_GENERIC_EXPORT
#else
- #ifdef _WIN32
- # define OPENTRACK_COMPAT_LINKAGE __declspec(dllimport)
- #else
- # define OPENTRACK_COMPAT_LINKAGE
- #endif
-
- #ifndef _MSC_VER
- # define OPENTRACK_COMPAT_EXPORT __attribute__ ((visibility ("default"))) OPENTRACK_COMPAT_LINKAGE
- #else
- # define OPENTRACK_COMPAT_EXPORT OPENTRACK_COMPAT_LINKAGE
- #endif
+# define OTR_COMPAT_EXPORT OTR_GENERIC_IMPORT
#endif
diff --git a/compat/linkage-macros.hpp b/compat/linkage-macros.hpp
new file mode 100644
index 00000000..b9bc9801
--- /dev/null
+++ b/compat/linkage-macros.hpp
@@ -0,0 +1,15 @@
+#pragma once
+
+#if defined _MSC_VER || defined _WIN32
+# define OTR_GENERIC_EXPORT __declspec(dllexport)
+# define OTR_GENERIC_IMPORT __declspec(dllimport)
+#else
+# define OTR_GENERIC_EXPORT __attribute__ ((visibility ("default")))
+# define OTR_GENERIC_IMPORT
+#endif
+
+#if defined _MSC_VER
+# define OTR_GENERIC_TEMPLATE
+#else
+# define OTR_GENERIC_TEMPLATE __attribute__ ((visibility ("default")))
+#endif
diff --git a/compat/linkage.hpp b/compat/linkage.hpp
new file mode 100644
index 00000000..b49da34b
--- /dev/null
+++ b/compat/linkage.hpp
@@ -0,0 +1,11 @@
+// generates export.hpp for each module from compat/linkage.hpp
+
+#pragma once
+
+#include "compat/linkage-macros.hpp"
+
+#ifdef BUILD_${module}
+# define OTR_${module}_EXPORT OTR_GENERIC_EXPORT
+#else
+# define OTR_${module}_EXPORT OTR_GENERIC_IMPORT
+#endif
diff --git a/compat/nan.cpp b/compat/nan.cpp
index 4b99fff3..9c7bf147 100644
--- a/compat/nan.cpp
+++ b/compat/nan.cpp
@@ -4,7 +4,7 @@
# include <cmath>
# define my_isnan std::isnan
# define my_isinf std::isinf
-extern "C" OPENTRACK_COMPAT_EXPORT __declspec(noinline) bool nanp(double x)
+extern "C" OTR_COMPAT_EXPORT __declspec(noinline) bool nanp(double x)
#elif defined __MINGW32__
int __cdecl my_isnan(double)__asm__("__isnan");
@@ -18,12 +18,12 @@ int __cdecl my_fpclassify(double)__asm__("___fpclassify");
#define my_isinf(x) (my_fpclassify(x) == FP_INFINITE)
-extern "C" OPENTRACK_COMPAT_EXPORT bool __attribute__ ((noinline)) nanp(double x)
+extern "C" OTR_COMPAT_EXPORT bool __attribute__ ((noinline)) nanp(double x)
#else
int my_isnan(double)__asm__("isnan");
int my_isinf(double)__asm__("isinf");
-extern "C" OPENTRACK_COMPAT_EXPORT bool __attribute__ ((noinline)) nanp(double x)
+extern "C" OTR_COMPAT_EXPORT bool __attribute__ ((noinline)) nanp(double x)
#endif
{
return my_isnan(x) || my_isinf(x);
diff --git a/compat/nan.hpp b/compat/nan.hpp
index 9926da13..0a2c900c 100644
--- a/compat/nan.hpp
+++ b/compat/nan.hpp
@@ -3,9 +3,9 @@
#include "export.hpp"
#if defined(__GNUC__)
-extern "C" OPENTRACK_COMPAT_EXPORT bool __attribute__ ((noinline)) nanp(double value);
+extern "C" OTR_COMPAT_EXPORT bool __attribute__ ((noinline)) nanp(double value);
#elif defined(_WIN32)
-extern "C" OPENTRACK_COMPAT_EXPORT __declspec(noinline) bool nanp(double value);
+extern "C" OTR_COMPAT_EXPORT __declspec(noinline) bool nanp(double value);
#else
-extern "C" OPENTRACK_COMPAT_EXPORT bool nanp(double value);
+extern "C" OTR_COMPAT_EXPORT bool nanp(double value);
#endif
diff --git a/compat/shm.h b/compat/shm.h
index f212dc17..ffd1e1dc 100644
--- a/compat/shm.h
+++ b/compat/shm.h
@@ -26,7 +26,7 @@
#include "export.hpp"
-class OPENTRACK_COMPAT_EXPORT PortableLockedShm {
+class OTR_COMPAT_EXPORT PortableLockedShm {
public:
PortableLockedShm(const char *shmName, const char *mutexName, int mapSize);
~PortableLockedShm();
diff --git a/compat/timer.hpp b/compat/timer.hpp
index 288bfb1d..e9efba79 100644
--- a/compat/timer.hpp
+++ b/compat/timer.hpp
@@ -20,7 +20,7 @@
#include <ctime>
#include <tuple>
-class OPENTRACK_COMPAT_EXPORT Timer
+class OTR_COMPAT_EXPORT Timer
{
struct timespec state;
long long conv_nsecs(const struct timespec& cur) const;