summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt4
-rw-r--r--cmake/opentrack-install.cmake10
-rw-r--r--cmake/opentrack-macros.cmake7
-rw-r--r--cmake/opentrack-platform.cmake7
-rw-r--r--csv/CMakeLists.txt5
-rw-r--r--csv/csv.cpp1
-rw-r--r--csv/csv.h9
-rw-r--r--gui/CMakeLists.txt24
-rw-r--r--macosx/CMakeLists.txt9
-rw-r--r--macosx/make-app-bundle.sh1
-rw-r--r--opentrack-compat/CMakeLists.txt2
-rw-r--r--opentrack-compat/shm.h29
-rw-r--r--opentrack/CMakeLists.txt8
-rw-r--r--pose-widget/CMakeLists.txt7
-rw-r--r--pose-widget/glwidget.h9
-rw-r--r--qxt-mini/CMakeLists.txt9
-rw-r--r--qxt-mini/qxtglobal.h6
-rw-r--r--qxt-mini/qxtglobalshortcut.cpp1
-rw-r--r--qxt-mini/qxtglobalshortcut_mac.cpp1
-rw-r--r--qxt-mini/qxtglobalshortcut_x11.cpp3
-rw-r--r--spline-widget/CMakeLists.txt7
-rw-r--r--spline-widget/functionconfig.cpp2
-rw-r--r--spline-widget/functionconfig.h9
-rw-r--r--spline-widget/qfunctionconfigurator.h4
24 files changed, 109 insertions, 65 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d0c39dda..00b9bcdc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,9 +4,9 @@ cmake_minimum_required(VERSION 2.8.11)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/)
include(CMakeParseArguments)
include(opentrack-policy)
+include(opentrack-qt)
include(opentrack-platform)
include(opentrack-macros)
-include(opentrack-qt)
include(opentrack-version)
include(opentrack-tarball)
include(opentrack-install)
@@ -22,6 +22,8 @@ file(GLOB opentrack-subprojects
"csv/${C}"
"pose-widget/${C}"
"spline-widget/${C}"
+ "macosx/${C}"
+ "qxt-mini/${C}"
)
foreach(i ${opentrack-subprojects})
get_filename_component(i ${i} DIRECTORY)
diff --git a/cmake/opentrack-install.cmake b/cmake/opentrack-install.cmake
index 53ede730..ade8861a 100644
--- a/cmake/opentrack-install.cmake
+++ b/cmake/opentrack-install.cmake
@@ -15,13 +15,3 @@ install(FILES
"${CMAKE_SOURCE_DIR}/bin/NPClient64.dll"
"${CMAKE_SOURCE_DIR}/bin/TrackIR.exe"
DESTINATION . ${opentrack-perms})
-
-if(APPLE)
- install(CODE "
- execute_process(COMMAND /bin/sh \"${CMAKE_SOURCE_DIR}/macosx/make-app-bundle.sh\"
- \"${CMAKE_SOURCE_DIR}/macosx\"
- \"${CMAKE_INSTALL_PREFIX}\"
- \"${CMAKE_BINARY_DIR}\"
- \"${OPENTRACK_COMMIT}\")
- ")
-endif()
diff --git a/cmake/opentrack-macros.cmake b/cmake/opentrack-macros.cmake
index df19ddf0..e43dc3b5 100644
--- a/cmake/opentrack-macros.cmake
+++ b/cmake/opentrack-macros.cmake
@@ -50,9 +50,10 @@ macro(opentrack_library n dir)
add_library(${n} ${link-mode} ${${n}-all})
set(link-mode)
if(NOT opentrack-foolib_NO-COMPAT)
- target_link_libraries(${n} opentrack-api ${MY_QT_LIBS} opentrack-compat)
+ target_link_libraries(${n} opentrack-api opentrack-compat)
endif()
- if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE AND NOT NO-LINKER-SCRIPT)
+ target_link_libraries(${n} ${MY_QT_LIBS})
+ if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE AND NOT opentrack-foolib_NO-LINKER-SCRIPT)
SET_TARGET_PROPERTIES(${n} PROPERTIES
LINK_FLAGS "${opentrack-foolib_LINK} ${opentrack-foolib_GNU-LINK} -Wl,--as-needed -Wl,--version-script=\"${CMAKE_SOURCE_DIR}/opentrack-compat/${version-script}-version-script.txt\""
COMPILE_FLAGS "${opentrack-foolib_COMPILE} ${opentrack-foolib_GNU-COMPILE} -fvisibility=hidden -fvisibility-inlines-hidden"
@@ -65,6 +66,8 @@ macro(opentrack_library n dir)
set_target_properties(${n} PROPERTIES LINK_FLAGS "${link-flags} ${opentrack-foolib_LINK}" COMPILE_FLAGS "${opentrack-foolib_COMPILE}")
set(link-flags)
endif()
+ string(REPLACE "-" "_" n_ ${n})
+ target_compile_definitions(${n} PRIVATE "BUILD_${n_}")
if(NOT opentrack-foolib_STATIC)
install(TARGETS ${n} RUNTIME DESTINATION . LIBRARY DESTINATION .)
endif()
diff --git a/cmake/opentrack-platform.cmake b/cmake/opentrack-platform.cmake
index aac3a2b8..c659e4c0 100644
--- a/cmake/opentrack-platform.cmake
+++ b/cmake/opentrack-platform.cmake
@@ -58,3 +58,10 @@ if(CMAKE_COMPILER_IS_GNUCXX OR APPLE)
endif()
set_property(GLOBAL PROPERTY USE_FOLDERS OFF)
+
+# nix -rdynamic passed from Linux-GNU.cmake
+if(CMAKE_COMPILER_IS_GNUCXX)
+ set(__LINUX_COMPILER_GNU 1)
+ set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS)
+ set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS)
+endif()
diff --git a/csv/CMakeLists.txt b/csv/CMakeLists.txt
index 07dae55c..7e80317c 100644
--- a/csv/CMakeLists.txt
+++ b/csv/CMakeLists.txt
@@ -1,4 +1 @@
-opentrack_boilerplate(opentrack-csv NO-LIBRARY)
-add_library(opentrack-csv STATIC ${opentrack-csv-c})
-opentrack_compat(opentrack-csv)
-target_link_libraries(opentrack-csv ${MY_QT_LIBS})
+opentrack_boilerplate(opentrack-csv NO-LINKER-SCRIPT)
diff --git a/csv/csv.cpp b/csv/csv.cpp
index 2193ed80..26a36b70 100644
--- a/csv/csv.cpp
+++ b/csv/csv.cpp
@@ -8,7 +8,6 @@
* purpose with or without fee is hereby granted, provided that the above *
* copyright notice and this permission notice appear in all copies. *
*/
-#define INSIDE_CSV
#include "csv.h"
#include <QTextDecoder>
#include <QFile>
diff --git a/csv/csv.h b/csv/csv.h
index a896a076..7ae1ad5c 100644
--- a/csv/csv.h
+++ b/csv/csv.h
@@ -1,4 +1,5 @@
#pragma once
+#include <QtGlobal>
#include <QObject>
#include <QStringList>
#include <QIODevice>
@@ -6,7 +7,13 @@
#include <QRegExp>
#include <QtGlobal>
-class CSV
+#ifdef BUILD_opentrack_csv
+# define CSV_EXPORT Q_DECL_EXPORT
+#else
+# define CSV_EXPORT Q_DECL_IMPORT
+#endif
+
+class CSV_EXPORT CSV
{
public:
QString readLine();
diff --git a/gui/CMakeLists.txt b/gui/CMakeLists.txt
index d9d718ed..f56641fb 100644
--- a/gui/CMakeLists.txt
+++ b/gui/CMakeLists.txt
@@ -14,32 +14,21 @@ opentrack_qt(opentrack)
add_executable(opentrack ${opentrack-win32-executable} ${opentrack-all})
opentrack_compat(opentrack)
-
-if(UNIX OR APPLE)
- target_include_directories(opentrack PRIVATE "${CMAKE_SOURCE_DIR}/qxt-mini")
- opentrack_library(opentrack-qxt-mini ${CMAKE_SOURCE_DIR}/qxt-mini NO-LINKER-SCRIPT STATIC)
- if(NOT APPLE)
- target_link_libraries(opentrack-qxt-mini X11)
- endif()
-endif()
-
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
+ opentrack-spline-widget
+ opentrack-pose-widget
+ opentrack-api
+ opentrack-compat
+ opentrack-version
+ # trackhat
opentrack-tracker-pt opentrack-filter-accela
)
-if(APPLE)
- SET_TARGET_PROPERTIES(opentrack-qxt-mini PROPERTIES LINK_FLAGS "-framework Carbon -framework CoreFoundation")
-endif()
-if(UNIX OR APPLE)
- target_link_libraries(opentrack opentrack-qxt-mini)
-endif()
link_with_dinput8(opentrack)
-target_link_libraries(opentrack ${MY_QT_LIBS})
if(APPLE)
# for process detector
@@ -47,6 +36,7 @@ if(APPLE)
endif()
if(LINUX)
+ target_link_libraries(opentrack dl)
# for process detector
target_link_libraries(opentrack procps)
endif()
diff --git a/macosx/CMakeLists.txt b/macosx/CMakeLists.txt
new file mode 100644
index 00000000..214ea676
--- /dev/null
+++ b/macosx/CMakeLists.txt
@@ -0,0 +1,9 @@
+if(APPLE)
+ install(CODE "
+ execute_process(COMMAND /bin/sh \"${CMAKE_SOURCE_DIR}/macosx/make-app-bundle.sh\"
+ \"${CMAKE_SOURCE_DIR}/macosx\"
+ \"${CMAKE_INSTALL_PREFIX}\"
+ \"${CMAKE_BINARY_DIR}\"
+ \"${OPENTRACK_COMMIT}\")
+ ")
+endif()
diff --git a/macosx/make-app-bundle.sh b/macosx/make-app-bundle.sh
index b8234443..ed7dbd39 100644
--- a/macosx/make-app-bundle.sh
+++ b/macosx/make-app-bundle.sh
@@ -14,6 +14,7 @@ test -n "$version" || exit 1
tmp="$(mktemp -d "/tmp/$APPNAME-tmp.XXXXXXX")"
test $? -eq 0 || exit 1
+rm -f -- "$install/.DS_Store"
sh "$dir/install-fail-tool" "$install"
cp -R "$dir/opentrack.app" "$tmp/" || exit 1
diff --git a/opentrack-compat/CMakeLists.txt b/opentrack-compat/CMakeLists.txt
index 4f5fd724..a92f4f31 100644
--- a/opentrack-compat/CMakeLists.txt
+++ b/opentrack-compat/CMakeLists.txt
@@ -1,4 +1,4 @@
-opentrack_boilerplate(opentrack-compat STATIC NO-COMPAT)
+opentrack_boilerplate(opentrack-compat NO-COMPAT NO-LINKER-SCRIPT)
if(NOT WIN32 AND NOT APPLE)
target_link_libraries(opentrack-compat rt)
endif()
diff --git a/opentrack-compat/shm.h b/opentrack-compat/shm.h
index 17a0d843..c74534e7 100644
--- a/opentrack-compat/shm.h
+++ b/opentrack-compat/shm.h
@@ -19,7 +19,32 @@
#include <sys/types.h>
#endif
-class PortableLockedShm {
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wattributes"
+
+#ifdef __GNUC__
+# define COMPAT_GNUC_VISIBILITY __attribute__ ((visibility ("default")))
+#else
+# define COMPAT_GNUC_VISIBILITY
+#endif
+
+#ifdef BUILD_opentrack_compat
+# ifdef _WIN32
+# define COMPAT_WIN32_EXPORT __declspec(dllexport)
+# else
+# define COMPAT_WIN32_EXPORT
+# endif
+#else
+# ifdef _WIN32
+# define COMPAT_WIN32_EXPORT __declspec(dllimport)
+# else
+# define COMPAT_WIN32_EXPORT
+# endif
+#endif
+
+#define COMPAT_EXPORT COMPAT_WIN32_EXPORT COMPAT_GNUC_VISIBILITY
+
+class COMPAT_EXPORT PortableLockedShm {
public:
PortableLockedShm(const char *shmName, const char *mutexName, int mapSize);
~PortableLockedShm();
@@ -35,3 +60,5 @@ private:
int fd, size;
#endif
};
+
+#pragma GCC diagnostic pop
diff --git a/opentrack/CMakeLists.txt b/opentrack/CMakeLists.txt
index 4581f394..590eaca5 100644
--- a/opentrack/CMakeLists.txt
+++ b/opentrack/CMakeLists.txt
@@ -1,10 +1,6 @@
-opentrack_boilerplate(opentrack-api NO-LIBRARY)
-opentrack_qt(opentrack-api)
-add_library(opentrack-api STATIC ${opentrack-api-all})
-opentrack_compat(opentrack-api)
-target_link_libraries(opentrack-api ${MY_QT_LIBS})
+opentrack_boilerplate(opentrack-api NO-LINKER-SCRIPT NO-COMPAT)
if(NOT WIN32)
- target_link_libraries(opentrack-api dl)
+ target_link_libraries(opentrack-api opentrack-qxt-mini opentrack-compat dl)
else()
target_link_libraries(opentrack-api winmm)
endif()
diff --git a/pose-widget/CMakeLists.txt b/pose-widget/CMakeLists.txt
index 66891c21..66cafef7 100644
--- a/pose-widget/CMakeLists.txt
+++ b/pose-widget/CMakeLists.txt
@@ -1,6 +1 @@
-opentrack_boilerplate(opentrack-pose-widget NO-LIBRARY)
-opentrack_qt(opentrack-pose-widget)
-add_library(opentrack-pose-widget STATIC ${opentrack-pose-widget-all})
-opentrack_compat(opentrack-pose-widget)
-target_include_directories(opentrack-pose-widget PUBLIC pose-widget/) # else Qt moc breaks
-target_link_libraries(opentrack-pose-widget ${MY_QT_LIBS})
+opentrack_boilerplate(opentrack-pose-widget NO-LINKER-SCRIPT)
diff --git a/pose-widget/glwidget.h b/pose-widget/glwidget.h
index 81517399..fca3502d 100644
--- a/pose-widget/glwidget.h
+++ b/pose-widget/glwidget.h
@@ -7,12 +7,19 @@
#pragma once
+#include <QtGlobal>
#include <QWidget>
#include <QPixmap>
#include "opentrack/plugin-api.hpp"
#include "opentrack/simple-mat.hpp"
-class GLWidget : public QWidget
+#ifdef BUILD_opentrack_pose_widget
+# define POSE_WIDGET_EXPORT Q_DECL_EXPORT
+#else
+# define POSE_WIDGET_EXPORT Q_DECL_IMPORT
+#endif
+
+class POSE_WIDGET_EXPORT GLWidget : public QWidget
{
public:
using num = float;
diff --git a/qxt-mini/CMakeLists.txt b/qxt-mini/CMakeLists.txt
new file mode 100644
index 00000000..5de29cd1
--- /dev/null
+++ b/qxt-mini/CMakeLists.txt
@@ -0,0 +1,9 @@
+if(UNIX OR APPLE)
+ opentrack_boilerplate(opentrack-qxt-mini NO-LINKER-SCRIPT NO-COMPAT)
+ if(NOT APPLE)
+ target_link_libraries(opentrack-qxt-mini X11)
+ else()
+ set_target_properties(opentrack-qxt-mini PROPERTIES LINK_FLAGS
+ "-framework Carbon -framework CoreFoundation")
+ endif()
+endif()
diff --git a/qxt-mini/qxtglobal.h b/qxt-mini/qxtglobal.h
index 574482ae..64fd35dc 100644
--- a/qxt-mini/qxtglobal.h
+++ b/qxt-mini/qxtglobal.h
@@ -51,6 +51,12 @@
#define QXT_DLLEXPORT DO_NOT_USE_THIS_ANYMORE
+#ifdef BUILD_opentrack_qxt_mini
+# define QXT_BUILD
+# define BUILD_QXT_GUI
+# define BUILD_QXT
+#endif
+
#ifdef QXT_BUILD
# if defined(BUILD_QXT_CORE)
# define QXT_CORE_EXPORT Q_DECL_EXPORT
diff --git a/qxt-mini/qxtglobalshortcut.cpp b/qxt-mini/qxtglobalshortcut.cpp
index 4b400a72..45576d37 100644
--- a/qxt-mini/qxtglobalshortcut.cpp
+++ b/qxt-mini/qxtglobalshortcut.cpp
@@ -1,4 +1,3 @@
-#define QXT_BUILD
#include "qxtglobalshortcut.h"
/****************************************************************************
** Copyright (c) 2006 - 2011, the LibQxt project.
diff --git a/qxt-mini/qxtglobalshortcut_mac.cpp b/qxt-mini/qxtglobalshortcut_mac.cpp
index 34de694e..b19de377 100644
--- a/qxt-mini/qxtglobalshortcut_mac.cpp
+++ b/qxt-mini/qxtglobalshortcut_mac.cpp
@@ -1,5 +1,4 @@
#ifdef __APPLE__
-#define QXT_BUILD
#include <Carbon/Carbon.h>
/****************************************************************************
** Copyright (c) 2006 - 2011, the LibQxt project.
diff --git a/qxt-mini/qxtglobalshortcut_x11.cpp b/qxt-mini/qxtglobalshortcut_x11.cpp
index b13770a2..12279ac8 100644
--- a/qxt-mini/qxtglobalshortcut_x11.cpp
+++ b/qxt-mini/qxtglobalshortcut_x11.cpp
@@ -1,5 +1,4 @@
-#ifndef __APPLE_
-#define QXT_BUILD
+#ifndef __APPLE__
#include "qxtglobalshortcut_p.h"
/****************************************************************************
** Copyright (c) 2006 - 2011, the LibQxt project.
diff --git a/spline-widget/CMakeLists.txt b/spline-widget/CMakeLists.txt
index 522491ea..03706d91 100644
--- a/spline-widget/CMakeLists.txt
+++ b/spline-widget/CMakeLists.txt
@@ -1,6 +1 @@
-opentrack_boilerplate(opentrack-spline-widget NO-LIBRARY)
-opentrack_qt(opentrack-spline-widget)
-add_library(opentrack-spline-widget STATIC ${opentrack-spline-widget-all})
-opentrack_compat(opentrack-spline-widget)
-target_include_directories(opentrack-spline-widget PUBLIC qfunctionconfigurator/)
-target_link_libraries(opentrack-spline-widget ${MY_QT_LIBS})
+opentrack_boilerplate(opentrack-spline-widget NO-LINKER-SCRIPT)
diff --git a/spline-widget/functionconfig.cpp b/spline-widget/functionconfig.cpp
index 27f3bf40..dcc9ca65 100644
--- a/spline-widget/functionconfig.cpp
+++ b/spline-widget/functionconfig.cpp
@@ -6,11 +6,11 @@
* notice appear in all copies.
*/
+#include "functionconfig.h"
#include <QMutexLocker>
#include <QCoreApplication>
#include <QPointF>
#include <QList>
-#include "functionconfig.h"
#include <QtAlgorithms>
#include <QtAlgorithms>
#include <QSettings>
diff --git a/spline-widget/functionconfig.h b/spline-widget/functionconfig.h
index 6d76d0de..3d2fc23c 100644
--- a/spline-widget/functionconfig.h
+++ b/spline-widget/functionconfig.h
@@ -8,6 +8,7 @@
#pragma once
+#include <QtGlobal>
#include <QList>
#include <QPointF>
#include <QString>
@@ -17,7 +18,13 @@
#include <limits>
#include "opentrack-compat/qcopyable-mutex.hpp"
-class Map {
+#ifdef BUILD_opentrack_spline_widget
+# define SPLINE_WIDGET_EXPORT Q_DECL_EXPORT
+#else
+# define SPLINE_WIDGET_EXPORT Q_DECL_IMPORT
+#endif
+
+class SPLINE_WIDGET_EXPORT Map {
private:
static constexpr int value_count = 10000;
diff --git a/spline-widget/qfunctionconfigurator.h b/spline-widget/qfunctionconfigurator.h
index baea9e34..4a9cb5f1 100644
--- a/spline-widget/qfunctionconfigurator.h
+++ b/spline-widget/qfunctionconfigurator.h
@@ -12,10 +12,10 @@
#include <QWidget>
#include <QtGui>
#include <QPointF>
-#include "spline-widget/functionconfig.h"
+#include "functionconfig.h"
#include "opentrack/plugin-api.hpp"
-class QFunctionConfigurator : public QWidget
+class SPLINE_WIDGET_EXPORT QFunctionConfigurator : public QWidget
{
Q_OBJECT
Q_PROPERTY(QColor colorBezier READ colorBezier WRITE setColorBezier)