diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | CMakeLists.txt | 9 | ||||
-rw-r--r-- | cmake/opentrack-boilerplate.cmake | 33 | ||||
-rw-r--r-- | cmake/opentrack-hier.cmake | 21 | ||||
-rw-r--r-- | cmake/opentrack-install.cmake | 2 | ||||
-rw-r--r-- | cmake/opentrack-platform.cmake | 20 | ||||
-rw-r--r-- | cmake/opentrack-qt.cmake | 9 | ||||
-rw-r--r-- | logic/CMakeLists.txt | 6 | ||||
-rw-r--r-- | macosx/CMakeLists.txt | 6 | ||||
-rw-r--r-- | macosx/Info.plist (renamed from macosx/opentrack.app/Contents/Info.plist) | 4 | ||||
-rw-r--r-- | macosx/PkgInfo | 1 | ||||
-rwxr-xr-x | macosx/install-fail-tool | 10 | ||||
-rwxr-xr-x | macosx/make-app-bundle.sh | 41 | ||||
-rw-r--r-- | macosx/opentrack.app/Contents/PkgInfo | 1 | ||||
-rwxr-xr-x | macosx/opentrack.sh | 2 | ||||
-rw-r--r-- | migration/CMakeLists.txt | 2 | ||||
-rw-r--r-- | modules.txt | 37 | ||||
-rw-r--r-- | pose-widget/CMakeLists.txt | 2 | ||||
-rw-r--r-- | x-plane-plugin/CMakeLists.txt | 15 |
19 files changed, 145 insertions, 77 deletions
@@ -7,3 +7,4 @@ /.vs/ /CMakeSettings.json .gtm/ +.vscode 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() diff --git a/cmake/opentrack-boilerplate.cmake b/cmake/opentrack-boilerplate.cmake index ffa4ea02..7e9231ed 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}/opentrack.app/Contents/MacOS/ + 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..c94c6d57 100644 --- a/cmake/opentrack-hier.cmake +++ b/cmake/opentrack-hier.cmake @@ -9,38 +9,41 @@ 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 "${CMAKE_INSTALL_PREFIX}/opentrack.app/Contents/MacOS/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 "./") + set(opentrack-hier-str RUNTIME DESTINATION ${opentrack-hier-pfx} LIBRARY DESTINATION ${opentrack-hier-pfx}) elseif(WIN32) set(opentrack-hier-pfx "modules") set(opentrack-hier-path "/${opentrack-hier-pfx}/") # MUST HAVE A TRAILING BACKSLASH set(opentrack-hier-doc "/doc/") # MUST HAVE A TRAILING BACKSLASH set(opentrack-hier-bin ".") + set(opentrack-hier-str RUNTIME DESTINATION ${opentrack-hier-pfx} LIBRARY DESTINATION ${opentrack-hier-pfx}) set(opentrack-doc-pfx "./doc") set(opentrack-doc-src-pfx "./source-code") 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 set(opentrack-hier-doc "/share/doc/opentrack/") # MUST HAVE A TRAILING BACKSLASH set(opentrack-hier-bin "bin") + set(opentrack-hier-str RUNTIME DESTINATION ${opentrack-hier-pfx} LIBRARY DESTINATION ${opentrack-hier-pfx}) set(opentrack-doc-pfx "./share/doc/opentrack") set(opentrack-doc-src-pfx "./share/doc/opentrack/source-code") set(opentrack-install-rpath "${CMAKE_INSTALL_PREFIX}/${opentrack-hier-pfx}") set(opentrack-i18n-pfx "./share/opentrack/i18n") set(opentrack-i18n-path "../share/opentrack/i18n") endif() -set(opentrack-hier-str RUNTIME DESTINATION ${opentrack-hier-pfx} LIBRARY DESTINATION ${opentrack-hier-pfx}) function(otr_escape_string var str) string(REGEX REPLACE "([^_A-Za-z0-9./:-])" "\\\\\\1" str "${str}") @@ -50,9 +53,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..784cf59a 100644 --- a/cmake/opentrack-install.cmake +++ b/cmake/opentrack-install.cmake @@ -71,9 +71,11 @@ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") cleanup_visual_studio_debug() endif() +if (NOT APPLE) 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 "${CMAKE_SOURCE_DIR}/bin/NPClient.dll" "${CMAKE_SOURCE_DIR}/bin/NPClient64.dll" "${CMAKE_SOURCE_DIR}/bin/TrackIR.exe") +endif()
\ No newline at end of file diff --git a/cmake/opentrack-platform.cmake b/cmake/opentrack-platform.cmake index 0ebe53a7..35de63a4 100644 --- a/cmake/opentrack-platform.cmake +++ b/cmake/opentrack-platform.cmake @@ -43,10 +43,12 @@ set(CMAKE_CXX_STANDARD_DEFAULT 17) set(CMAKE_CXX_STANDARD_REQUIRED TRUE) set(CMAKE_CXX_EXTENSIONS FALSE) -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) +IF (NOT APPLE) + 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) +endif() set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC OFF) set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) @@ -155,16 +157,6 @@ if(MSVC) endforeach() endif() -if(APPLE) - # Removed because of Macro error - # add_compile_definitions(-stdlib=libc++) - add_link_options(-stdlib=libc++) - - # Build failure cannot link to frameworks - #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 a13afc97..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 REQUIRED COMPONENTS Core Network Widgets LinguistTools Gui DBus QUIET) find_package(Qt5 COMPONENTS SerialPort Multimedia QUIET) -set(MY_QT_LIBS ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5Multimedia_LIBRARIES}) - +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 Qt5::Multimedia) + 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/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..38b8e0e7 100644 --- a/macosx/opentrack.app/Contents/Info.plist +++ b/macosx/Info.plist @@ -22,5 +22,9 @@ <string>opentrack</string> <key>CFBundleSignature</key> <string>????</string> + <key>NSPrincipalClass</key> + <string>NSApplication</string> + <key>NSHighResolutionCapable</key> + <string>True</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/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..5181b141 100755 --- a/macosx/make-app-bundle.sh +++ b/macosx/make-app-bundle.sh @@ -1,41 +1,42 @@ #!/bin/sh APPNAME=opentrack +# Alternative we could look at https://github.com/arl/macdeployqtfix ?? -dir="$1" +#macosx directory +dir="$1" test -n "$dir" || exit 1 +# install directory install="$2" test -n "$install" || exit 1 -output_dir="$3" -test -n "$output_dir" || exit 1 -version="$4" +version="$3" 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" +# Add framework and other libraries +macdeployqt "$install/$APPNAME.app" -libpath="$install/$APPNAME.app/Contents/MacOS" -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 +# Fixup dylib linker issues +sh "$dir/install-fail-tool" "$install/$APPNAME.app/Contents/Frameworks" -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 our own plist and set correct version +cp "$dir/Info.plist" "$install/$APPNAME.app/Contents/" +cp "$dir/PkgInfo" "$install/$APPNAME.app/Contents/" +cp "$dir/opentrack.sh" "$install/$APPNAME.app/Contents/MacOS/" +sed -i '' -e "s#@OPENTRACK-VERSION@#$version#g" "$install/$APPNAME.app/Contents/Info.plist" || exit 1 +# Build iconset +mkdir "$tmp/$APPNAME.iconset" || exit 1 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 - -iconutil -c icns -o "$tmp/$APPNAME.app/Contents/Resources/$APPNAME.icns" "$tmp/$APPNAME.iconset" -rm -r "$tmp/$APPNAME.iconset" - -cd "$tmp" || exit 1 -rm -f "$output_dir/$version-macosx.zip" -zip -9r "$output_dir/$version-macosx.zip" "$APPNAME.app" || exit 1 +iconutil -c icns -o "$install/$APPNAME.app/Contents/Resources/$APPNAME.icns" "$tmp/$APPNAME.iconset" rm -rf "$tmp" -ls -lh "$output_dir/$version-macosx.zip" + +# Zip it up +#zip -9r "$install/$version-macosx.zip" "$APPNAME.app" || exit 1 +#ls -lh "$install/$version-macosx.zip" 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 index 74a911e2..788afe96 100755 --- a/macosx/opentrack.sh +++ b/macosx/opentrack.sh @@ -1,6 +1,6 @@ #!/bin/sh cd -- "$(dirname -- "$0")" && -exec ./opentrack.bin -platformpluginpath "$(pwd)" "$@" +exec ./opentrack -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/modules.txt b/modules.txt new file mode 100644 index 00000000..c9c96a43 --- /dev/null +++ b/modules.txt @@ -0,0 +1,37 @@ +Not copied +-------------- +logic BIN target_link_libraries(${self} opentrack-spline) +migration BIN target_link_libraries(${self} opentrack-logic opentrack-spline) +pose-widget BIN #target_link_libraries(${self}) +user-interface BIN target_link_libraries(${self} opentrack-migration opentrack-logic opentrack-spline opentrack-pose-widget) + +copied and fixed +-------------- +api NO-COMPAT BIN +compat NO-COMPAT BIN +options NO-COMPAT BIN target_link_libraries(opentrack-options opentrack-compat) +qtx-mini NO-COMPAT BIN +spline BIN +video BIN + + +boiler +-------------- + if(NOT arg_NO-COMPAT) + target_link_libraries(${n} opentrack-api opentrack-options opentrack-compat) + endif() + +opentrack +-------------- +target_link_libraries(${self} opentrack-user-interface opentrack-version) + +from opentrack mainwindow +-------------- +Most lickly not used + foreach(k user-interface logic pose-widget migration spline) + target_link_libraries(${self} opentrack-${k}) + endforeach() + +trackmouse +-------------- +target_link_libraries(${self} opentrack-user-interface opentrack-version)
\ No newline at end of file diff --git a/pose-widget/CMakeLists.txt b/pose-widget/CMakeLists.txt index fd109bc3..7c196e80 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/x-plane-plugin/CMakeLists.txt b/x-plane-plugin/CMakeLists.txt index 1d985091..54bcaf34 100644 --- a/x-plane-plugin/CMakeLists.txt +++ b/x-plane-plugin/CMakeLists.txt @@ -2,9 +2,13 @@ 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") + #install(FILES ${opentrack-xplane-plugin-c} DESTINATION "opentrack-hier-pfx") target_include_directories(opentrack-xplane-plugin SYSTEM PUBLIC ${SDK_XPLANE}/CHeaders/XPLM) if(APPLE) @@ -15,6 +19,13 @@ if(LINUX OR APPLE) target_link_options(${self} PRIVATE "-F${SDK_XPLANE}/Libraries/Mac/" -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) |