diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-10-25 03:11:42 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-10-25 03:11:42 +0200 |
commit | 0a1a0e9df00f37a210b67a11cf8f99550cafeeaf (patch) | |
tree | 35da3c9a2d6464025dc324647253966d4a63a351 | |
parent | a4c9807acacc87f323f31d252a37c0ed2029ee5b (diff) |
cleanups only
-rw-r--r-- | cmake/opentrack-platform.cmake | 7 | ||||
-rw-r--r-- | cmake/opentrack-qt.cmake | 1 | ||||
-rw-r--r-- | cmake/opentrack-word-size.cmake | 8 | ||||
-rw-r--r-- | compat/linkage-macros.hpp | 22 | ||||
-rw-r--r-- | dinput/keybinding-worker.cpp | 4 | ||||
-rw-r--r-- | dinput/keybinding-worker.hpp | 3 | ||||
-rw-r--r-- | dinput/win32-joystick.cpp | 2 | ||||
-rw-r--r-- | gui/init.cpp | 2 | ||||
-rw-r--r-- | gui/keyboard.cpp | 23 | ||||
-rw-r--r-- | gui/keyboard.h | 6 | ||||
-rw-r--r-- | logic/shortcuts.cpp | 41 | ||||
-rw-r--r-- | logic/win32-shortcuts.cpp | 54 | ||||
-rw-r--r-- | options/bundle.cpp | 3 | ||||
-rw-r--r-- | options/metatype.cpp | 4 | ||||
-rw-r--r-- | options/scoped.cpp | 4 | ||||
-rw-r--r-- | options/value.hpp | 38 | ||||
-rw-r--r-- | spline/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tracker-hydra/CMakeLists.txt | 36 | ||||
-rw-r--r-- | tracker-steamvr/steamvr.cpp | 2 |
19 files changed, 138 insertions, 123 deletions
diff --git a/cmake/opentrack-platform.cmake b/cmake/opentrack-platform.cmake index 1bb0a973..2df0bfe0 100644 --- a/cmake/opentrack-platform.cmake +++ b/cmake/opentrack-platform.cmake @@ -114,10 +114,13 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) include_directories("${CMAKE_SOURCE_DIR}") -if(CMAKE_COMPILER_IS_GNUCXX AND UNIX AND (NOT APPLE)) +if(CMAKE_COMPILER_IS_GNUCXX AND UNIX) set(_common "-fvisibility=hidden") set(CMAKE_C_FLAGS "${_common} ${CMAKE_C_FLAGS}") - set(CMAKE_CXX_FLAGS "${_common} -fuse-cxa-atexit ${CMAKE_CXX_FLAGS}") + set(CMAKE_CXX_FLAGS "${_common} ${CMAKE_CXX_FLAGS}") + if(NOT APPLE) + set(CMAKE_CXX_FLAGS "-fuse-cxa-atexit ${CMAKE_CXX_FLAGS}") + endif() endif() if(APPLE) diff --git a/cmake/opentrack-qt.cmake b/cmake/opentrack-qt.cmake index a5f2b0f2..8d975712 100644 --- a/cmake/opentrack-qt.cmake +++ b/cmake/opentrack-qt.cmake @@ -61,4 +61,5 @@ function(otr_qt n) include_directories(SYSTEM ${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS}) add_definitions(${Qt5Core_DEFINITIONS} ${Qt5Gui_DEFINITIONS} ${Qt5Widgets_DEFINITIONS} ${Qt5Network_DEFINITIONS}) add_definitions(-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT) + add_definitions(-DQT_DEPRECATED -DQT_DISABLE_DEPRECATED_BEFORE=-1) endfunction() diff --git a/cmake/opentrack-word-size.cmake b/cmake/opentrack-word-size.cmake index 12c34066..4ed82e02 100644 --- a/cmake/opentrack-word-size.cmake +++ b/cmake/opentrack-word-size.cmake @@ -1,10 +1,4 @@ -include(CheckTypeSize)
-check_type_size(void* opentrack-word-size BUILTIN_TYPES_ONLY LANGUAGE C)
-if(NOT ((opentrack-word-size EQUAL 4) OR (opentrack-word-size EQUAL 8)))
- message(FATAL_ERROR "word size '${opentrack-word-size}' either misdetected or really not 4 or 8")
-endif()
-set(opentrack-word-size ${opentrack-word-size})
-if(opentrack-word-size GREATER 4)
+if(CMAKE_SIZEOF_VOID_P GREATER 4)
set(opentrack-64bit TRUE)
else()
set(opentrack-64bit FALSE)
diff --git a/compat/linkage-macros.hpp b/compat/linkage-macros.hpp index ea82c395..dff9a34c 100644 --- a/compat/linkage-macros.hpp +++ b/compat/linkage-macros.hpp @@ -7,20 +7,18 @@ # define OTR_GENERIC_EXPORT __attribute__((dllexport, visibility ("default"))) # define OTR_GENERIC_IMPORT __attribute__((dllimport, visibility ("default"))) #else -# define OTR_GENERIC_EXPORT __attribute__ ((visibility ("default"))) -# define OTR_GENERIC_IMPORT +# define OTR_GENERIC_EXPORT __attribute__((visibility ("default"))) +# define OTR_GENERIC_IMPORT __attribute__((visibility ("default"))) #endif -#if defined __APPLE__ -# define OTR_TEMPLATE_IMPORT(x) //nothing -#else -# define OTR_TEMPLATE_IMPORT(x) extern template class OTR_GENERIC_IMPORT x +#if defined __APPLE__ || (defined __MINGW32__ && defined _WIN64) +# define OTR_NO_TMPL_INST // link failure on both targets #endif -#define OTR_TEMPLATE_EXPORT_(x) template class OTR_GENERIC_EXPORT x - -#if defined __APPLE__ -# define OTR_TEMPLATE_EXPORT(x) // nothing -#else /* does this _always_ work for binutils ELF? */ -# define OTR_TEMPLATE_EXPORT(x) OTR_TEMPLATE_EXPORT_(x) +#if defined OTR_NO_TMPL_INST +# define OTR_TEMPLATE_IMPORT(x) +# define OTR_TEMPLATE_EXPORT(x) +#else +# define OTR_TEMPLATE_IMPORT(x) extern template class OTR_GENERIC_IMPORT x; +# define OTR_TEMPLATE_EXPORT(x) template class OTR_GENERIC_EXPORT x; #endif diff --git a/dinput/keybinding-worker.cpp b/dinput/keybinding-worker.cpp index a16432ae..a3331323 100644 --- a/dinput/keybinding-worker.cpp +++ b/dinput/keybinding-worker.cpp @@ -22,8 +22,8 @@ bool Key::should_process() { if (!enabled || (keycode == 0 && guid == "")) return false; - bool ret = prog1(!held || timer.elapsed_ms() > 100, - timer.start()); + bool ret = !held || timer.elapsed_ms() > 100; + timer.start(); return ret; } diff --git a/dinput/keybinding-worker.hpp b/dinput/keybinding-worker.hpp index 9d067c10..fad9ec7e 100644 --- a/dinput/keybinding-worker.hpp +++ b/dinput/keybinding-worker.hpp @@ -73,9 +73,10 @@ public: class Token { fun* pos; + public: Token(const Token&) = delete; Token& operator=(Token&) = delete; - public: + ~Token() { make().remove_receiver(pos); diff --git a/dinput/win32-joystick.cpp b/dinput/win32-joystick.cpp index 8f2b4085..4da5c57d 100644 --- a/dinput/win32-joystick.cpp +++ b/dinput/win32-joystick.cpp @@ -222,7 +222,7 @@ bool win32_joy_ctx::joy::poll(fn const& f) } } } - else if (i >= 0 && i < max_buttons) + else if ((unsigned)i < max_buttons) { const bool new_value = !!(event.dwData & 0x80); if (last_state[i] != new_value) diff --git a/gui/init.cpp b/gui/init.cpp index 09b0e909..a3932047 100644 --- a/gui/init.cpp +++ b/gui/init.cpp @@ -97,7 +97,7 @@ static void set_qt_style() static void qdebug_to_console(QtMsgType, const QMessageLogContext& ctx, const QString &msg) { const unsigned short* const str_ = msg.utf16(); - auto str = reinterpret_cast<const wchar_t* const>(str_); + const auto str = reinterpret_cast<wchar_t const*>(str_); static_assert(sizeof(*str_) == sizeof(*str)); std::fflush(stderr); diff --git a/gui/keyboard.cpp b/gui/keyboard.cpp index b9964ecb..aa8f67a3 100644 --- a/gui/keyboard.cpp +++ b/gui/keyboard.cpp @@ -2,11 +2,11 @@ #include <QDebug> -keyboard_listener::keyboard_listener(QWidget* parent) : - QDialog(parent) -#if defined _WIN32 - , token([this](const Key& k) { - if(k.guid != "") +#ifdef _WIN32 +auto keyboard_listener::make_token() +{ + return [this](const Key& k) { + if(!k.guid.isEmpty()) { int mods = 0; if (k.alt) mods |= Qt::AltModifier; @@ -19,10 +19,17 @@ keyboard_listener::keyboard_listener(QWidget* parent) : Qt::KeyboardModifiers m; QKeySequence k_; if (win_key::to_qt(k, k_, m)) - emit key_pressed(static_cast<QVariant>(k_).toInt() | m); + emit key_pressed({ int(m), int(k_) }); } - }) -// token initializer ends, real ctor body begins + }; +} + +#endif + +keyboard_listener::keyboard_listener(QWidget* parent) : + QDialog(parent) +#ifdef _WIN32 + , token(make_token()) #endif { ui.setupUi(this); diff --git a/gui/keyboard.h b/gui/keyboard.h index 19d29e75..0a06a3af 100644 --- a/gui/keyboard.h +++ b/gui/keyboard.h @@ -24,13 +24,13 @@ class OTR_GUI_EXPORT keyboard_listener : public QDialog Q_OBJECT Ui_keyboard_listener ui; #ifdef _WIN32 + auto make_token(); KeybindingWorker::Token token; +#else + void keyPressEvent(QKeyEvent* event) override; #endif public: keyboard_listener(QWidget* parent = nullptr); -#ifndef _WIN32 - void keyPressEvent(QKeyEvent* event) override; -#endif signals: void key_pressed(QKeySequence k); void joystick_button_pressed(QString guid, int idx, bool held); diff --git a/logic/shortcuts.cpp b/logic/shortcuts.cpp index f03c8973..a0027fea 100644 --- a/logic/shortcuts.cpp +++ b/logic/shortcuts.cpp @@ -29,9 +29,9 @@ void Shortcuts::free_binding(K& key) #endif } -void Shortcuts::bind_shortcut(K &key, const key_opts& k, bool held) +void Shortcuts::bind_shortcut(K& key, const key_opts& k, bool held) { -#if !defined(_WIN32) +#if !defined _WIN32 (void)held; using sh = QxtGlobalShortcut; if (key) @@ -46,13 +46,12 @@ void Shortcuts::bind_shortcut(K &key, const key_opts& k, bool held) key->setShortcut(QKeySequence::fromString(k.keycode, QKeySequence::PortableText)); key->setEnabled(); } -} #else - key = K(); + key = {}; int idx = 0; - QKeySequence code; + QKeySequence code(QKeySequence::UnknownKey); - if (k.guid != "") + if (!k.guid->isEmpty()) { key.guid = k.guid; key.keycode = k.button & ~Qt::KeyboardModifierMask; @@ -63,26 +62,27 @@ void Shortcuts::bind_shortcut(K &key, const key_opts& k, bool held) } else { - if (k.keycode == "") - code = QKeySequence(Qt::Key_unknown); - else + if (!k.keycode->isEmpty()) code = QKeySequence::fromString(k.keycode, QKeySequence::PortableText); Qt::KeyboardModifiers mods = Qt::NoModifier; - if (code != Qt::Key_unknown) - win_key::from_qt(code, idx, mods); - - key.guid = ""; - key.keycode = idx; - key.held = held; - key.ctrl = !!(mods & Qt::ControlModifier); - key.alt = !!(mods & Qt::AltModifier); - key.shift = !!(mods & Qt::ShiftModifier); + if (!code.isEmpty() && + code != QKeySequence{ QKeySequence::UnknownKey } && + win_key::from_qt(code, idx, mods)) + { + key.guid = ""; + key.keycode = idx; + key.held = held; + key.ctrl = !!(mods & Qt::ControlModifier); + key.alt = !!(mods & Qt::AltModifier); + key.shift = !!(mods & Qt::ShiftModifier); + } } -} #endif +} #ifdef _WIN32 + void Shortcuts::receiver(const Key& k) { const unsigned sz = keys.size(); @@ -105,6 +105,7 @@ void Shortcuts::receiver(const Key& k) f(k.held); } } + #endif Shortcuts::~Shortcuts() @@ -127,7 +128,7 @@ void Shortcuts::reload(const t_keys& keys_) for (unsigned i = 0; i < sz; i++) { - auto const& [opts, fun, held] = keys_[i]; + auto const&[opts, fun, held] = keys_[i]; #ifdef _WIN32 K k; #else diff --git a/logic/win32-shortcuts.cpp b/logic/win32-shortcuts.cpp index 4da86afd..1e2f1b77 100644 --- a/logic/win32-shortcuts.cpp +++ b/logic/win32-shortcuts.cpp @@ -119,26 +119,26 @@ static const win_key windows_key_sequences[] { { DIK_PAUSE, Qt::Key_Pause}, { DIK_NUMLOCK, Qt::Key_NumLock}, { DIK_CAPSLOCK, Qt::Key_CapsLock}, -#define mod(x, y) Qt::Key(int(x) | int((y))) - { DIK_NUMPAD0, mod(Qt::Key_0, Qt::KeypadModifier)}, - { DIK_NUMPAD0, mod(Qt::Key_0, Qt::KeypadModifier)}, - { DIK_NUMPAD1, mod(Qt::Key_1, Qt::KeypadModifier)}, - { DIK_NUMPAD2, mod(Qt::Key_2, Qt::KeypadModifier)}, - { DIK_NUMPAD3, mod(Qt::Key_3, Qt::KeypadModifier)}, - { DIK_NUMPAD4, mod(Qt::Key_4, Qt::KeypadModifier)}, - { DIK_NUMPAD5, mod(Qt::Key_5, Qt::KeypadModifier)}, - { DIK_NUMPAD6, mod(Qt::Key_6, Qt::KeypadModifier)}, - { DIK_NUMPAD7, mod(Qt::Key_7, Qt::KeypadModifier)}, - { DIK_NUMPAD8, mod(Qt::Key_8, Qt::KeypadModifier)}, - { DIK_NUMPAD9, mod(Qt::Key_9, Qt::KeypadModifier)}, - { DIK_NUMPADCOMMA, mod(Qt::Key_Comma, Qt::KeypadModifier)}, - { DIK_NUMPADENTER, mod(Qt::Key_Enter, Qt::KeypadModifier)}, - { DIK_NUMPADEQUALS, mod(Qt::Key_Equal, Qt::KeypadModifier)}, - { DIK_NUMPADMINUS, mod(Qt::Key_Minus, Qt::KeypadModifier)}, - { DIK_NUMPADPERIOD, mod(Qt::Key_Period, Qt::KeypadModifier)}, - { DIK_NUMPADPLUS, mod(Qt::Key_Plus, Qt::KeypadModifier)}, - { DIK_NUMPADSLASH, mod(Qt::Key_Slash, Qt::KeypadModifier)}, - { DIK_NUMPADSTAR, mod(Qt::Key_multiply, Qt::KeypadModifier)}, +#define key_mod(x, y) Qt::Key(int(x) | int((y))) + { DIK_NUMPAD0, key_mod(Qt::Key_0, Qt::KeypadModifier)}, + { DIK_NUMPAD0, key_mod(Qt::Key_0, Qt::KeypadModifier)}, + { DIK_NUMPAD1, key_mod(Qt::Key_1, Qt::KeypadModifier)}, + { DIK_NUMPAD2, key_mod(Qt::Key_2, Qt::KeypadModifier)}, + { DIK_NUMPAD3, key_mod(Qt::Key_3, Qt::KeypadModifier)}, + { DIK_NUMPAD4, key_mod(Qt::Key_4, Qt::KeypadModifier)}, + { DIK_NUMPAD5, key_mod(Qt::Key_5, Qt::KeypadModifier)}, + { DIK_NUMPAD6, key_mod(Qt::Key_6, Qt::KeypadModifier)}, + { DIK_NUMPAD7, key_mod(Qt::Key_7, Qt::KeypadModifier)}, + { DIK_NUMPAD8, key_mod(Qt::Key_8, Qt::KeypadModifier)}, + { DIK_NUMPAD9, key_mod(Qt::Key_9, Qt::KeypadModifier)}, + { DIK_NUMPADCOMMA, key_mod(Qt::Key_Comma, Qt::KeypadModifier)}, + { DIK_NUMPADENTER, key_mod(Qt::Key_Enter, Qt::KeypadModifier)}, + { DIK_NUMPADEQUALS, key_mod(Qt::Key_Equal, Qt::KeypadModifier)}, + { DIK_NUMPADMINUS, key_mod(Qt::Key_Minus, Qt::KeypadModifier)}, + { DIK_NUMPADPERIOD, key_mod(Qt::Key_Period, Qt::KeypadModifier)}, + { DIK_NUMPADPLUS, key_mod(Qt::Key_Plus, Qt::KeypadModifier)}, + { DIK_NUMPADSLASH, key_mod(Qt::Key_Slash, Qt::KeypadModifier)}, + { DIK_NUMPADSTAR, key_mod(Qt::Key_multiply, Qt::KeypadModifier)}, }; bool win_key::to_qt(const Key& k, QKeySequence& qt_, Qt::KeyboardModifiers &mods) @@ -158,11 +158,17 @@ bool win_key::to_qt(const Key& k, QKeySequence& qt_, Qt::KeyboardModifiers &mods return false; } -bool win_key::from_qt(QKeySequence const& qt_, int& dik, Qt::KeyboardModifiers& mods) +bool win_key::from_qt(const QKeySequence& qt_, int& dik, Qt::KeyboardModifiers& mods) { // CAVEAT don't use QVariant::toUInt() or conversion fails - const unsigned qt = static_cast<unsigned>(QVariant(qt_).toInt()); - const unsigned our_mods = unsigned(qt & Qt::KeyboardModifierMask); +#if 0 + const unsigned qt = QVariant(qt_).toInt(); // verbose +#endif + const unsigned qt = int(qt_); // deprecated + const unsigned our_mods = qt & Qt::KeyboardModifierMask; + + if (qt == 0) + return false; { for (const win_key& wk : windows_key_sequences) @@ -182,7 +188,7 @@ bool win_key::from_qt(QKeySequence const& qt_, int& dik, Qt::KeyboardModifiers& if (unsigned(wk.qt) == key) { dik = wk.win; - mods = static_cast<Qt::KeyboardModifiers>(our_mods); + mods = { (Qt::KeyboardModifier)our_mods }; return true; } } diff --git a/options/bundle.cpp b/options/bundle.cpp index 0ab50037..7347dc88 100644 --- a/options/bundle.cpp +++ b/options/bundle.cpp @@ -99,7 +99,7 @@ bool bundle::contains(const QString &name) const void bundle::save() { - if (QThread::currentThread() != qApp->thread()) + if (QThread::currentThread() != qApp->thread()) // NOLINT qDebug() << "group::save - current thread not ui thread"; if (group_name.isEmpty()) @@ -112,7 +112,6 @@ void bundle::save() saved.save(); } - qDebug() << "saving" << name(); emit saving(); } diff --git a/options/metatype.cpp b/options/metatype.cpp index 44f30187..a4629aa6 100644 --- a/options/metatype.cpp +++ b/options/metatype.cpp @@ -20,9 +20,9 @@ int declare_metatype_for_type(const char* str) OPENTRACK_DEFINE_METATYPE4(t, init_metatype_ ## ctr) #define OPENTRACK_DEFINE_METATYPE4(t, sym) \ - class sym { \ + class sym { /* NOLINT */ \ static const int dribble; \ - } sym; \ + } sym; /* NOLINT */ \ const int sym :: dribble = ::options::detail::declare_metatype_for_type<t>(#t); #define OPENTRACK_DEFINE_METATYPE(t) OPENTRACK_DEFINE_METATYPE2(t, __COUNTER__) diff --git a/options/scoped.cpp b/options/scoped.cpp index 2974dfdb..8f1ef202 100644 --- a/options/scoped.cpp +++ b/options/scoped.cpp @@ -27,10 +27,10 @@ static void ensure_thread() { // only as a bug check - if (qApp == nullptr) + if (qApp == nullptr) // NOLINT abort(); - const QThread* ui_thread = qApp->thread(); + const QThread* ui_thread = qApp->thread(); // NOLINT const QThread* curthread = QThread::currentThread(); if (ui_thread == nullptr) diff --git a/options/value.hpp b/options/value.hpp index 1bf6820d..a1ef5734 100644 --- a/options/value.hpp +++ b/options/value.hpp @@ -17,7 +17,7 @@ #include "compat/macros.hpp" #include <type_traits> -#include <typeinfo> +#include <utility> #include <QMetaType> @@ -94,7 +94,7 @@ public: cc_noinline value(bundle b, const QString& name, t def) : - value_(b, name), def(def) + value_(b, name), def(std::move(def)) { } @@ -110,7 +110,7 @@ public: *this = def; } - operator t() const { return get(); } + operator t() const { return get(); } // NOLINT template<typename w, typename = decltype(static_cast<w>(std::declval<t>()))> explicit cc_forceinline operator w() const { return to<w>(); } @@ -135,21 +135,21 @@ public: # define OTR_INST_VALUE OTR_TEMPLATE_IMPORT #endif -OTR_INST_VALUE(value<double>); -OTR_INST_VALUE(value<float>); -OTR_INST_VALUE(value<int>); -OTR_INST_VALUE(value<bool>); -OTR_INST_VALUE(value<QString>); -OTR_INST_VALUE(value<slider_value>); -OTR_INST_VALUE(value<QPointF>); -OTR_INST_VALUE(value<QVariant>); -OTR_INST_VALUE(value<QList<double>>); -OTR_INST_VALUE(value<QList<float>>); -OTR_INST_VALUE(value<QList<int>>); -OTR_INST_VALUE(value<QList<bool>>); -OTR_INST_VALUE(value<QList<QString>>); -OTR_INST_VALUE(value<QList<slider_value>>); -OTR_INST_VALUE(value<QList<QPointF>>); -OTR_INST_VALUE(value<QList<QVariant>>); +OTR_INST_VALUE(value<double>) +OTR_INST_VALUE(value<float>) +OTR_INST_VALUE(value<int>) +OTR_INST_VALUE(value<bool>) +OTR_INST_VALUE(value<QString>) +OTR_INST_VALUE(value<slider_value>) +OTR_INST_VALUE(value<QPointF>) +OTR_INST_VALUE(value<QVariant>) +OTR_INST_VALUE(value<QList<double>>) +OTR_INST_VALUE(value<QList<float>>) +OTR_INST_VALUE(value<QList<int>>) +OTR_INST_VALUE(value<QList<bool>>) +OTR_INST_VALUE(value<QList<QString>>) +OTR_INST_VALUE(value<QList<slider_value>>) +OTR_INST_VALUE(value<QList<QPointF>>) +OTR_INST_VALUE(value<QList<QVariant>>) } // ns options diff --git a/spline/CMakeLists.txt b/spline/CMakeLists.txt index 7d427601..731c0b6e 100644 --- a/spline/CMakeLists.txt +++ b/spline/CMakeLists.txt @@ -1,2 +1 @@ otr_module(spline BIN) -target_link_libraries(opentrack-spline) diff --git a/tracker-hydra/CMakeLists.txt b/tracker-hydra/CMakeLists.txt index af44135f..2e263a19 100644 --- a/tracker-hydra/CMakeLists.txt +++ b/tracker-hydra/CMakeLists.txt @@ -15,23 +15,29 @@ if(SDK_HYDRA) set(dir bin) set(ext dll) endif() - set(under_dll _dll) - set(soext dll) - target_link_libraries(opentrack-tracker-hydra "${SDK_HYDRA}/${dir}/win32/release_dll/sixense.${ext}") - install(FILES "${SDK_HYDRA}/bin/win32/release_dll/sixense.dll" DESTINATION ${opentrack-hier-pfx} PERMISSIONS ${opentrack-perms-exec}) + if (opentrack-64bit) + set(part "x64") + else() + set(part "win32") + endif() + set(lib "${SDK_HYDRA}/${dir}/${part}/release_dll/sixense${six4}.${ext}") + set(dll "${SDK_HYDRA}/bin/${part}/release_dll/sixense${six4}.dll") + install(FILES "${dll}" DESTINATION ${opentrack-hier-pfx} PERMISSIONS ${opentrack-perms-exec}) + target_link_libraries(opentrack-tracker-hydra "${lib}") else() if(APPLE) - set(dest .) - set(under-dll _dll) - set(soext dylib) - set(plat osx) - else() - set(dest ${opentrack-hier-pfx}) - set(under-dll) - set(soext so) - set(plat linux) + set(dest ".") + set(part "release_dll") + set(soext "dylib") + set(plat "osx") + else() # assume Linux + set(dest "${opentrack-hier-pfx}") + set(part "release") + set(soext "so") + set(plat "linux") endif() - target_link_libraries(opentrack-tracker-hydra "${SDK_HYDRA}/lib/${plat}${six4}/release${under-dll}/libsixense${six4}.${soext}") - install(FILES "${SDK_HYDRA}/lib/${plat}${six4}/release${under-dll}/libsixense${six4}.${soext}" DESTINATION ${opentrack-hier-pfx} PERMISSIONS ${opentrack-perms-exec}) + set(lib "libsixense${six4}.${soext}") + target_link_libraries(opentrack-tracker-hydra "${SDK_HYDRA}/lib/${plat}${six4}/${part}/${lib}") + install(FILES "${SDK_HYDRA}/lib/${plat}${six4}/${part}/${lib}" DESTINATION ${opentrack-hier-pfx} PERMISSIONS ${opentrack-perms-exec}) endif() endif() diff --git a/tracker-steamvr/steamvr.cpp b/tracker-steamvr/steamvr.cpp index bf37f4fc..04ae691e 100644 --- a/tracker-steamvr/steamvr.cpp +++ b/tracker-steamvr/steamvr.cpp @@ -125,7 +125,7 @@ void device_list::refresh_device_list() device_list::maybe_pose device_list::get_pose(int k) { - if (k < 0 || !(k < max_devices)) + if (!(unsigned(k) < max_devices)) return maybe_pose(false, pose_t{}); return with_vr_lock([k](vr_t v, vr_error_t) |