diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2015-07-19 11:11:13 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2015-07-19 11:12:04 +0200 |
commit | 84044ec3f6fe9ea90f3601b880d96be989fb7d79 (patch) | |
tree | 7b5b53cc0ace4b701a8f7a37289f7d8827e3d81f | |
parent | 64a6892e8713c69e1f5ade929ec8035146de3f56 (diff) |
fix osx, app bundle now builds
-rw-r--r-- | CMakeLists.txt | 24 | ||||
-rw-r--r-- | ftnoir_filter_accela/ftnoir_filter_accela.cpp | 6 | ||||
-rw-r--r-- | ftnoir_filter_kalman/kalman.cpp | 2 | ||||
-rw-r--r-- | ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx | 4 | ||||
-rw-r--r-- | ftnoir_protocol_wine/wine-shm.h | 5 | ||||
-rwxr-xr-x | install-fail-tool | 19 | ||||
-rwxr-xr-x | macosx/install-fail-tool | 25 | ||||
-rw-r--r-- | macosx/make-app-bundle.sh | 22 | ||||
-rw-r--r-- | macosx/opentrack.app/Contents/Info.plist | 20 | ||||
-rw-r--r-- | macosx/opentrack.app/Contents/PkgInfo | 1 | ||||
-rw-r--r-- | macosx/qt.conf | 2 | ||||
-rw-r--r-- | opentrack/simple-mat.hpp | 4 | ||||
-rw-r--r-- | pose-widget/glwidget.cpp | 4 | ||||
-rw-r--r-- | qfunctionconfigurator/functionconfig.cpp | 3 |
14 files changed, 86 insertions, 55 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index ece3165b..b74ec7f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,11 +61,13 @@ if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE) endif() if(APPLE) + set(CMAKE_MACOSX_RPATH OFF) set(apple-frameworks "-stdlib=libc++ -framework Cocoa -framework CoreFoundation -lobjc -lz -framework Carbon") set(CMAKE_SHARED_LINKER_FLAGS " ${apple-frameworks} ${CMAKE_SHARED_LINKER_FLAGS}") - set(CMAKE_STATIC_LINKER_FLAGS " ${apple-frameworks} ${CMAKE_STATIC_LINKER_FLAGS}") + #set(CMAKE_STATIC_LINKER_FLAGS " ${apple-frameworks} ${CMAKE_STATIC_LINKER_FLAGS}") set(CMAKE_EXE_LINKER_FLAGS " ${apple-frameworks} ${CMAKE_EXE_LINKER_FLAGS}") set(CMAKE_MODULE_LINKER_FLAGS " ${apple-frameworks} ${CMAKE_MODULE_LINKER_FLAGS}") + set(CMAKE_CXX_FLAGS " -stdlib=libc++ ${CMAKE_CXX_FLAGS}") endif() if(CMAKE_COMPILER_IS_GNUCXX OR APPLE) @@ -340,11 +342,9 @@ if(SDK_WINE_PREFIX) add_custom_command( OUTPUT opentrack-wrapper-wine.exe.so DEPENDS ${wine-deps} - COMMAND ${SDK_WINE_PREFIX}/bin/wineg++ -g -O2 -m32 -std=c++11 -o + COMMAND ${SDK_WINE_PREFIX}/bin/wineg++ -g -DNOMINMAX -O2 -m32 -std=c++11 -o opentrack-wrapper-wine.exe -I "${CMAKE_SOURCE_DIR}" - ${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 + ${wine-deps} ${my-rt}) add_custom_target(wine-wrapper ALL DEPENDS opentrack-wrapper-wine.exe.so) add_dependencies(opentrack-proto-wine wine-wrapper) @@ -352,13 +352,6 @@ if(SDK_WINE_PREFIX) endif() endif() -if(APPLE) - install(CODE " -execute_process(COMMAND /bin/sh \"\${CMAKE_SOURCE_DIR}/macosx/make-app-bundle.sh\" - \"\${CMAKE_SOURCE_DIR}/macosx\" \"\${CMAKE_INSTALL_PREFIX}\" \"\${CMAKE_BUILD_DIR}\" \"\${OPENTRACK__COMMIT}\") -") -endif() - opentrack_library(opentrack-tracker-udp ftnoir_tracker_udp) opentrack_library(opentrack-tracker-freepie-udp ftnoir_tracker_freepie-udp) @@ -552,7 +545,12 @@ endif() install(DIRECTORY "${CMAKE_SOURCE_DIR}/bin/camera" DESTINATION .) if(APPLE) + install(FILES "${CMAKE_SOURCE_DIR}/macosx/qt.conf" DESTINATION .) install(CODE " - execute_process(COMMAND /bin/sh \"${CMAKE_SOURCE_DIR}/install-fail-tool\" \"${CMAKE_INSTALL_PREFIX}\") + execute_process(COMMAND /bin/sh \"${CMAKE_SOURCE_DIR}/macosx/make-app-bundle.sh\" + \"${CMAKE_SOURCE_DIR}/macosx\" + \"${CMAKE_INSTALL_PREFIX}\" + \"${CMAKE_BINARY_DIR}\" + \"${OPENTRACK__COMMIT}\") ") endif() diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.cpp b/ftnoir_filter_accela/ftnoir_filter_accela.cpp index c4b329e1..f8bd2ab1 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela.cpp @@ -37,6 +37,12 @@ static constexpr double trans_gains[][2] = { { -1, 0 } }; +constexpr double settings_accela::mult_rot; +constexpr double settings_accela::mult_trans; +constexpr double settings_accela::mult_rot_dz; +constexpr double settings_accela::mult_trans_dz; +constexpr double settings_accela::mult_ewma; + FTNoIR_Filter::FTNoIR_Filter() : first_run(true) { rot.setMaxInput(rot_gains[0][0]); diff --git a/ftnoir_filter_kalman/kalman.cpp b/ftnoir_filter_kalman/kalman.cpp index f0b9e261..39a08703 100644 --- a/ftnoir_filter_kalman/kalman.cpp +++ b/ftnoir_filter_kalman/kalman.cpp @@ -9,6 +9,8 @@ #include <QDebug> #include <cmath> +constexpr double settings::mult_noise_stddev; + FTNoIR_Filter::FTNoIR_Filter() { reset(); prev_slider_pos = s.noise_stddev_slider; diff --git a/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx b/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx index 78fa549b..026135f0 100644 --- a/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx +++ b/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx @@ -1,4 +1,8 @@ #include <cerrno> +// OSX sdk 10.8 build error otherwise +#ifdef _LIBCPP_MSVCRT +# undef _LIBCPP_MSVCRT +#endif #include <cstdio> #include "freetrackclient/fttypes.h" #include "ftnoir_protocol_wine/wine-shm.h" diff --git a/ftnoir_protocol_wine/wine-shm.h b/ftnoir_protocol_wine/wine-shm.h index c0f29cd3..c7e29abb 100644 --- a/ftnoir_protocol_wine/wine-shm.h +++ b/ftnoir_protocol_wine/wine-shm.h @@ -3,6 +3,11 @@ #define WINE_SHM_NAME "facetracknoir-wine-shm" #define WINE_MTX_NAME "facetracknoir-wine-mtx" +// OSX sdk 10.8 build error otherwise +#ifdef _LIBCPP_MSVCRT +# undef _LIBCPP_MSVCRT +#endif + #include <memory> template<typename t> using ptr = std::shared_ptr<t>; diff --git a/install-fail-tool b/install-fail-tool deleted file mode 100755 index 99f8fbdf..00000000 --- a/install-fail-tool +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -test -n "$1" || exit 1 - -dir="$1" - -for i in "$dir"/* "$dir"/*/*; do - { test -x "$i" && test -f "$i"; } || continue - echo ---- $i ---- - install_name_tool -id "@executable_path/$(basename -- "$i")" "$i" - - otool -L "$i" | awk '{ print $1 }' | - while read l; do - j="$(basename -- "$l")" - if test -e "$dir/$j"; then - install_name_tool -change "$l" "@executable_path/$j" "$i" - fi - done -done diff --git a/macosx/install-fail-tool b/macosx/install-fail-tool new file mode 100755 index 00000000..0f34c3a1 --- /dev/null +++ b/macosx/install-fail-tool @@ -0,0 +1,25 @@ +#!/bin/sh + +test -n "$1" || exit 1 + +dir="$1" + +for i in "$dir"/* "$dir"/*/*; do + { test -x "$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/$(basename -- "$i")" "$i" + + otool -L "$i" | awk '{ print $1 }' | + while read l; do + j="$(basename -- "$l")" + if test -e "$dir/$j"; then + install_name_tool -change "$l" "@executable_path/$j" "$i" + fi + done +done diff --git a/macosx/make-app-bundle.sh b/macosx/make-app-bundle.sh index 390f7af1..7e79d6db 100644 --- a/macosx/make-app-bundle.sh +++ b/macosx/make-app-bundle.sh @@ -4,7 +4,7 @@ APPNAME=opentrack dir="$1" test -n "$dir" || exit 1 -install="$1" +install="$2" test -n "$install" || exit 1 output_dir="$3" test -n "$output_dir" || exit 1 @@ -14,12 +14,16 @@ test -n "$version" || exit 1 tmp="$(mktemp -d "/tmp/$APPNAME-tmp.XXXXXXX")" test $? -eq 0 || exit 1 -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 +"$dir/install-fail-tool" "$install" -rm -rf "$tmp/$APPNAME.iconset" -mkdir "$tmp/$APPNAME.iconset" +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 + +#cp "$dir/qt.conf" "$tmp/$APPNAME.app/Contents/MacOS" || exit 1 + +mkdir "$tmp/$APPNAME.iconset" || exit 1 +mkdir "$tmp/$APPNAME.app/Contents/Resources" || exit 1 sips -z 16 16 "$dir/../facetracknoir/images/facetracknoir.png" --out "$tmp/$APPNAME.iconset/icon_16x16.png" || exit 1 sips -z 32 32 "$dir/../facetracknoir/images/facetracknoir.png" --out "$tmp/$APPNAME.iconset/icon_16x16@2x.png" || exit 1 @@ -31,5 +35,7 @@ iconutil -c icns -o "$tmp/$APPNAME.app/Contents/Resources/$APPNAME.icns" "$tmp/$ rm -r "$tmp/$APPNAME.iconset" cd "$tmp" || exit 1 -zip -9 "$output_dir/$APPNAME-$version.zip" "$APPNAME.app" || exit 1 -ls -lh "$output_dir/$APPNAME-$version.zip"
\ No newline at end of file +rm -f "$output_dir/$APPNAME-$version.zip" +zip -9r "$output_dir/$APPNAME-$version.zip" "$APPNAME.app" || exit 1 +rm -rf "$tmp" +ls -lh "$output_dir/$APPNAME-$version.zip" diff --git a/macosx/opentrack.app/Contents/Info.plist b/macosx/opentrack.app/Contents/Info.plist index 60791ba9..ed4b0b05 100644 --- a/macosx/opentrack.app/Contents/Info.plist +++ b/macosx/opentrack.app/Contents/Info.plist @@ -1,9 +1,9 @@ <?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 Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> - <key>CFBundleGetInfoString</key> - <string>@OPENTRACK-VERSION@</string> + <key>CFBundleDevelopmentRegion</key> + <string>en</string> <key>CFBundleExecutable</key> <string>opentrack.bin</string> <key>CFBundleIdentifier</key> @@ -12,15 +12,15 @@ <string>opentrack</string> <key>CFBundleIconFile</key> <string>opentrack.icns</string> - <key>CFBundleShortVersionString</key> - <string>0.01</string> + <key>CFBundleVersion</key> + <string>@OPENTRACK-VERSION@</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundlePackageType</key> <string>APPL</string> - <key>IFMajorVersion</key> - <integer>0</integer> - <key>IFMinorVersion</key> - <integer>1</integer> + <key>CFBundleDisplayName</key> + <string>opentrack</string> + <key>CFBundleSignature</key> + <string>????</string> </dict> -</plist>
\ No newline at end of file +</plist> diff --git a/macosx/opentrack.app/Contents/PkgInfo b/macosx/opentrack.app/Contents/PkgInfo new file mode 100644 index 00000000..b18f8c6c --- /dev/null +++ b/macosx/opentrack.app/Contents/PkgInfo @@ -0,0 +1 @@ +APPLopentrack diff --git a/macosx/qt.conf b/macosx/qt.conf new file mode 100644 index 00000000..e69f24eb --- /dev/null +++ b/macosx/qt.conf @@ -0,0 +1,2 @@ +[Paths] +Plugins = . diff --git a/opentrack/simple-mat.hpp b/opentrack/simple-mat.hpp index e111305a..7432e665 100644 --- a/opentrack/simple-mat.hpp +++ b/opentrack/simple-mat.hpp @@ -107,7 +107,7 @@ struct Mat { Mat<num, h_, w_> ret; for (int j = 0; j < h_; j++) - for (int i = 0; i < w; i++) + for (int i = 0; i < w_; i++) ret(j, i) = this->operator ()(j, i) + other(j, i); return ret; } @@ -125,7 +125,7 @@ struct Mat { Mat<num, h_, w_> ret; for (int j = 0; j < h_; j++) - for (int i = 0; i < w; i++) + for (int i = 0; i < w_; i++) ret(j, i) = this->operator ()(j, i) + other; return ret; } diff --git a/pose-widget/glwidget.cpp b/pose-widget/glwidget.cpp index 66527a57..ed4560af 100644 --- a/pose-widget/glwidget.cpp +++ b/pose-widget/glwidget.cpp @@ -193,10 +193,10 @@ vec2 GLWidget::project(const vec3 &point) double z = std::max(.75, 1. + translation.z()/-60.); int w = width(), h = height(); double x = w * translation.x() / 2. / -40.; - if (abs(x) > w/2) + if (std::abs(x) > w/2) x = x > 0 ? w/2 : w/-2; double y = h * translation.y() / 2. / -40.; - if (abs(y) > h/2) + if (std::abs(y) > h/2) y = y > 0 ? h/2 : h/-2; return vec2 { z * (ret.x() + x), z * (ret.y() + y) }; } diff --git a/qfunctionconfigurator/functionconfig.cpp b/qfunctionconfigurator/functionconfig.cpp index 7edbe0ef..264097ab 100644 --- a/qfunctionconfigurator/functionconfig.cpp +++ b/qfunctionconfigurator/functionconfig.cpp @@ -8,6 +8,7 @@ #include <QSettings> #include <QPixmap> #include <algorithm> +#include <cmath> void Map::setTrackingActive(bool blnActive) { @@ -43,7 +44,7 @@ bool Map::getLastPoint(QPointF& point ) { float Map::getValueInternal(int x) { float sign = x < 0 ? -1 : 1; - x = std::abs(x); + x = abs(x); float ret; int sz = cur.data.size(); if (sz == 0) |