From 709dac6140502566fac4156b83b998895dc07377 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 19 Oct 2014 21:59:09 +0200 Subject: fix link errors on win32 -only- --- CMakeLists.txt | 74 ++++++++++++---------- cmake/mingw-w64.cmake | 2 +- compat/compat.cpp | 1 - compat/compat.h | 14 +--- facetracknoir/facetracknoir.cpp | 2 - facetracknoir/facetracknoir.h | 6 +- facetracknoir/shortcuts.cpp | 6 +- facetracknoir/version.c | 5 -- ftnoir_csv/csv.cpp | 5 -- ftnoir_csv/csv.h | 12 +--- ftnoir_posewidget/glwidget.h | 2 - .../opentrack-wrapper-wine-main.cxx | 2 +- ftnoir_tracker_joystick/ftnoir_tracker_joystick.h | 2 +- opentrack/main-settings.hpp | 2 + opentrack/version.C | 5 ++ qfunctionconfigurator/functionconfig.h | 4 +- qfunctionconfigurator/qfunctionconfigurator.h | 2 +- 17 files changed, 61 insertions(+), 85 deletions(-) delete mode 100644 facetracknoir/version.c create mode 100644 opentrack/version.C diff --git a/CMakeLists.txt b/CMakeLists.txt index 0b350598..4b96e239 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,9 +43,9 @@ SET(CMAKE_BUILD_WITH_INSTALL_RPATH 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}") +SET(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}) set(CMAKE_INCLUDE_CURRENT_DIR ON) -set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOMOC OFF) set(CMAKE_POSITION_INDEPENDENT_CODE ON) # note, hatire supports both ftnoir and opentrack @@ -128,7 +128,7 @@ else() endif() # qt being broken as usual -set(EXTRA-MOCS "${CMAKE_SOURCE_DIR}/facetracknoir/options.h") +set(EXTRA-MOCS opentrack/options.hpp) function(link_with_dinput8 n) if(WIN32) @@ -137,11 +137,17 @@ function(link_with_dinput8 n) endfunction() macro(opentrack_module n dir) - file(GLOB ${n}-c "${dir}/*.cpp" "${dir}/*.h" "${dir}/*.rc" "${dir}/*.hpp" ${EXTRA-MOCS}) - file(GLOB ${n}-ui "${dir}/*.ui") - file(GLOB ${n}-rc "${dir}/*.qrc") + file(GLOB ${n}-c ${dir}/*.cpp ${dir}/*.c ${dir}/*.h ${dir}/*.hpp ${EXTRA-MOCS}) + file(GLOB ${n}-res ${dir}/*.rc) + file(GLOB ${n}-ui ${dir}/*.ui) + file(GLOB ${n}-rc ${dir}/*.qrc) +endmacro() + +macro(opentrack_qt n) + qt5_wrap_cpp(${n}-moc ${${n}-c} OPTIONS --no-notes) QT5_WRAP_UI(${n}-uih ${${n}-ui}) QT5_ADD_RESOURCES(${n}-rcc ${${n}-rc}) + set(${n}-all ${${n}-c} ${${n}-rc} ${${n}-rcc} ${${n}-uih} ${${n}-moc} ${${n}-res}) endmacro() macro(opentrack_library n dir) @@ -150,38 +156,26 @@ macro(opentrack_library n dir) message(FATAL_ERROR "opentrack_library bad formals") endif() opentrack_module(${n} ${dir}) - add_library(${n} SHARED ${${n}-c} ${${n}-uih} ${${n}-rcc}) + opentrack_qt(${n}) + add_library(${n} SHARED ${${n}-all}) target_link_libraries(${n} ${MY_QT_LIBS}) if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE) SET_TARGET_PROPERTIES(${n} PROPERTIES LINK_FLAGS "${foolib_LINK} -Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/${version-script}-version-script.txt" COMPILE_FLAGS "${foolib_COMPILE} -fvisibility=hidden -fvisibility-inlines-hidden" - ) + ) else() - set_target_properties(${n} PROPERTIES LINK_FLAGS "${foolib_LINK}" COMPILE_FLAGS "${foolib_COMPILE}") + set_target_properties(${n} PROPERTIES LINK_FLAGS ${foolib_LINK} COMPILE_FLAGS ${foolib_COMPILE}) endif() install(TARGETS ${n} RUNTIME DESTINATION . LIBRARY DESTINATION .) endmacro() -opentrack_module(opentrack-bin facetracknoir) -opentrack_module(opentrack-api opentrack) -opentrack_module(opentrack-pose-widget ftnoir_posewidget) -opentrack_module(opentrack-spline-widget qfunctionconfigurator) - -file(GLOB opentrack-version-c "facetracknoir/version.c") - -file(GLOB opentrack-csv-c "ftnoir_csv/*.cpp" "ftnoir_csv/*.h") - -# compat lib for POSIX/win32 - -file(GLOB opentrack-compat-c "compat/*.cpp" "compat/*.h") - -# x-plane plugin -file(GLOB opentrack-xplane-plugin-c "x-plane-plugin/*.c") +opentrack_module(opentrack-compat compat) +opentrack_module(opentrack-xplane-plugin x-plane-plugin) # freetrack -file(GLOB opentrack-freetrack-c "freetrackclient/*.c") +opentrack_module(freetrackclient freetrackclient) if(SDK_XPLANE) # probably librt already included @@ -223,15 +217,21 @@ endif() set(MY_QT_LIBS ${Qt5Widgets_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5Xml_LIBRARIES} ${Qt5Core_LIBRARIES} ${my-qt-deps}) +opentrack_module(opentrack-csv ftnoir_csv) add_library(opentrack-csv STATIC ${opentrack-csv-c}) target_link_libraries(opentrack-csv ${MY_QT_LIBS}) -add_library(opentrack-pose-widget STATIC ${opentrack-pose-widget-c} ${opentrack-pose-widget-rcc}) +opentrack_module(opentrack-pose-widget ftnoir_posewidget) +opentrack_qt(opentrack-pose-widget) +add_library(opentrack-pose-widget STATIC ${opentrack-pose-widget-all}) target_link_libraries(opentrack-pose-widget ${MY_QT_LIBS}) -add_library(opentrack-spline-widget STATIC ${opentrack-spline-widget-c}) + +opentrack_module(opentrack-spline-widget qfunctionconfigurator) +opentrack_qt(opentrack-spline-widget) +add_library(opentrack-spline-widget STATIC ${opentrack-spline-widget-all}) target_link_libraries(opentrack-spline-widget ${MY_QT_LIBS}) -add_library(opentrack-version STATIC ${opentrack-version-c}) +add_library(opentrack-version STATIC opentrack/version.C) set_target_properties(opentrack-version PROPERTIES COMPILE_DEFINITIONS "IN_VERSION_UNIT;OPENTRACK_VERSION=\"${OPENTRACK__COMMIT}\"") @@ -281,7 +281,7 @@ if(WIN32) endif() if(WIN32) - add_library(freetrackclient SHARED ${opentrack-freetrack-c}) + add_library(freetrackclient SHARED ${freetrackclient-c}) set_target_properties(freetrackclient PROPERTIES PREFIX "") endif() @@ -404,9 +404,14 @@ if(UNIX OR APPLE) endif() endif() -add_library(opentrack-api STATIC ${opentrack-api-c}) -add_executable(opentrack ${opentrack-win32-executable} ${opentrack-bin-c} ${opentrack-bin-uih} ${opentrack-bin-rcc}) -target_link_libraries(opentrack opentrack-api) +opentrack_module(opentrack-api opentrack) +opentrack_qt(opentrack-api) +add_library(opentrack-api STATIC ${opentrack-api-all}) + +opentrack_module(opentrack facetracknoir) +opentrack_qt(opentrack) +add_executable(opentrack ${opentrack-win32-executable} ${opentrack-all}) +target_link_libraries(opentrack opentrack-api opentrack-version opentrack-pose-widget opentrack-spline-widget) if(APPLE) SET_TARGET_PROPERTIES(opentrack-qxt-mini PROPERTIES LINK_FLAGS "-framework Carbon -framework CoreFoundation") @@ -415,7 +420,7 @@ endif() if(UNIX OR APPLE) target_link_libraries(opentrack opentrack-qxt-mini) endif() -target_link_libraries(opentrack-api ${OpenCV_LIBS}) +target_link_libraries(opentrack-api ${OpenCV_LIBS} ${MY_QT_LIBS}) include_directories(${OpenCV_INCLUDE_DIRS}) link_with_dinput8(opentrack) @@ -424,7 +429,8 @@ if(CMAKE_SYSTEM STREQUAL LINUX) link_libraries(rt) endif() -target_link_libraries(opentrack opentrack-version opentrack-pose-widget opentrack-spline-widget ${MY_QT_LIBS} ${QXT_QXTCORE_LIB_RELEASE} ${QXT_QXTWIDGETS_LIB_RELEASE}) +target_link_libraries(opentrack ${QXT_QXTCORE_LIB_RELEASE} ${QXT_QXTWIDGETS_LIB_RELEASE} ${MY_QT_LIBS}) + if(NOT WIN32) target_link_libraries(opentrack-api dl) else() diff --git a/cmake/mingw-w64.cmake b/cmake/mingw-w64.cmake index b5c06549..a60f0008 100644 --- a/cmake/mingw-w64.cmake +++ b/cmake/mingw-w64.cmake @@ -19,7 +19,7 @@ SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) -set(CMAKE_C_FLAGS_RELEASE "-O3 -ffast-math -flto -march=i686 -mtune=prescott -mno-sse3 -mno-avx -frename-registers" CACHE STRING "" FORCE) +set(CMAKE_C_FLAGS_RELEASE "-O3 -ffast-math -flto -flto-partition=none -march=i686 -mtune=prescott -mno-sse3 -mno-avx -frename-registers" CACHE STRING "" FORCE) set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE} CACHE STRING "" FORCE) set(CMAKE_BUILD_TYPE "RELEASE" CACHE STRING "" FORCE) diff --git a/compat/compat.cpp b/compat/compat.cpp index b5d63f2b..9000b453 100644 --- a/compat/compat.cpp +++ b/compat/compat.cpp @@ -6,7 +6,6 @@ */ #include -#define IN_FTNOIR_COMPAT #include "compat.h" #if defined(_WIN32) diff --git a/compat/compat.h b/compat/compat.h index 490d8913..17a0d843 100644 --- a/compat/compat.h +++ b/compat/compat.h @@ -19,19 +19,7 @@ #include #endif -#if !defined(OPENTRACK_COMPAT_BUNDLED) -# if defined(IN_FTNOIR_COMPAT) && defined(_WIN32) -# define COMPAT_EXPORT __declspec(dllexport) -# elif defined(_WIN32) -# define COMPAT_EXPORT __declspec(dllimport) -# else -# define COMPAT_EXPORT __attribute__ ((visibility ("default"))) -# endif -#else -# define COMPAT_EXPORT -#endif - -class COMPAT_EXPORT PortableLockedShm { +class PortableLockedShm { public: PortableLockedShm(const char *shmName, const char *mutexName, int mapSize); ~PortableLockedShm(); diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp index 76d7af19..44fa11f0 100644 --- a/facetracknoir/facetracknoir.cpp +++ b/facetracknoir/facetracknoir.cpp @@ -22,9 +22,7 @@ * with this program; if not, see . * *********************************************************************************/ #include "facetracknoir.h" -#include "shortcuts.h" #include "opentrack/tracker.h" -#include "curve-config.h" #include FaceTrackNoIR::FaceTrackNoIR() : QMainWindow(nullptr), diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h index 0c5d902f..32bf8239 100644 --- a/facetracknoir/facetracknoir.h +++ b/facetracknoir/facetracknoir.h @@ -48,8 +48,8 @@ #include "opentrack/main-settings.hpp" #include "opentrack/plugin-support.h" #include "opentrack/tracker.h" -#include "./shortcuts.h" -#include "./curve-config.h" +#include "shortcuts.h" +#include "curve-config.h" using namespace options; @@ -85,7 +85,7 @@ private: ptr pProtocolDialog; ptr pFilterDialog; - ptr shortcuts_widget; + ptr shortcuts_widget; ptr mapping_widget; QShortcut kbd_quit; diff --git a/facetracknoir/shortcuts.cpp b/facetracknoir/shortcuts.cpp index 94c46376..53d67957 100644 --- a/facetracknoir/shortcuts.cpp +++ b/facetracknoir/shortcuts.cpp @@ -1,5 +1,7 @@ -#include "facetracknoir/facetracknoir.h" -#include "facetracknoir/shortcuts.h" +#include "facetracknoir.h" +#include "shortcuts.h" + +// XXX todo remove ref to ui class -sh 20141019 KeyboardShortcutDialog::KeyboardShortcutDialog( FaceTrackNoIR *ftnoir, QWidget *parent ) : QWidget( parent, Qt::Dialog) diff --git a/facetracknoir/version.c b/facetracknoir/version.c deleted file mode 100644 index 0ef4ec14..00000000 --- a/facetracknoir/version.c +++ /dev/null @@ -1,5 +0,0 @@ -#ifdef IN_VERSION_UNIT -# define IN_CRAPOLA_COMPILE_UNIT -volatile const char* opentrack_version = OPENTRACK_VERSION; -#else -#endif diff --git a/ftnoir_csv/csv.cpp b/ftnoir_csv/csv.cpp index b59b5083..71db8ecb 100644 --- a/ftnoir_csv/csv.cpp +++ b/ftnoir_csv/csv.cpp @@ -44,11 +44,6 @@ CSV::CSV(QString &string){ m_rx = QRegExp("((?:(?:[^;\\n]*;?)|(?:\"[^\"]*\";?))*)\\n"); } -CSV::~CSV() -{ -} - - void CSV::setCodec(const char* codecName){ m_codec = QTextCodec::codecForName(codecName); } diff --git a/ftnoir_csv/csv.h b/ftnoir_csv/csv.h index 79e1351e..e0eac7dd 100644 --- a/ftnoir_csv/csv.h +++ b/ftnoir_csv/csv.h @@ -6,19 +6,9 @@ #include #include -#if defined(INSIDE_CSV) -# define CSV_API Q_DECL_EXPORT -#else -# define CSV_API Q_DECL_IMPORT -#endif - -class CSV_API CSV +class CSV { - /*Q_OBJECT*/ - public: - ~CSV(); - QString readLine(); QStringList parseLine(); static QStringList parseLine(QString line); diff --git a/ftnoir_posewidget/glwidget.h b/ftnoir_posewidget/glwidget.h index 243e3773..6ac12fbf 100644 --- a/ftnoir_posewidget/glwidget.h +++ b/ftnoir_posewidget/glwidget.h @@ -49,8 +49,6 @@ struct Vec2f { class OPENTRACK_EXPORT GLWidget : public QWidget { - Q_OBJECT - public: GLWidget(QWidget *parent); ~GLWidget(); diff --git a/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx b/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx index 40f36f8d..9a07681c 100644 --- a/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx +++ b/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx @@ -4,7 +4,7 @@ #include "ftnoir_protocol_wine/wine-shm.h" #define OPENTRACK_CROSS_ONLY -#include "facetracknoir/plugin-api.hpp" +#include "../opentrack/plugin-api.hpp" #define OPENTRACK_COMPAT_BUNDLED #include "compat/compat.h" diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h index 6d42f3e1..d1ae427b 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h @@ -61,7 +61,7 @@ class TrackerControls: public ITrackerDialog Q_OBJECT public: TrackerControls(); - void register_tracker(ITracker *foo) {} + void register_tracker(ITracker *) {} void unregister_tracker() {} QList guids; Ui::UIJoystickControls ui; diff --git a/opentrack/main-settings.hpp b/opentrack/main-settings.hpp index 6f78ac82..841d3bca 100644 --- a/opentrack/main-settings.hpp +++ b/opentrack/main-settings.hpp @@ -2,6 +2,8 @@ #include #include "opentrack/options.hpp" +#include "opentrack/plugin-api.hpp" + using namespace options; struct key_opts { diff --git a/opentrack/version.C b/opentrack/version.C new file mode 100644 index 00000000..0ef4ec14 --- /dev/null +++ b/opentrack/version.C @@ -0,0 +1,5 @@ +#ifdef IN_VERSION_UNIT +# define IN_CRAPOLA_COMPILE_UNIT +volatile const char* opentrack_version = OPENTRACK_VERSION; +#else +#endif diff --git a/qfunctionconfigurator/functionconfig.h b/qfunctionconfigurator/functionconfig.h index 9edfd51c..4ce5efee 100644 --- a/qfunctionconfigurator/functionconfig.h +++ b/qfunctionconfigurator/functionconfig.h @@ -14,11 +14,9 @@ #include #include #include -#include "../opentrack/plugin-api.hpp" #include "../opentrack/qcopyable-mutex.hpp" - -class OPENTRACK_EXPORT Map { +class Map { private: struct State { QList input; diff --git a/qfunctionconfigurator/qfunctionconfigurator.h b/qfunctionconfigurator/qfunctionconfigurator.h index 974d9bb6..52ea40b4 100644 --- a/qfunctionconfigurator/qfunctionconfigurator.h +++ b/qfunctionconfigurator/qfunctionconfigurator.h @@ -16,7 +16,7 @@ #include "qfunctionconfigurator/functionconfig.h" #include "opentrack/plugin-api.hpp" -class OPENTRACK_EXPORT QFunctionConfigurator : public QWidget +class QFunctionConfigurator : public QWidget { Q_OBJECT Q_PROPERTY(QColor colorBezier READ colorBezier WRITE setColorBezier) -- cgit v1.2.3