summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--cmake/opentrack-boilerplate.cmake38
-rw-r--r--cmake/opentrack-platform.cmake2
-rw-r--r--compat/CMakeLists.txt4
-rw-r--r--compat/timer.cpp10
-rw-r--r--options/value.hpp12
-rw-r--r--pose-widget/pose-widget.cpp2
-rw-r--r--proto-mouse/ftnoir_protocol_mouse.cpp3
-rw-r--r--tracker-aruco/CMakeLists.txt27
-rw-r--r--tracker-easy/CMakeLists.txt19
-rw-r--r--tracker-easy/ocv-check.cxx18
-rw-r--r--tracker-easy/point-extractor.cpp2
-rw-r--r--tracker-easy/tracker-easy-dialog.cpp2
-rw-r--r--tracker-kinect-face/camera_kinect_ir.cpp7
-rw-r--r--tracker-pt/module/camera.h2
-rw-r--r--video-opencv/CMakeLists.txt3
-rw-r--r--video/camera.hpp2
16 files changed, 98 insertions, 55 deletions
diff --git a/cmake/opentrack-boilerplate.cmake b/cmake/opentrack-boilerplate.cmake
index b26b32e0..0a7ccfab 100644
--- a/cmake/opentrack-boilerplate.cmake
+++ b/cmake/opentrack-boilerplate.cmake
@@ -39,20 +39,23 @@ otr_write_library_paths()
function(otr_glob_sources var)
set(basedir "${CMAKE_CURRENT_SOURCE_DIR}")
- foreach(dir . ${ARGN})
+ foreach(i ui rc res cc cxx hh all)
+ set(${var}-${i} "")
+ endforeach()
+ foreach(dir ${ARGN})
set(dir "${basedir}/${dir}")
- file(GLOB ${var}-cxx "${dir}/*.cpp")
- file(GLOB ${var}-cc "${dir}/*.c")
- file(GLOB ${var}-hh "${dir}/*.h" "${dir}/*.hpp" "${dir}/*.inc")
- file(GLOB ${var}-res "${dir}/*.rc")
- foreach(f ${var}-res)
+ file(GLOB cxx "${dir}/*.cpp")
+ file(GLOB cc "${dir}/*.c")
+ file(GLOB hh "${dir}/*.h" "${dir}/*.hpp" "${dir}/*.inc")
+ file(GLOB res "${dir}/*.rc")
+ foreach(f res)
set_source_files_properties(${f} PROPERTIES LANGUAGE RC)
endforeach()
- file(GLOB ${var}-ui "${dir}/*.ui")
- file(GLOB ${var}-rc "${dir}/*.qrc")
- set(${var}-all ${${var}-cc} ${${var}-cxx} ${${var}-hh} ${${var}-res})
+ file(GLOB ui "${dir}/*.ui")
+ file(GLOB rc "${dir}/*.qrc")
+ set(all ${cc} ${cxx} ${hh} ${res})
foreach(i ui rc res cc cxx hh all)
- set(${var}-${i} "${${var}-${i}}" PARENT_SCOPE)
+ set(${var}-${i} "${${var}-${i}}" ${${i}} PARENT_SCOPE)
endforeach()
endforeach()
endfunction()
@@ -128,7 +131,7 @@ function(otr_module n_)
if(NOT arg_SUBDIRS)
otr_glob_sources(${n} .)
else()
- otr_glob_sources(${n} ${arg_SUBDIRS})
+ otr_glob_sources(${n} . ${arg_SUBDIRS})
endif()
list(APPEND ${n}-all ${arg_SOURCES})
@@ -201,7 +204,7 @@ function(otr_module n_)
if(CMAKE_COMPILER_IS_CLANGXX AND (arg_EXECUTABLE OR NOT arg_BIN))
set(opts
weak-vtables
- header-hygiene
+ #header-hygiene
)
foreach(k ${opts})
target_compile_options(${n} PRIVATE "-Wno-${k}")
@@ -255,9 +258,14 @@ endfunction()
function(otr_install_lib target dest)
if(WIN32)
- get_property(path TARGET "${target}" PROPERTY "LOCATION_${CMAKE_BUILD_TYPE}")
- if(path STREQUAL "")
- get_property(path TARGET "${target}" PROPERTY "LOCATION")
+ string(FIND "${target}" "/" idx)
+ if(idx EQUAL -1)
+ get_property(path TARGET "${target}" PROPERTY "LOCATION_${CMAKE_BUILD_TYPE}")
+ if(path STREQUAL "")
+ get_property(path TARGET "${target}" PROPERTY "LOCATION")
+ endif()
+ else()
+ set(path "${target}")
endif()
if(path STREQUAL "")
message(FATAL_ERROR "Can't find ${target}")
diff --git a/cmake/opentrack-platform.cmake b/cmake/opentrack-platform.cmake
index be09d6db..e2a292dc 100644
--- a/cmake/opentrack-platform.cmake
+++ b/cmake/opentrack-platform.cmake
@@ -44,6 +44,8 @@ include_directories("${CMAKE_SOURCE_DIR}")
set(opentrack_maintainer-mode FALSE CACHE INTERNAL "Select if developing core code (not modules)")
+set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
+
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_DEFAULT 17)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
diff --git a/compat/CMakeLists.txt b/compat/CMakeLists.txt
index b58b54e9..3fddefb4 100644
--- a/compat/CMakeLists.txt
+++ b/compat/CMakeLists.txt
@@ -4,10 +4,6 @@ if(NOT WIN32 AND NOT APPLE)
target_link_libraries(opentrack-compat rt)
endif()
-if(WIN32)
- target_link_libraries(opentrack-compat winmm strmiids)
-endif()
-
if(CMAKE_COMPILER_IS_GNUCXX)
set_property(SOURCE nan.cpp APPEND_STRING PROPERTY
COMPILE_FLAGS "-fno-lto -fno-fast-math -fno-finite-math-only -O0 ")
diff --git a/compat/timer.cpp b/compat/timer.cpp
index a555018c..55eb200d 100644
--- a/compat/timer.cpp
+++ b/compat/timer.cpp
@@ -80,13 +80,9 @@ void Timer::gettime(timespec* ts)
BOOL ret = QueryPerformanceCounter(&d);
assert(ret && "QueryPerformanceCounter failed");
- using ll = long long;
- auto part = ll(std::roundl((d.QuadPart * 1000000000.L) / freq));
- using t_s = decltype(ts->tv_sec);
- using t_ns = decltype(ts->tv_nsec);
-
- ts->tv_sec = t_s((long double)d.QuadPart/freq);
- ts->tv_nsec = t_ns(part % 1000000000LL);
+ auto part = (long long)std::roundl((d.QuadPart * 1000000000.L) / freq);
+ ts->tv_sec = d.QuadPart/freq;
+ ts->tv_nsec = part % 1000000000;
}
#elif defined __MACH__
diff --git a/options/value.hpp b/options/value.hpp
index 940e2a15..f16878ce 100644
--- a/options/value.hpp
+++ b/options/value.hpp
@@ -62,6 +62,9 @@ class value final : public value_
if (traits::is_equal(get(), traits::value_from_qvariant(value)))
return;
+ if (is_null())
+ return;
+
if (value.isValid() && !value.isNull())
b->store_kv(self_name, value);
else
@@ -97,12 +100,18 @@ public:
auto& operator=(t&& datum) noexcept
{
+ if (is_null())
+ return *this;
+
store_variant(traits::qvariant_from_value(traits::pass_value(datum)));
return *this;
}
auto& operator=(const t& datum) noexcept
{
+ if (is_null())
+ return *this;
+
t copy{datum};
*this = std::move(copy);
return *this;
@@ -121,7 +130,8 @@ public:
{
}
- value(const value<t>& other) noexcept : value{other.b, other.self_name, other.def} {}
+ //value(const value<t>& other) noexcept : value{other.b, other.self_name, other.def} {}
+ value(const value<t>&) = delete;
t default_value() const
{
diff --git a/pose-widget/pose-widget.cpp b/pose-widget/pose-widget.cpp
index 53ce5811..54686114 100644
--- a/pose-widget/pose-widget.cpp
+++ b/pose-widget/pose-widget.cpp
@@ -34,7 +34,7 @@ void pose_widget::paintEvent(QPaintEvent*)
auto [ yaw, pitch, roll ] = R;
auto [ x, y, z ] = T;
- const QImage& img = std::fabs(pitch) > 90 || std::fabs(yaw) > 90
+ const QImage& img = std::fabs(pitch) > 90 ^ std::fabs(yaw) > 90
? back
: front;
diff --git a/proto-mouse/ftnoir_protocol_mouse.cpp b/proto-mouse/ftnoir_protocol_mouse.cpp
index d57d8809..40e28c32 100644
--- a/proto-mouse/ftnoir_protocol_mouse.cpp
+++ b/proto-mouse/ftnoir_protocol_mouse.cpp
@@ -41,8 +41,7 @@ void mouse::pose(const double* headpose)
*s.sensitivity_y,
axis_y >= 3);
- const int dx = get_delta(mouse_x, last_x),
- dy = get_delta(mouse_y, last_y);
+ int dx = get_delta(mouse_x, last_x), dy = mouse_y - last_y;
last_x = mouse_x; last_y = mouse_y;
diff --git a/tracker-aruco/CMakeLists.txt b/tracker-aruco/CMakeLists.txt
index 82cef795..69fe7aa1 100644
--- a/tracker-aruco/CMakeLists.txt
+++ b/tracker-aruco/CMakeLists.txt
@@ -13,32 +13,25 @@ find_package(OpenCV QUIET)
if(OpenCV_FOUND)
set(SDK_ARUCO_LIBPATH "" CACHE FILEPATH "Aruco paper marker tracker static library path")
if(SDK_ARUCO_LIBPATH)
-
- maybe_add_static_define()
-
set(modules "${SDK_ARUCO_LIBPATH}" opencv_calib3d opencv_imgproc opencv_core)
get_filename_component(dir "${SDK_ARUCO_LIBPATH}" DIRECTORY)
get_filename_component(dir "${dir}" ABSOLUTE)
set(dir "${dir}/include")
- file(TIMESTAMP "${SDK_ARUCO_LIBPATH}" tm "%s" UTC)
- set(cache-str "${tm}^|^${SDK_ARUCO_LIBPATH}")
-
- if(NOT aruco_has-working-abi STREQUAL "${cache-str}")
- try_compile(result "${CMAKE_CURRENT_BINARY_DIR}"
- SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/compile-test/abi.cpp"
- CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${dir}"
- OUTPUT_VARIABLE krap)
- if(NOT result)
- message(FATAL_ERROR "${krap}\n" "Must use Aruco fork from <https://github.com/opentrack/aruco>")
- endif()
-
- set(aruco_has-working-abi "${cache-str}" CACHE INTERNAL "" FORCE)
+ try_compile(tracker-aruco_has-working-abi "${CMAKE_CURRENT_BINARY_DIR}"
+ SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/compile-test/abi.cpp"
+ CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${dir}"
+ "-DCXX_STANDARD=17" "-DCXX_STANDARD_REQUIRED=1"
+ OUTPUT_VARIABLE krap)
+ if(NOT tracker-aruco_has-working-abi)
+ message(FATAL_ERROR "${krap}\n" "Must use Aruco fork from <https://github.com/opentrack/aruco>")
endif()
- otr_module(tracker-aruco)
+ maybe_add_static_define()
+ otr_install_lib("${SDK_ARUCO_LIBPATH}" "${opentrack-hier-pfx}")
+ otr_module(tracker-aruco)
target_include_directories(${self} SYSTEM PUBLIC ${OpenCV_INCLUDE_DIRS} "${dir}")
target_link_libraries(${self} opentrack-cv ${modules})
endif()
diff --git a/tracker-easy/CMakeLists.txt b/tracker-easy/CMakeLists.txt
index 7b776c9b..2bc773d7 100644
--- a/tracker-easy/CMakeLists.txt
+++ b/tracker-easy/CMakeLists.txt
@@ -1,6 +1,19 @@
+include(opentrack-opencv)
find_package(OpenCV QUIET)
+
if(OpenCV_FOUND)
- otr_module(tracker-easy)
- target_include_directories(${self} SYSTEM PUBLIC ${OpenCV_INCLUDE_DIRS})
- target_link_libraries(${self} opencv_core opencv_imgproc opencv_calib3d opencv_video opentrack-cv opentrack-video)
+ try_compile(tracker-easy_ocv-check "${CMAKE_CURRENT_BINARY_DIR}"
+ SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/ocv-check.cxx"
+ CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${OpenCV_INCLUDE_DIRS}"
+ "-DCXX_STANDARD=17" "-DCXX_STANDARD_REQUIRED=1"
+ OUTPUT_VARIABLE krap)
+ if(tracker-easy_ocv-check)
+ foreach(k video highgui)
+ otr_install_lib("opencv_${k}" "${opentrack-hier-pfx}")
+ endforeach()
+
+ otr_module(tracker-easy)
+ target_include_directories(${self} SYSTEM PUBLIC ${OpenCV_INCLUDE_DIRS})
+ target_link_libraries(${self} opencv_core opencv_imgproc opencv_calib3d opencv_video opencv_highgui opentrack-cv opentrack-video)
+ endif()
endif()
diff --git a/tracker-easy/ocv-check.cxx b/tracker-easy/ocv-check.cxx
new file mode 100644
index 00000000..90c2d6c9
--- /dev/null
+++ b/tracker-easy/ocv-check.cxx
@@ -0,0 +1,18 @@
+#include <opencv2/calib3d.hpp>
+void check_solvep3p()
+{
+ cv::Mat x;
+ cv::solveP3P(x, x, x, x, x, x, 0);
+}
+
+#include <opencv2/video/tracking.hpp>
+void check_kf()
+{
+ [[maybe_unused]] cv::KalmanFilter kf;
+}
+
+#include <opencv2/highgui.hpp>
+void check_highgui()
+{
+ cv::imshow("foo", {});
+}
diff --git a/tracker-easy/point-extractor.cpp b/tracker-easy/point-extractor.cpp
index b7cf7356..4b54fd25 100644
--- a/tracker-easy/point-extractor.cpp
+++ b/tracker-easy/point-extractor.cpp
@@ -143,7 +143,7 @@ namespace EasyTracker
while (aPoints.size() > aNeededPointCount) // Until we have no more than three points
{
int maxY = 0;
- size_t index = -1;
+ unsigned index = (unsigned)-1;
// Search for the point with highest Y coordinate
for (size_t i = 0; i < aPoints.size(); i++)
diff --git a/tracker-easy/tracker-easy-dialog.cpp b/tracker-easy/tracker-easy-dialog.cpp
index 8c8356d1..4a49e194 100644
--- a/tracker-easy/tracker-easy-dialog.cpp
+++ b/tracker-easy/tracker-easy-dialog.cpp
@@ -138,7 +138,7 @@ namespace EasyTracker
if (tracker)
{
QMutexLocker l(&tracker->camera_mtx);
- tracker->camera->show_dialog();
+ (void)tracker->camera->show_dialog();
}
else
(void)video::show_dialog(s.camera_name);
diff --git a/tracker-kinect-face/camera_kinect_ir.cpp b/tracker-kinect-face/camera_kinect_ir.cpp
index b881d51f..4d442bf2 100644
--- a/tracker-kinect-face/camera_kinect_ir.cpp
+++ b/tracker-kinect-face/camera_kinect_ir.cpp
@@ -36,7 +36,12 @@ namespace Kinect {
std::vector<QString> CamerasProvider::camera_names() const
{
- return { KKinectIRSensor };
+ IKinectSensor* ptr;
+ BOOLEAN b;
+ if (SUCCEEDED(GetDefaultKinectSensor(&ptr)) && SUCCEEDED(ptr->get_IsAvailable(&b)) && b)
+ return { KKinectIRSensor };
+ else
+ return {};
}
bool CamerasProvider::can_show_dialog(const QString& camera_name)
diff --git a/tracker-pt/module/camera.h b/tracker-pt/module/camera.h
index 02e2fe4d..e2ba159f 100644
--- a/tracker-pt/module/camera.h
+++ b/tracker-pt/module/camera.h
@@ -37,7 +37,7 @@ struct Camera final : pt_camera
void show_camera_settings() override;
private:
- using camera = typename video::impl::camera;
+ using camera = video::impl::camera;
[[nodiscard]] bool get_frame_(cv::Mat& frame);
diff --git a/video-opencv/CMakeLists.txt b/video-opencv/CMakeLists.txt
index ad245e66..c56e65d4 100644
--- a/video-opencv/CMakeLists.txt
+++ b/video-opencv/CMakeLists.txt
@@ -4,4 +4,7 @@ find_package(OpenCV QUIET)
if(OpenCV_FOUND)
otr_module(video-opencv)
target_link_libraries(${self} opencv_core opencv_videoio opentrack-video)
+ if(WIN32)
+ target_link_libraries(${self} strmiids)
+ endif()
endif()
diff --git a/video/camera.hpp b/video/camera.hpp
index 1cda8839..c08fedb1 100644
--- a/video/camera.hpp
+++ b/video/camera.hpp
@@ -87,7 +87,7 @@ void register_camera(std::unique_ptr<impl::camera_> metadata);
namespace video
{
-using camera_impl = typename impl::camera;
+using camera_impl = impl::camera;
OTR_VIDEO_EXPORT
std::unique_ptr<camera_impl> make_camera(const QString& name);