diff options
-rw-r--r-- | opentrack-compat/CMakeLists.txt | 4 | ||||
-rw-r--r-- | opentrack-compat/nan.cpp (renamed from opentrack-logic/nan.cpp) | 8 | ||||
-rw-r--r-- | opentrack-compat/nan.hpp | 11 | ||||
-rw-r--r-- | opentrack-logic/CMakeLists.txt | 3 | ||||
-rw-r--r-- | opentrack-logic/nan.hpp | 9 | ||||
-rw-r--r-- | opentrack-logic/tracker.cpp | 2 | ||||
-rw-r--r-- | tracker-pt/point_extractor.cpp | 2 |
7 files changed, 21 insertions, 18 deletions
diff --git a/opentrack-compat/CMakeLists.txt b/opentrack-compat/CMakeLists.txt index 6f745701..2bbb496c 100644 --- a/opentrack-compat/CMakeLists.txt +++ b/opentrack-compat/CMakeLists.txt @@ -2,3 +2,7 @@ opentrack_boilerplate(opentrack-compat NO-COMPAT BIN) if(NOT WIN32 AND NOT APPLE) target_link_libraries(opentrack-compat rt) endif() +if(CMAKE_COMPILER_IS_GNUCXX) + set_source_files_properties(nan.cpp PROPERTIES + COMPILE_FLAGS "-fno-fast-math -fno-finite-math-only -O0") +endif() diff --git a/opentrack-logic/nan.cpp b/opentrack-compat/nan.cpp index 2522ba38..6c4b1f6d 100644 --- a/opentrack-logic/nan.cpp +++ b/opentrack-compat/nan.cpp @@ -1,11 +1,11 @@ #include <cmath> #if defined(__GNUC__) -bool __attribute__ ((noinline)) nanp(double value) +extern "C" bool __attribute__ ((noinline)) nanp(double value) #elif defined(_WIN32) -__declspec(noinline) bool nanp(double value) +extern "C" __declspec(noinline) bool nanp(double value) #else -bool nanp(double value) +extern "C" bool nanp(double value) #endif { using std::isnan; @@ -13,4 +13,4 @@ bool nanp(double value) const volatile double x = value; return isnan(x) || isinf(x); -}
\ No newline at end of file +} diff --git a/opentrack-compat/nan.hpp b/opentrack-compat/nan.hpp new file mode 100644 index 00000000..f9e5cc1e --- /dev/null +++ b/opentrack-compat/nan.hpp @@ -0,0 +1,11 @@ +#pragma once + +#include "export.hpp" + +#if defined(__GNUC__) +extern "C" OPENTRACK_COMPAT_EXPORT bool __attribute__ ((noinline)) nanp(double value); +#elif defined(_WIN32) +extern "C" __declspec(noinline) OPENTRACK_COMPAT_EXPORT bool nanp(double value); +#else +extern "C" OPENTRACK_COMPAT_EXPORT bool nanp(double value); +#endif diff --git a/opentrack-logic/CMakeLists.txt b/opentrack-logic/CMakeLists.txt index edcc27b3..87175454 100644 --- a/opentrack-logic/CMakeLists.txt +++ b/opentrack-logic/CMakeLists.txt @@ -5,6 +5,3 @@ if(NOT WIN32) else() target_link_libraries(opentrack-logic winmm) endif() -if(CMAKE_COMPILER_IS_GNUCXX) - set_source_files_properties(nan.cpp PROPERTIES COMPILE_FLAGS "-fno-fast-math -fno-finite-math-only -fno-fast-math -O2") -endif() diff --git a/opentrack-logic/nan.hpp b/opentrack-logic/nan.hpp deleted file mode 100644 index c17cabfd..00000000 --- a/opentrack-logic/nan.hpp +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once - -#if defined(__GNUC__) -bool __attribute__ ((noinline)) nanp(double value); -#elif defined(_WIN32) -__declspec(noinline) bool nanp(double value); -#else -bool nanp(double value); -#endif diff --git a/opentrack-logic/tracker.cpp b/opentrack-logic/tracker.cpp index 4fcce853..39e70005 100644 --- a/opentrack-logic/tracker.cpp +++ b/opentrack-logic/tracker.cpp @@ -62,7 +62,7 @@ void Tracker::t_compensate(const rmat& rmat, const double* xyz, double* output, output[0] = -ret(1); } -#include "nan.hpp" +#include "opentrack-compat/nan.hpp" static inline double elide_nan(double value, double def) { diff --git a/tracker-pt/point_extractor.cpp b/tracker-pt/point_extractor.cpp index acba1c64..9dc1df6d 100644 --- a/tracker-pt/point_extractor.cpp +++ b/tracker-pt/point_extractor.cpp @@ -137,7 +137,7 @@ const std::vector<PointExtractor::vec2>& PointExtractor::extract_points(cv::Mat& sprintf(buf, "%.2fpx", radius); cv::putText(frame, buf, - cv::Point(std::round(b.pos[0]+30), std::round(b.pos[1]+20)), + cv::Point((int)std::round(b.pos[0]+30), (int)std::round(b.pos[1]+20)), cv::FONT_HERSHEY_DUPLEX, 1, cv::Scalar(0, 0, 255), |