diff options
30 files changed, 218 insertions, 109 deletions
@@ -7,3 +7,5 @@ /.vs/ /CMakeSettings.json .gtm/ +.vscode +.history diff --git a/CMakeLists.txt b/CMakeLists.txt index a7a95d2f..448d7667 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -93,8 +93,15 @@ function(otr_add_subdirs) foreach(k ${_globbed}) get_filename_component(k "${k}" DIRECTORY) - add_subdirectory("${k}") + # we want to compile macosx last so we can run proper install scripts + if (k MATCHES "macosx$") + set(o ${k}) + else() + add_subdirectory("${k}") + endif() endforeach() + # Add macosx last + add_subdirectory("${o}") endfunction() otr_add_subdirs() @@ -77,6 +77,7 @@ Don't be afraid to submit an **issue/feature request** if you have any problems! assistance, testing) - Wim Vriend (original codebase author and maintainer) - Ryan Spicer (OSX tester, contributor) +- Ries van Twisk (OSX tester, OSX Build Fixes, contributor) - Donovan Baarda (filtering/control theory expert) - Mathijs Groothuis (@MathijsG, dozens of bugs and other issues reported; NL translation) - The Russian community from the [IL-2 Sturmovik forums](https://forum.il2sturmovik.ru/) (reporting bugs, requesting important features) diff --git a/cmake/FindEigen3.cmake b/cmake/FindEigen3.cmake index b43208f9..bbad2298 100644 --- a/cmake/FindEigen3.cmake +++ b/cmake/FindEigen3.cmake @@ -9,6 +9,12 @@ # EIGEN3_FOUND - system has eigen lib with correct version # EIGEN3_INCLUDE_DIR - the eigen include directory # EIGEN3_VERSION - eigen version +# +# This module reads hints about search locations from +# the following enviroment variables: +# +# EIGEN3_ROOT +# EIGEN3_ROOT_DIR # Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org> # Copyright (c) 2008, 2009 Gael Guennebaud, <g.gael@free.fr> @@ -61,19 +67,29 @@ if (EIGEN3_INCLUDE_DIR) else (EIGEN3_INCLUDE_DIR) - find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library + # search first if an Eigen3Config.cmake is available in the system, + # if successful this would set EIGEN3_INCLUDE_DIR and the rest of + # the script will work as usual + find_package(Eigen3 ${Eigen3_FIND_VERSION} NO_MODULE QUIET) + + if(NOT EIGEN3_INCLUDE_DIR) + find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library + HINTS + ENV EIGEN3_ROOT + ENV EIGEN3_ROOT_DIR PATHS ${CMAKE_INSTALL_PREFIX}/include ${KDE4_INCLUDE_DIR} PATH_SUFFIXES eigen3 eigen ) - + endif(NOT EIGEN3_INCLUDE_DIR) + if(EIGEN3_INCLUDE_DIR) _eigen3_check_version() endif(EIGEN3_INCLUDE_DIR) - #include(FindPackageHandleStandardArgs) - #find_package_handle_standard_args(Eigen3 DEFAULT_MSG EIGEN3_INCLUDE_DIR EIGEN3_VERSION_OK) + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(Eigen3 DEFAULT_MSG EIGEN3_INCLUDE_DIR EIGEN3_VERSION_OK) mark_as_advanced(EIGEN3_INCLUDE_DIR) diff --git a/cmake/opentrack-boilerplate.cmake b/cmake/opentrack-boilerplate.cmake index ffa4ea02..958403cc 100644 --- a/cmake/opentrack-boilerplate.cmake +++ b/cmake/opentrack-boilerplate.cmake @@ -61,8 +61,8 @@ function(otr_glob_sources var) endfunction() function(otr_fixup_subsystem n) - otr_find_msvc_editbin(editbin-pathname) if(MSVC) + otr_find_msvc_editbin(editbin-pathname) set(subsystem WINDOWS) get_property(type TARGET "${n}" PROPERTY TYPE) if (NOT type STREQUAL "STATIC_LIBRARY") @@ -143,15 +143,17 @@ function(otr_module n_) set(arg_NO-I18N TRUE) endif() - if(NOT WIN32) - set(subsys "") - elseif(arg_WIN32-CONSOLE) - set(subsys "") - else() - set(subsys "WIN32") - endif() - if(arg_EXECUTABLE) + if (APPLE) + set(subsys "MACOSX_BUNDLE") + elseif(NOT WIN32) + set(subsys "") + elseif(arg_WIN32-CONSOLE) + set(subsys "") + else() + set(subsys "WIN32") + endif() + add_executable(${n} ${subsys} "${${n}-all}") set_target_properties(${n} PROPERTIES SUFFIX "${opentrack-binary-suffix}" @@ -216,12 +218,23 @@ function(otr_module n_) endif() if(NOT arg_NO-INSTALL) + # Librarys/executable if(arg_BIN) - install(TARGETS "${n}" + if (APPLE) + install(TARGETS "${n}" + RUNTIME DESTINATION ${opentrack-hier-bin} + BUNDLE DESTINATION ${opentrack-hier-bin} + LIBRARY DESTINATION ${opentrack-hier-bin}/Library + RESOURCE DESTINATION ${opentrack-hier-bin}/opentrack.app/Resource + PERMISSIONS ${opentrack-perms-exec}) + else() + install(TARGETS "${n}" RUNTIME DESTINATION ${opentrack-hier-bin} LIBRARY DESTINATION ${opentrack-hier-pfx} PERMISSIONS ${opentrack-perms-exec}) + endif() else() + # Plugins install(TARGETS "${n}" ${opentrack-hier-str} PERMISSIONS ${opentrack-perms-exec}) endif() diff --git a/cmake/opentrack-hier.cmake b/cmake/opentrack-hier.cmake index 7dcdb52d..13f876a5 100644 --- a/cmake/opentrack-hier.cmake +++ b/cmake/opentrack-hier.cmake @@ -9,16 +9,16 @@ include_guard(GLOBAL) -set(opentrack-install-rpath "") if(APPLE) - set(opentrack-hier-pfx ".") - set(opentrack-hier-path "/") # MUST HAVE A TRAILING BACKSLASH + set(opentrack-hier-pfx "Plugins") + set(opentrack-hier-path "/Plugins/") # MUST HAVE A TRAILING BACKSLASH, Used in APP set(opentrack-hier-doc "/") # MUST HAVE A TRAILING BACKSLASH - set(opentrack-hier-bin ".") + set(opentrack-hier-bin "${CMAKE_INSTALL_PREFIX}") set(opentrack-doc-pfx "./doc") set(opentrack-doc-src-pfx "./source-code") - set(opentrack-i18n-pfx "./i18n") - set(opentrack-i18n-path "./i18n") + set(opentrack-i18n-pfx "opentrack.app/Contents/Resources") # used during install + set(opentrack-i18n-path "../Resources/i18n") # used in application + set(opentrack-install-rpath "${CMAKE_INSTALL_PREFIX}/Library") elseif(WIN32) set(opentrack-hier-pfx "modules") set(opentrack-hier-path "/${opentrack-hier-pfx}/") # MUST HAVE A TRAILING BACKSLASH @@ -29,6 +29,7 @@ elseif(WIN32) set(opentrack-i18n-pfx "./i18n") set(opentrack-i18n-path "./i18n") set(opentrack-hier-debug "./debug") + set(opentrack-install-rpath "") else() set(opentrack-hier-pfx "libexec/opentrack") set(opentrack-hier-path "/../${opentrack-hier-pfx}/") # MUST HAVE A TRAILING BACKSLASH @@ -50,9 +51,7 @@ endfunction() set(opentrack-contrib-pfx "${opentrack-doc-pfx}/contrib") set(opentrack-binary-suffix "") -if(APPLE) - set(opentrack-binary-suffix ".bin") -elseif(WIN32) +if(WIN32) set(opentrack-binary-suffix ".exe") endif() diff --git a/cmake/opentrack-install.cmake b/cmake/opentrack-install.cmake index 2b745a82..d464936c 100644 --- a/cmake/opentrack-install.cmake +++ b/cmake/opentrack-install.cmake @@ -71,9 +71,13 @@ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") cleanup_visual_studio_debug() endif() -otr_install_exec("${opentrack-hier-pfx}" FILES "${CMAKE_SOURCE_DIR}/bin/freetrackclient.dll") -otr_install_exec("${opentrack-hier-pfx}" FILES "${CMAKE_SOURCE_DIR}/bin/freetrackclient64.dll") -otr_install_exec("${opentrack-hier-pfx}" FILES +# For now copy third party needed files into a seperate direcvtory instead of the plugins directory +if (APPLE) + set(OSX_POST_INSTALL_DIR "/../thirdparty") +endif() +otr_install_exec("${opentrack-hier-pfx}${OSX_POST_INSTALL_DIR}" FILES "${CMAKE_SOURCE_DIR}/bin/freetrackclient.dll") +otr_install_exec("${opentrack-hier-pfx}${OSX_POST_INSTALL_DIR}" FILES "${CMAKE_SOURCE_DIR}/bin/freetrackclient64.dll") +otr_install_exec("${opentrack-hier-pfx}${OSX_POST_INSTALL_DIR}" FILES "${CMAKE_SOURCE_DIR}/bin/NPClient.dll" "${CMAKE_SOURCE_DIR}/bin/NPClient64.dll" "${CMAKE_SOURCE_DIR}/bin/TrackIR.exe") diff --git a/cmake/opentrack-platform.cmake b/cmake/opentrack-platform.cmake index 02c1b2f8..96d306fa 100644 --- a/cmake/opentrack-platform.cmake +++ b/cmake/opentrack-platform.cmake @@ -54,7 +54,6 @@ set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) set(CMAKE_C_VISIBILITY_PRESET hidden) set(CMAKE_CXX_VISIBILITY_PRESET hidden) -set(CMAKE_MACOSX_RPATH OFF) if(NOT WIN32 AND NOT APPLE) include(opentrack-pkg-config) @@ -155,14 +154,6 @@ if(MSVC) endforeach() endif() -if(APPLE) - add_compile_definitions(-stdlib=libc++) - add_link_options(-stdlib=libc++) - - add_link_options(-framework Cocoa -framework CoreFoundation -framework Carbon) - link_libraries(objc z) -endif() - if(NOT MSVC) include(FindPkgConfig) endif() diff --git a/cmake/opentrack-qt.cmake b/cmake/opentrack-qt.cmake index 8c92483c..650db4fc 100644 --- a/cmake/opentrack-qt.cmake +++ b/cmake/opentrack-qt.cmake @@ -2,19 +2,20 @@ include_guard(GLOBAL) if(WIN32) find_package(Qt5Gui REQUIRED COMPONENTS QWindowsIntegrationPlugin) endif() -find_package(Qt5 REQUIRED COMPONENTS Core Network Widgets LinguistTools Gui QUIET) -find_package(Qt5 COMPONENTS SerialPort QUIET) - -set(MY_QT_LIBS ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Network_LIBRARIES}) +find_package(Qt5 REQUIRED COMPONENTS Core Network Widgets LinguistTools Gui DBus QUIET) +find_package(Qt5 COMPONENTS SerialPort Multimedia QUIET) +set(MY_QT_LIBS ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5DBus_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5Multimedia_LIBRARIES}) function(otr_install_qt_libs) - foreach(i Qt5::Core Qt5::Gui Qt5::Network Qt5::SerialPort Qt5::Widgets) + foreach(i Qt5::Core Qt5::Gui Qt5::DBus Qt5::Network Qt5::SerialPort Qt5::Widgets Qt5::Multimedia) if(NOT TARGET "${i}") continue() endif() otr_install_lib(${i} ".") endforeach() + if(WIN32) otr_install_lib(Qt5::QWindowsIntegrationPlugin "./platforms") + endif() endfunction() otr_install_qt_libs() diff --git a/compat/camera-names.cpp b/compat/camera-names.cpp index 69926e5a..40edba49 100644 --- a/compat/camera-names.cpp +++ b/compat/camera-names.cpp @@ -11,6 +11,10 @@ # include <unistd.h> #endif +#ifdef __APPLE__ +# include <QCameraInfo> +#endif + #ifdef __linux # include <fcntl.h> # include <sys/ioctl.h> @@ -102,5 +106,12 @@ std::vector<QString> get_camera_names() } } #endif +#ifdef __APPLE__ + QList<QCameraInfo> cameras = QCameraInfo::availableCameras(); + foreach (const QCameraInfo &cameraInfo, cameras) { + ret.push_back(cameraInfo.description()); + } +#endif + return ret; } diff --git a/logic/CMakeLists.txt b/logic/CMakeLists.txt index f3f128af..f3344798 100644 --- a/logic/CMakeLists.txt +++ b/logic/CMakeLists.txt @@ -1,7 +1,7 @@ otr_module(logic BIN) -target_link_libraries(opentrack-logic opentrack-spline) +target_link_libraries(${self} opentrack-spline) if(NOT WIN32) - target_link_libraries(opentrack-logic opentrack-qxt-mini) + target_link_libraries(${self} opentrack-qxt-mini) else() - target_link_libraries(opentrack-logic opentrack-dinput winmm) + target_link_libraries(${self} opentrack-dinput winmm) endif() diff --git a/macosx/CMakeLists.txt b/macosx/CMakeLists.txt index 89901251..8520e9e9 100644 --- a/macosx/CMakeLists.txt +++ b/macosx/CMakeLists.txt @@ -1,13 +1,11 @@ if(APPLE) otr_escape_string(srcdir "${CMAKE_SOURCE_DIR}") - otr_escape_string(bindir "${CMAKE_BINARY_DIR}") otr_escape_string(instdir "${CMAKE_INSTALL_PREFIX}") otr_escape_string(commit "${OPENTRACK_COMMIT}") install(CODE " - execute_process(COMMAND /bin/sh \"${srcdir}/macosx/make-app-bundle.sh\" + execute_process(COMMAND /bin/sh \"${srcdir}/macosx/make-app-bundle.sh\" \"${srcdir}/macosx\" \"${instdir}\" - \"${bindir}\" - \"${commit}\") + \"${commit}\") ") endif() diff --git a/macosx/opentrack.app/Contents/Info.plist b/macosx/Info.plist index 41ca402a..3fd8b614 100644 --- a/macosx/opentrack.app/Contents/Info.plist +++ b/macosx/Info.plist @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> <string>en</string> <key>CFBundleExecutable</key> - <string>opentrack.sh</string> + <string>opentrack</string> <key>CFBundleIdentifier</key> <string>com.github.opentrack</string> <key>CFBundleName</key> @@ -22,5 +22,13 @@ <string>opentrack</string> <key>CFBundleSignature</key> <string>????</string> + <key>NSPrincipalClass</key> + <string>NSApplication</string> + <key>NSHighResolutionCapable</key> + <string>True</string> + <key>NSCameraUsageDescription</key> + <string>OpenTrack need's to access your camera to capture track head position.</string> + <key>NSDocumentsFolderUsageDescription</key> + <string>OpenTrack need's to access your to your documents folder to store settings</string> </dict> </plist> diff --git a/macosx/PkgInfo b/macosx/PkgInfo new file mode 100644 index 00000000..6f749b0f --- /dev/null +++ b/macosx/PkgInfo @@ -0,0 +1 @@ +APPL???? diff --git a/macosx/dmgbackground.png b/macosx/dmgbackground.png Binary files differnew file mode 100644 index 00000000..e3a398c0 --- /dev/null +++ b/macosx/dmgbackground.png diff --git a/macosx/install-fail-tool b/macosx/install-fail-tool index a5464c18..16284562 100755 --- a/macosx/install-fail-tool +++ b/macosx/install-fail-tool @@ -4,22 +4,22 @@ test -n "$1" || exit 1 dir="$1" -for i in "$dir"/* "$dir"/*/* "$dir"/*/*/*; do - { test -x "$i" && test -f "$i"; } || continue +for i in "$dir"/*; do + echo $i + { test -f "$i"; } || continue case "$i" in *.dll|*.exe) continue ;; *) : ;; esac - case "$i" in - *.dylib|*.bin) strip -x "$i" ;; esac echo ---- $i ---- install_name_tool -id "@executable_path/$(echo "$i" | sed -e "s,^$dir/,,")" "$i" otool -L "$i" | awk '{ print $1 }' | while read l; do j="$(basename -- "$l")" + echo === $j === if test -e "$dir/$j"; then - install_name_tool -change "$l" "@executable_path/$j" "$i" + install_name_tool -change "$l" "@rpath/$j" "$i" fi done done diff --git a/macosx/make-app-bundle.sh b/macosx/make-app-bundle.sh index 05259702..9265eeb9 100644..100755 --- a/macosx/make-app-bundle.sh +++ b/macosx/make-app-bundle.sh @@ -1,41 +1,90 @@ #!/bin/sh +# exit when any command fails +set -e + +# keep track of the last executed command +trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG +# echo an error message before exiting +trap 'echo "--\n--\n--\n--\n\"${last_command}\" command failed with exit code $?."' EXIT + APPNAME=opentrack +# Alternative we could look at https://github.com/arl/macdeployqtfix ?? -dir="$1" -test -n "$dir" || exit 1 +#macosx directory +dir="$1" +test -n "$dir" +# install directory install="$2" -test -n "$install" || exit 1 -output_dir="$3" -test -n "$output_dir" || exit 1 -version="$4" -test -n "$version" || exit 1 +test -n "$install" +version="$3" +test -n "$version" tmp="$(mktemp -d "/tmp/$APPNAME-tmp.XXXXXXX")" -test $? -eq 0 || exit 1 +test $? -eq 0 + -rm -f -- "$install/.DS_Store" -sh "$dir/install-fail-tool" "$install" +# Add rpath for application so it can find the libraries +#install_name_tool -add_rpath @executable_path/../Frameworks "$install/$APPNAME.app/Contents/MacOS/$APPNAME" -cp -R "$dir/opentrack.app" "$tmp/" || exit 1 -cp -R "$install" "$tmp/$APPNAME.app/Contents/MacOS" || exit 1 -sed -i '' -e "s#@OPENTRACK-VERSION@#$version#g" "$tmp/$APPNAME.app/Contents/Info.plist" || exit 1 +# Copy our own plist and set correct version +cp "$dir/Info.plist" "$install/$APPNAME.app/Contents/" +sed -i '' -e "s#@OPENTRACK-VERSION@#$version#g" "$install/$APPNAME.app/Contents/Info.plist" -mkdir "$tmp/$APPNAME.iconset" || exit 1 -mkdir "$tmp/$APPNAME.app/Contents/Resources" || exit 1 -cp "$dir"/opentrack.sh "$tmp/$APPNAME.app/Contents/MacOS" || exit 1 +# Copy PkgInfo +cp "$dir/PkgInfo" "$install/$APPNAME.app/Contents/" -sips -z 16 16 "$dir/../gui/images/opentrack.png" --out "$tmp/$APPNAME.iconset/icon_16x16.png" || exit 1 -sips -z 32 32 "$dir/../gui/images/opentrack.png" --out "$tmp/$APPNAME.iconset/icon_16x16@2x.png" || exit 1 -sips -z 32 32 "$dir/../gui/images/opentrack.png" --out "$tmp/$APPNAME.iconset/icon_32x32.png" || exit 1 -sips -z 64 64 "$dir/../gui/images/opentrack.png" --out "$tmp/$APPNAME.iconset/icon_32x32@2x.png" || exit 1 -sips -z 128 128 "$dir/../gui/images/opentrack.png" --out "$tmp/$APPNAME.iconset/icon_128x128.png" || exit 1 +# Copy plugins +mkdir -p "$install/$APPNAME.app/Contents/MacOS/Plugins" +cp -r "$install/Plugins" "$install/$APPNAME.app/Contents/MacOS/" -iconutil -c icns -o "$tmp/$APPNAME.app/Contents/Resources/$APPNAME.icns" "$tmp/$APPNAME.iconset" -rm -r "$tmp/$APPNAME.iconset" +# Add framework and other libraries and fixup other libraries +macdeployqt "$install/$APPNAME.app" -libpath="$install/Library" +sh "$dir/install-fail-tool" "$install/$APPNAME.app/Contents/Frameworks" -cd "$tmp" || exit 1 -rm -f "$output_dir/$version-macosx.zip" -zip -9r "$output_dir/$version-macosx.zip" "$APPNAME.app" || exit 1 +# Create an 512 resolution size for the icon (for retina displays mostly) +#gm convert -size 512x512 "$dir/../gui/images/opentrack.png" "$tmp/opentrack.png" +convert "$dir/../gui/images/opentrack.png" -filter triangle -resize 512x512 "$tmp/opentrack.png" + +# Build iconset +mkdir "$tmp/$APPNAME.iconset" +sips -z 16 16 "$tmp/opentrack.png" --out "$tmp/$APPNAME.iconset/icon_16x16.png" +sips -z 32 32 "$tmp/opentrack.png" --out "$tmp/$APPNAME.iconset/icon_16x16@2x.png" +sips -z 32 32 "$tmp/opentrack.png" --out "$tmp/$APPNAME.iconset/icon_32x32.png" +sips -z 64 64 "$tmp/opentrack.png" --out "$tmp/$APPNAME.iconset/icon_32x32@2x.png" +sips -z 128 128 "$tmp/opentrack.png" --out "$tmp/$APPNAME.iconset/icon_128x128.png" +sips -z 256 256 "$tmp/opentrack.png" --out "$tmp/$APPNAME.iconset/icon_128x128@2x.png" +sips -z 512 512 "$tmp/opentrack.png" --out "$tmp/$APPNAME.iconset/icon_256x256@2x.png" +sips -z 512 512 "$tmp/opentrack.png" --out "$tmp/$APPNAME.iconset/icon_512x512.png" +iconutil -c icns -o "$install/$APPNAME.app/Contents/Resources/$APPNAME.icns" "$tmp/$APPNAME.iconset" rm -rf "$tmp" -ls -lh "$output_dir/$version-macosx.zip" + +#Build DMG +#https://github.com/andreyvit/create-dmg +rm -rf $install/../*.dmg +create-dmg \ + --volname "$APPNAME" \ + --volicon "$install/$APPNAME.app/Contents/Resources/$APPNAME.icns" \ + --window-pos 200 120 \ + --window-size 800 450 \ + --icon-size 80 \ + --background "$dir/dmgbackground.png" \ + --icon "$APPNAME.app" 200 180 \ + --app-drop-link 420 180 \ + --hide-extension "$APPNAME.app" \ + --no-internet-enable \ + --add-folder "Document" "$install/doc" 20 40 \ + --add-folder "source-code" "$install/source-code" 220 40 \ + --add-folder "Xplane-Plugin" "$install/xplane" 420 40 \ + --add-folder "thirdparty" "$install/thirdparty" 620 40 \ + "$version.dmg" \ + "$install/$APPNAME.app" + +# Check if we have a DMG otherwise fail +FILE=$install/../$version.dmg +if [ -f $FILE ]; then + ls -ial $install/../*.dmg +else + echo "Failed to create ${FILE}" + exit 2 +fi diff --git a/macosx/opentrack.app/Contents/PkgInfo b/macosx/opentrack.app/Contents/PkgInfo deleted file mode 100644 index b18f8c6c..00000000 --- a/macosx/opentrack.app/Contents/PkgInfo +++ /dev/null @@ -1 +0,0 @@ -APPLopentrack diff --git a/macosx/opentrack.sh b/macosx/opentrack.sh deleted file mode 100755 index 74a911e2..00000000 --- a/macosx/opentrack.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -cd -- "$(dirname -- "$0")" && -exec ./opentrack.bin -platformpluginpath "$(pwd)" "$@" - -exit 1 diff --git a/migration/CMakeLists.txt b/migration/CMakeLists.txt index b2dfac6d..effeddcb 100644 --- a/migration/CMakeLists.txt +++ b/migration/CMakeLists.txt @@ -1,5 +1,5 @@ otr_module(migration BIN) -target_link_libraries(opentrack-migration opentrack-logic opentrack-spline) +target_link_libraries(${self} opentrack-logic opentrack-spline) if(CMAKE_COMPILER_IS_CLANGXX) target_compile_options(${self} PRIVATE -Wno-weak-vtables) endif() diff --git a/opentrack/main-window.cpp b/opentrack/main-window.cpp index cd715216..9bacff6e 100644 --- a/opentrack/main-window.cpp +++ b/opentrack/main-window.cpp @@ -34,7 +34,7 @@ main_window::main_window() : State(OPENTRACK_BASE_PATH + OPENTRACK_LIBRARY_PATH) { ui.setupUi(this); -#if !defined _WIN32 && !defined __APPLE__ +#if !defined _WIN32 annoy_if_root(); #endif diff --git a/options/globals.cpp b/options/globals.cpp index 099a7208..386ef56d 100644 --- a/options/globals.cpp +++ b/options/globals.cpp @@ -154,8 +154,8 @@ fail: constexpr const char* subdir = "ini"; QString dir = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation).value(0, QString()); if (dir.isEmpty()) goto fail; -#if !defined _WIN32 && !defined __APPLE__ const QString fmt = QStringLiteral("%1/%2"); +#if !defined _WIN32 && !defined __APPLE__ if (!QFile::exists(fmt.arg(dir, OPENTRACK_ORG))) { dir = QStandardPaths::standardLocations(QStandardPaths::ConfigLocation).value(0, QString()); diff --git a/pose-widget/CMakeLists.txt b/pose-widget/CMakeLists.txt index fd109bc3..28dc918b 100644 --- a/pose-widget/CMakeLists.txt +++ b/pose-widget/CMakeLists.txt @@ -1,2 +1,2 @@ otr_module(pose-widget BIN) -target_link_libraries(opentrack-pose-widget) +target_link_libraries(${self}) diff --git a/proto-iokit-foohid/CMakeLists.txt b/proto-iokit-foohid/CMakeLists.txt index 31d3dcdc..6a4bf89a 100644 --- a/proto-iokit-foohid/CMakeLists.txt +++ b/proto-iokit-foohid/CMakeLists.txt @@ -1,4 +1,4 @@ -if(CMAKE_SYSTEM_NAME MATCHES "Darwin") +if(APPLE) otr_module(proto-iokit-foohid) target_link_options(${self} PRIVATE -framework IOKit) endif() diff --git a/proto-iokit-foohid/foohidjoystick.cpp b/proto-iokit-foohid/foohidjoystick.cpp index 0b305d08..898db2f4 100644 --- a/proto-iokit-foohid/foohidjoystick.cpp +++ b/proto-iokit-foohid/foohidjoystick.cpp @@ -51,7 +51,7 @@ static bool connectToService(io_connect_t *connection, QString *errorMessage) IOServiceMatching(FOOHID_SERVICE_NAME), &iterator); if (ret != KERN_SUCCESS) { - *errorMessage = otr_tr("Unable to find FooHID IOService."); + *errorMessage = QObject::tr("Unable to find FooHID IOService."); return false; } // Iterate over services and try to open connection @@ -66,7 +66,7 @@ static bool connectToService(io_connect_t *connection, QString *errorMessage) } IOObjectRelease(iterator); if (!found) { - *errorMessage = otr_tr("Unable to connect to FooHID IOService."); + *errorMessage = QObject::tr("Unable to connect to FooHID IOService."); return false; } return true; @@ -89,7 +89,7 @@ FooHIDJoystick::FooHIDJoystick(const QByteArray &name, const QByteArray &serialN deviceCreated = createDevice(); _hasError = !deviceCreated; if (!deviceCreated) - _errorMessage = otr_tr("Failed to create virtual joystick"); + _errorMessage = tr("Failed to create virtual joystick"); } } @@ -116,7 +116,7 @@ void FooHIDJoystick::setValue(JoystickValues newValues) values = newValues; if (!sendToDevice()) { _hasError = true; - _errorMessage = otr_tr("Failed to send values to virtual joystick"); + _errorMessage = tr("Failed to send values to virtual joystick"); } } diff --git a/proto-iokit-foohid/foohidjoystick.h b/proto-iokit-foohid/foohidjoystick.h index a1f74304..e987c229 100644 --- a/proto-iokit-foohid/foohidjoystick.h +++ b/proto-iokit-foohid/foohidjoystick.h @@ -9,6 +9,7 @@ #include <QByteArray> #include <QString> +#include <QCoreApplication> #include <IOKit/IOKitLib.h> @@ -23,6 +24,7 @@ struct JoystickValues { class FooHIDJoystick { + Q_DECLARE_TR_FUNCTIONS(FooHIDJoystick) public: FooHIDJoystick(const QByteArray &name, const QByteArray &serialNumber); ~FooHIDJoystick(); diff --git a/proto-iokit-foohid/iokitprotocol.cpp b/proto-iokit-foohid/iokitprotocol.cpp index 6f163d8f..abc43a60 100644 --- a/proto-iokit-foohid/iokitprotocol.cpp +++ b/proto-iokit-foohid/iokitprotocol.cpp @@ -25,14 +25,14 @@ IOKitProtocol::IOKitProtocol() module_status IOKitProtocol::initialize() { if (!joystick) - return otr_tr("Load failure"); + return tr("Load failure"); if (joystick->hasError()) { QString msg = joystick->errorMessage(); if (msg.isEmpty()) - msg = otr_tr("Unknown error"); + msg = tr("Unknown error"); return error(msg); } diff --git a/qxt-mini/CMakeLists.txt b/qxt-mini/CMakeLists.txt index 21b2b160..1b2496f6 100644 --- a/qxt-mini/CMakeLists.txt +++ b/qxt-mini/CMakeLists.txt @@ -3,7 +3,9 @@ if(UNIX OR APPLE) include_directories(SYSTEM ${Qt5Gui_PRIVATE_INCLUDE_DIRS}) otr_module(qxt-mini NO-COMPAT BIN) if(APPLE) - target_link_options(${self} PUBLIC -framework Carbon -framework CoreFoundation) + find_library(CoreFoundation CoreFoundation) + find_library(Carbon Carbon) + target_link_options(${self} PUBLIC -framework Carbon -I ${CoreFoundation}) else() otr_pkgconfig(${self} x11 xcb xproto) endif() diff --git a/video-ps3eye/CMakeLists.txt b/video-ps3eye/CMakeLists.txt index 2fac5f9c..d42c83ff 100644 --- a/video-ps3eye/CMakeLists.txt +++ b/video-ps3eye/CMakeLists.txt @@ -53,4 +53,4 @@ endif() if(TARGET ps3eye-frame-test) install(TARGETS "ps3eye-frame-test" DESTINATION "${opentrack-hier-pfx}") -endif() +endif()
\ No newline at end of file diff --git a/x-plane-plugin/CMakeLists.txt b/x-plane-plugin/CMakeLists.txt index 1d686d98..54bcaf34 100644 --- a/x-plane-plugin/CMakeLists.txt +++ b/x-plane-plugin/CMakeLists.txt @@ -2,19 +2,30 @@ if(LINUX OR APPLE) set(SDK_XPLANE "" CACHE PATH "Path to the X-Plane SDK") if(SDK_XPLANE) - otr_module(xplane-plugin NO-QT) + if (APPLE) + otr_module(xplane-plugin NO-QT NO-INSTALL) + else() + otr_module(xplane-plugin NO-QT) + endif() # probably librt already included - #install(FILES ${opentrack-xplane-plugin-c} DESTINATION "${opentrack-doc-src-pfx}/opentrack-xplane-plugin") - target_include_directories(opentrack-xplane-plugin SYSTEM PUBLIC ${SDK_XPLANE}/CHeaders ${SDK_XPLANE}/CHeaders/XPLM) + #install(FILES ${opentrack-xplane-plugin-c} DESTINATION "opentrack-hier-pfx") + target_include_directories(opentrack-xplane-plugin SYSTEM PUBLIC ${SDK_XPLANE}/CHeaders/XPLM) if(APPLE) target_compile_options(${self} PRIVATE -iframework "${SDK_XPLANE}/Libraries/Mac/" - -DAPL -DXPLM200 -DXPLM210 - -framework XPLM -framework XPWidgets) - target_link_options(${self} + -DAPL -DXPLM200 -DXPLM210 + -framework XPLM) + target_link_options(${self} PRIVATE "-F${SDK_XPLANE}/Libraries/Mac/" - -framework XPLM -framework XPWidgets) + -framework XPLM) + + install(TARGETS "${self}" + RUNTIME DESTINATION ${opentrack-hier-bin}/xplane + BUNDLE DESTINATION ${opentrack-hier-bin}/xplane + LIBRARY DESTINATION ${opentrack-hier-bin}/xplane + PERMISSIONS ${opentrack-perms-exec}) + elseif(CMAKE_COMPILER_IS_GNUCXX) target_compile_options(${self} PRIVATE -DLIN -DXPLM200 -DXPLM210) target_link_options(${self} PRIVATE -rdynamic -nodefaultlibs) |