diff options
-rw-r--r-- | CMakeLists.txt | 32 | ||||
-rw-r--r-- | FTNoIR_Tracker_PT/camera.cpp | 2 | ||||
-rw-r--r-- | facetracknoir/facetracknoir.cpp | 2 | ||||
-rw-r--r-- | qxt-mini/qxtglobalshortcut.cpp | 12 | ||||
-rw-r--r-- | qxt-mini/qxtglobalshortcut_p.h | 10 |
5 files changed, 40 insertions, 18 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c1cc757e..952584e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -327,7 +327,7 @@ if(SDK_XPLANE) LIBRARY_OUTPUT_NAME "opentrack.xpl" PREFIX "" SUFFIX "") endif() - if(UNIX) + if(UNIX AND NOT APPLE) target_link_libraries(opentrack-xplane-plugin rt) endif() endif() @@ -345,7 +345,7 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) endif() add_library(opentrack-compat SHARED ${opentrack-compat-c} ${opentrack-compat-h}) -if(NOT WIN32) +if(NOT WIN32 AND NOT APPLE) target_link_libraries(opentrack-compat rt) endif() @@ -354,7 +354,12 @@ endif() 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}) +if(APPLE) + link_directories(${CMAKE_INSTALL_PREFIX}) + SET(MY_QT_LIBS QtWidgets QtGui QtNetwork QtXml QtCore) +else() + SET(MY_QT_LIBS ${Qt5Widgets_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5Xml_LIBRARIES} ${Qt5Core_LIBRARIES} ${my-qt-deps}) +endif() add_library(opentrack-csv SHARED ${opentrack-csv-c} ${opentrack-csv-h}) target_link_libraries(opentrack-csv ${MY_QT_LIBS}) @@ -550,7 +555,11 @@ if(SDK_RIFT) if(WIN32) target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/libLibOVR.a" winmm.lib setupapi.lib) else() - target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/libLibOVR.a" udev Xinerama) + if (NOT APPLE) + target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/libLibOVR.a" udev Xinerama) + else() # crapintosh + target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/libLibOVR.a") + endif() endif() endif() if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) @@ -560,6 +569,10 @@ if(SDK_RIFT) COMPILE_FLAGS "-fno-strict-aliasing" ) endif() + if(APPLE) + SET_TARGET_PROPERTIES(opentrack-tracker-rift + PROPERTIES LINK_FLAGS "-framework CoreFoundation -framework CoreGraphics -framework IOKit -framework Quartz") + endif() endif() if(SDK_HYDRA) @@ -604,16 +617,23 @@ if(WIN32 AND NOT SDK_CONSOLE_DEBUG) else() set(opentrack-win32-executable "") endif() -if(UNIX) +if(UNIX OR APPLE) add_library(opentrack-qxt-mini SHARED ${qxt-mini-c}) SET_TARGET_PROPERTIES(opentrack-qxt-mini PROPERTIES COMPILE_FLAGS "-DBUILD_QXT_CORE=42 -DBUILD_QXT_WIDGETS=42 -DBUILD_QXT_GUI=42") - target_link_libraries(opentrack-qxt-mini ${MY_QT_LIBS} X11) + target_link_libraries(opentrack-qxt-mini ${MY_QT_LIBS}) + if(NOT APPLE) + target_link_libraries(opentrack-qxt-mini X11) + endif() endif() add_executable(opentrack ${opentrack-win32-executable} ${opentrack-bin-c} ${opentrack-bin-h} ${opentrack-bin-moc} ${opentrack-bin-uih} ${opentrack-bin-rcc}) set_target_properties(opentrack PROPERTIES COMPILE_DEFINITIONS OPENTRACK_VERSION=\"${OPENTRACK__COMMIT}\") set(OPENTRACK_COMMIT_VERSION \"${OPENTRACK__COMMIT}\") configure_file("${CMAKE_SOURCE_DIR}/opentrack-version.h" "${CMAKE_BINARY_DIR}/opentrack-version.h" @ONLY NEWLINE_STYLE UNIX) +if(APPLE) + SET_TARGET_PROPERTIES(opentrack-qxt-mini PROPERTIES LINK_FLAGS "-framework Carbon -framework CoreFoundation") +endif() + add_library(opentrack-api SHARED ${opentrack-lib-c} ${opentrack-lib-h} ${opentrack-lib-moc}) target_link_libraries(opentrack-api ${MY_QT_LIBS}) if(CMAKE_COMPILER_IS_GNUCXX) diff --git a/FTNoIR_Tracker_PT/camera.cpp b/FTNoIR_Tracker_PT/camera.cpp index e5ecdc99..b4d2509f 100644 --- a/FTNoIR_Tracker_PT/camera.cpp +++ b/FTNoIR_Tracker_PT/camera.cpp @@ -11,7 +11,7 @@ using namespace cv;
-#if defined(OPENTRACK_API) && (defined(__unix) || defined(__linux))
+#if defined(OPENTRACK_API) && (defined(__unix) || defined(__linux) || defined(__APPLE__))
#include <unistd.h>
#endif
diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp index 1e83110c..ef470c7a 100644 --- a/facetracknoir/facetracknoir.cpp +++ b/facetracknoir/facetracknoir.cpp @@ -49,7 +49,7 @@ # define LIB_PREFIX "lib" #endif -#if defined(__unix) || defined(__linux) +#if defined(__unix) || defined(__linux) || defined(__APPLE__) # include <unistd.h> #endif diff --git a/qxt-mini/qxtglobalshortcut.cpp b/qxt-mini/qxtglobalshortcut.cpp index 72548d6f..44b9f917 100644 --- a/qxt-mini/qxtglobalshortcut.cpp +++ b/qxt-mini/qxtglobalshortcut.cpp @@ -33,17 +33,17 @@ #include <QAbstractEventDispatcher>
#include <QtDebug>
-#ifndef Q_WS_MAC
+#ifndef Q_OS_MAC
int QxtGlobalShortcutPrivate::ref = 0;
# if QT_VERSION < QT_VERSION_CHECK(5,0,0)
QAbstractEventDispatcher::EventFilter QxtGlobalShortcutPrivate::prevEventFilter = 0;
# endif
-#endif // Q_WS_MAC
+#endif // Q_OS_MAC
QHash<QPair<quint32, quint32>, QxtGlobalShortcut*> QxtGlobalShortcutPrivate::shortcuts;
QxtGlobalShortcutPrivate::QxtGlobalShortcutPrivate() : enabled(true), key(Qt::Key(0)), mods(Qt::NoModifier)
{
-#ifndef Q_WS_MAC
+#ifndef Q_OS_MAC
if (ref == 0) {
# if QT_VERSION < QT_VERSION_CHECK(5,0,0)
prevEventFilter = QAbstractEventDispatcher::instance()->setEventFilter(eventFilter);
@@ -52,12 +52,12 @@ QxtGlobalShortcutPrivate::QxtGlobalShortcutPrivate() : enabled(true), key(Qt::Ke #endif
}
++ref;
-#endif // Q_WS_MAC
+#endif // Q_OS_MAC
}
QxtGlobalShortcutPrivate::~QxtGlobalShortcutPrivate()
{
-#ifndef Q_WS_MAC
+#ifndef Q_OS_MAC
--ref;
if (ref == 0) {
QAbstractEventDispatcher *ed = QAbstractEventDispatcher::instance();
@@ -69,7 +69,7 @@ QxtGlobalShortcutPrivate::~QxtGlobalShortcutPrivate() # endif
}
}
-#endif // Q_WS_MAC
+#endif // Q_OS_MAC
}
bool QxtGlobalShortcutPrivate::setShortcut(const QKeySequence& shortcut)
diff --git a/qxt-mini/qxtglobalshortcut_p.h b/qxt-mini/qxtglobalshortcut_p.h index 1a788852..0d88b354 100644 --- a/qxt-mini/qxtglobalshortcut_p.h +++ b/qxt-mini/qxtglobalshortcut_p.h @@ -59,14 +59,16 @@ public: bool unsetShortcut();
static bool error;
-#ifndef Q_WS_MAC
+#ifndef Q_OS_DARWIN
static int ref;
-#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
+# if QT_VERSION < QT_VERSION_CHECK(5,0,0)
static QAbstractEventDispatcher::EventFilter prevEventFilter;
static bool eventFilter(void* message);
-#else
+# else
virtual bool nativeEventFilter(const QByteArray & eventType, void * message, long * result);
-#endif // QT_VERSION < QT_VERSION_CHECK(5,0,0)
+# endif // QT_VERSION < QT_VERSION_CHECK(5,0,0)
+# else
+ virtual bool nativeEventFilter(const QByteArray & eventType, void * message, long * result) {}
#endif // Q_WS_MAC
static void activateShortcut(quint32 nativeKey, quint32 nativeMods);
|