summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt31
-rw-r--r--compat/compat.cpp19
-rw-r--r--compat/compat.h3
-rw-r--r--facetracknoir/main.cpp6
-rw-r--r--ftnoir_tracker_ht/ftnoir_tracker_ht.cpp18
5 files changed, 45 insertions, 32 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d17279c2..242d200d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,7 +9,7 @@ if(GIT_FOUND)
endif()
SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
-SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
+set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
SET(CMAKE_SKIP_INSTALL_RPATH FALSE)
SET(CMAKE_SKIP_RPATH FALSE)
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}")
@@ -23,8 +23,12 @@ if(MSVC)
add_definitions(-DNOMINMAX)
endif()
-if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
- add_definitions(-std=c++11)
+if(NOT APPLE)
+ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ add_definitions(-std=c++11)
+ endif()
+else()
+ set(CMAKE_CXX_FLAGS " -std=c++11 ${CMAKE_CXX_FLAGS}")
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
@@ -92,7 +96,7 @@ endif()
find_package(OpenCV REQUIRED)
find_package(Qt5 REQUIRED COMPONENTS Core Xml Network Widgets Gui QUIET)
- cmake_policy(SET CMP0020 NEW)
+ cmake_policy(SET CMP0020 NEW)
include_directories(${Qt5Core_INCLUDE_DIRS} ${Qt5Xml_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS})
add_definitions(${Qt5Core_DEFINITIONS} ${Qt5Xml_DEFINITIONS} ${Qt5Gui_DEFINITIONS} ${Qt5Widgets_DEFINITIONS} ${Qt5Network_DEFINITIONS})
@@ -328,9 +332,9 @@ if(SDK_XPLANE)
PREFIX "" SUFFIX "")
endif()
if(APPLE)
- SET_TARGET_PROPERTIES(opentrack-xplane-plugin
- COMPILE_FLAGS "-DAPL -DXPLM210 -framework XPLM -framework XPWidgets"
- LINK_FLAGS "-framework XPLM -framework XPWidgets")
+ SET_TARGET_PROPERTIES(opentrack-xplane-plugin PROPERTIES
+ COMPILE_FLAGS "-iframework ${SDK_XPLANE}/Libraries/Mac/ -DAPL -DXPLM210 -framework XPLM -framework XPWidgets"
+ LINK_FLAGS "-F${SDK_XPLANE}/Libraries/Mac/ -framework XPLM -framework XPWidgets")
endif()
if(UNIX AND NOT APPLE)
target_link_libraries(opentrack-xplane-plugin rt)
@@ -360,7 +364,12 @@ 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 Qt5Widgets Qt5Gui Qt5Network Qt5Xml Qt5Core ${my-qt-deps})
+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})
@@ -470,6 +479,10 @@ if(NOT WIN32 AND SDK_WINE_PREFIX)
PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt")
endif()
if(NOT SDK_WINE_NO_WRAPPER)
+ set(my-rt -lrt)
+ if(APPLE)
+ set(my-rt)
+ endif()
add_custom_command(
OUTPUT opentrack-wrapper-wine.exe.so
DEPENDS "${CMAKE_SOURCE_DIR}/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx"
@@ -480,7 +493,7 @@ if(NOT WIN32 AND SDK_WINE_PREFIX)
"${CMAKE_SOURCE_DIR}/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx"
"${CMAKE_SOURCE_DIR}/ftnoir_protocol_wine/opentrack-wrapper-wine-posix.cxx"
"${CMAKE_SOURCE_DIR}/ftnoir_protocol_wine/opentrack-wrapper-wine-windows.cxx"
- -lrt)
+ ${my-rt})
add_custom_target(wine-wrapper ALL DEPENDS opentrack-wrapper-wine.exe.so)
add_dependencies(wine-wrapper opentrack-compat opentrack-proto-wine)
endif()
diff --git a/compat/compat.cpp b/compat/compat.cpp
index bcdbd17f..7b695617 100644
--- a/compat/compat.cpp
+++ b/compat/compat.cpp
@@ -6,8 +6,7 @@
*/
#define IN_FTNOIR_COMPAT
#include "compat.h"
-#include <string>
-#include <sstream>
+#include <string.h>
#if defined(_WIN32)
@@ -48,17 +47,11 @@ void PortableLockedShm::unlock()
#else
PortableLockedShm::PortableLockedShm(const char *shmName, const char* /*mutexName*/, int mapSize) : size(mapSize)
{
- std::string filename;
- filename.append("/");
- filename.append(shmName);
- //(void) shm_unlink(shm_filename);
-
- fd = shm_open(filename.c_str(), O_RDWR | O_CREAT, 0600);
- if (ftruncate(fd, mapSize) == 0) { ;; }
- else {
- fprintf(stderr, "oh, bother, ftruncate: %s\n", strerror(errno));
- //mem = (void*) -1;
- }
+ char filename[512] = {0};
+ strcpy(filename, "/");
+ strcat(filename, shmName);
+ fd = shm_open(filename, O_RDWR | O_CREAT, 0600);
+ (void) ftruncate(fd, mapSize);
mem = mmap(NULL, mapSize, PROT_READ|PROT_WRITE, MAP_SHARED, fd, (off_t)0);
}
diff --git a/compat/compat.h b/compat/compat.h
index 8c307b14..60395830 100644
--- a/compat/compat.h
+++ b/compat/compat.h
@@ -7,7 +7,8 @@
#pragma once
#if defined(_WIN32)
-#include <windows.h>
+#include <winbase.h>
+#include <winreg.h>
#else
#include <stdio.h>
#include <string.h>
diff --git a/facetracknoir/main.cpp b/facetracknoir/main.cpp
index e643bcd3..23703ef3 100644
--- a/facetracknoir/main.cpp
+++ b/facetracknoir/main.cpp
@@ -28,6 +28,8 @@
#include <QDesktopWidget>
#include <QDebug>
#include <QList>
+#include <QDir>
+#include <QStringList>
#if defined(_WIN32) && defined(_MSC_VER)
# include <windows.h>
@@ -59,6 +61,10 @@ int main(int argc, char** argv)
#endif
QApplication::setAttribute(Qt::AA_X11InitThreads, true);
QApplication app(argc, argv);
+#ifdef __APPLE__
+ QDir dir(QCoreApplication::applicationDirPath());
+ QCoreApplication::setLibraryPaths(QStringList(dir.absolutePath()));
+#endif
FaceTrackNoIR w;
QDesktopWidget desktop;
diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp
index db0ef6d6..77eede52 100644
--- a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp
+++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp
@@ -62,7 +62,7 @@ static QList<QString> get_camera_names(void) {
pEnumCat->Release();
}
pSysDevEnum->Release();
-#else
+#elsif !defined(__APPLE__)
for (int i = 0; i < 16; i++) {
char buf[128];
sprintf(buf, "/dev/video%d", i);
@@ -281,15 +281,15 @@ TrackerControls::TrackerControls()
{
ui.setupUi(this);
setAttribute(Qt::WA_NativeWindow, true);
- connect(ui.cameraName, SIGNAL(currentIndexChanged(int)), this, SLOT(settingChanged(int)));
- connect(ui.cameraFPS, SIGNAL(currentIndexChanged(int)), this, SLOT(settingChanged(int)));
+ connect(ui.cameraName, SIGNAL(valueChanged(int)), this, SLOT(settingChanged(int)));
+ connect(ui.cameraFPS, SIGNAL(valueChanged(int)), this, SLOT(settingChanged(int)));
connect(ui.cameraFOV, SIGNAL(valueChanged(double)), this, SLOT(settingChanged(double)));
- connect(ui.rx, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int)));
- connect(ui.ry, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int)));
- connect(ui.rz, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int)));
- connect(ui.tx, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int)));
- connect(ui.ty, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int)));
- connect(ui.tz, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int)));
+ connect(ui.rx, SIGNAL(valueChanged(int)), this, SLOT(settingChanged(int)));
+ connect(ui.ry, SIGNAL(valueChanged(int)), this, SLOT(settingChanged(int)));
+ connect(ui.rz, SIGNAL(valueChanged(int)), this, SLOT(settingChanged(int)));
+ connect(ui.tx, SIGNAL(valueChanged(int)), this, SLOT(settingChanged(int)));
+ connect(ui.ty, SIGNAL(valueChanged(int)), this, SLOT(settingChanged(int)));
+ connect(ui.tz, SIGNAL(valueChanged(int)), this, SLOT(settingChanged(int)));
connect(ui.buttonCancel, SIGNAL(clicked()), this, SLOT(doCancel()));
connect(ui.buttonOK, SIGNAL(clicked()), this, SLOT(doOK()));
//connect(ui.buttonSettings, SIGNAL(clicked()), this, SLOT(cameraSettings()));