summaryrefslogtreecommitdiffhomepage
path: root/opentrack-compat
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-09-20 21:24:40 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-09-20 23:24:17 +0200
commit88e4563455ca183e1b77364b73d5e6173af513d3 (patch)
treeb63fcee5e953c876886cf6c2bdeaf2738ee0c795 /opentrack-compat
parent06b68ac493f06723d123db5fa23b8c0a86ca7f66 (diff)
api, compat: backport exports fix
Diffstat (limited to 'opentrack-compat')
-rw-r--r--opentrack-compat/camera-names.hpp6
-rw-r--r--opentrack-compat/compat-export.hpp15
-rw-r--r--opentrack-compat/compat-import.hpp15
-rw-r--r--opentrack-compat/export.hpp22
-rw-r--r--opentrack-compat/options.hpp18
-rw-r--r--opentrack-compat/shm.h7
-rw-r--r--opentrack-compat/sleep.hpp6
7 files changed, 29 insertions, 60 deletions
diff --git a/opentrack-compat/camera-names.hpp b/opentrack-compat/camera-names.hpp
index c2879000..ae0c6b25 100644
--- a/opentrack-compat/camera-names.hpp
+++ b/opentrack-compat/camera-names.hpp
@@ -11,11 +11,7 @@
#include <QList>
#include <QString>
-#ifdef BUILD_compat
-# include "compat-export.hpp"
-#else
-# include "compat-import.hpp"
-#endif
+#include "export.hpp"
OPENTRACK_COMPAT_EXPORT QList<QString> get_camera_names();
OPENTRACK_COMPAT_EXPORT int camera_name_to_index(const QString &name);
diff --git a/opentrack-compat/compat-export.hpp b/opentrack-compat/compat-export.hpp
deleted file mode 100644
index 2d6f1d3d..00000000
--- a/opentrack-compat/compat-export.hpp
+++ /dev/null
@@ -1,15 +0,0 @@
-#pragma once
-
-#ifndef OPENTRACK_COMPAT_EXPORT
-# ifdef _WIN32
-# define OPENTRACK_COMPAT_LINKAGE __declspec(dllexport)
-# 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
-#endif
diff --git a/opentrack-compat/compat-import.hpp b/opentrack-compat/compat-import.hpp
deleted file mode 100644
index 161ccc5d..00000000
--- a/opentrack-compat/compat-import.hpp
+++ /dev/null
@@ -1,15 +0,0 @@
-#pragma once
-
-#ifndef OPENTRACK_COMPAT_EXPORT
-# 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
-#endif
diff --git a/opentrack-compat/export.hpp b/opentrack-compat/export.hpp
index 100950a0..ba10f131 100644
--- a/opentrack-compat/export.hpp
+++ b/opentrack-compat/export.hpp
@@ -1,15 +1,27 @@
#pragma once
-#ifndef OPENTRACK_EXPORT
+#ifdef BUILD_compat
# ifdef _WIN32
-# define OPENTRACK_LINKAGE __declspec(dllexport)
+# define OPENTRACK_COMPAT_LINKAGE __declspec(dllexport)
# else
-# define OPENTRACK_LINKAGE
+# define OPENTRACK_COMPAT_LINKAGE
# endif
# ifndef _MSC_VER
-# define OPENTRACK_EXPORT __attribute__ ((visibility ("default"))) OPENTRACK_LINKAGE
+# define OPENTRACK_COMPAT_EXPORT __attribute__ ((visibility ("default"))) OPENTRACK_COMPAT_LINKAGE
# else
-# define OPENTRACK_EXPORT OPENTRACK_LINKAGE
+# define OPENTRACK_COMPAT_EXPORT OPENTRACK_COMPAT_LINKAGE
# endif
+#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
#endif
diff --git a/opentrack-compat/options.hpp b/opentrack-compat/options.hpp
index a317a1f7..8485c167 100644
--- a/opentrack-compat/options.hpp
+++ b/opentrack-compat/options.hpp
@@ -37,11 +37,7 @@
#include <memory>
-#ifdef BUILD_compat
-# include "compat-export.hpp"
-#else
-# include "compat-import.hpp"
-#endif
+#include "export.hpp"
template<typename t> using mem = std::shared_ptr<t>;
@@ -131,7 +127,7 @@ namespace options {
bool contains(const QString& name);
void save();
bool modifiedp();
-
+
template<typename t>
t get(const QString& name)
{
@@ -160,12 +156,12 @@ namespace options {
pbundle bundle(const k& key);
void bundle_decf(const k& key);
};
-
+
OPENTRACK_COMPAT_EXPORT opt_singleton& singleton();
}
-
+
using pbundle = std::shared_ptr<opt_bundle>;
-
+
static inline pbundle bundle(const QString name) { return detail::singleton().bundle(name); }
class OPENTRACK_COMPAT_EXPORT opt_bundle : public impl_bundle
@@ -238,7 +234,7 @@ namespace options {
private:
t def;
};
-
+
struct OPENTRACK_COMPAT_EXPORT opts
{
pbundle b;
@@ -314,7 +310,7 @@ namespace options {
lb->setText(v);
base_value::connect(&v, SIGNAL(valueChanged(QString)), lb, SLOT(setText(QString)), v.SAFE_CONNTYPE);
}
-
+
template<>
inline void tie_setting(value<int>& v, QTabWidget* t)
{
diff --git a/opentrack-compat/shm.h b/opentrack-compat/shm.h
index 3edb0080..e41daaef 100644
--- a/opentrack-compat/shm.h
+++ b/opentrack-compat/shm.h
@@ -24,11 +24,8 @@
# pragma GCC diagnostic ignored "-Wattributes"
#endif
-#ifdef BUILD_compat
-# include "compat-export.hpp"
-#else
-# include "compat-import.hpp"
-#endif
+#include "export.hpp"
+
class OPENTRACK_COMPAT_EXPORT PortableLockedShm {
public:
diff --git a/opentrack-compat/sleep.hpp b/opentrack-compat/sleep.hpp
index e7c70285..0a551dcc 100644
--- a/opentrack-compat/sleep.hpp
+++ b/opentrack-compat/sleep.hpp
@@ -5,16 +5,14 @@ namespace portable
#ifdef _WIN32
# include <windows.h>
- template<typename = void>
- void sleep(unsigned milliseconds)
+ inline void sleep(unsigned milliseconds)
{
Sleep(milliseconds);
}
#else
#include <unistd.h>
- template<typename = void>
- void sleep(unsigned milliseconds)
+ inline void sleep(unsigned milliseconds)
{
usleep(milliseconds * 1000U); // takes microseconds
}