diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-04-28 17:26:33 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-04-28 21:27:35 +0200 |
commit | 9bac55a0ac7365b241df8a3dacbdacf59698c862 (patch) | |
tree | cd30a3552fda74c63d8a9056888b34adad3d1250 /tracker-aruco | |
parent | 0c27d726a900b901e8bffafe993a3d3e36bf27f3 (diff) |
tracker/aruco: ensure using right ABI
Diffstat (limited to 'tracker-aruco')
-rw-r--r-- | tracker-aruco/CMakeLists.txt | 20 | ||||
-rw-r--r-- | tracker-aruco/compile-test/abi.cpp | 11 |
2 files changed, 29 insertions, 2 deletions
diff --git a/tracker-aruco/CMakeLists.txt b/tracker-aruco/CMakeLists.txt index b9f62a07..84dc7fba 100644 --- a/tracker-aruco/CMakeLists.txt +++ b/tracker-aruco/CMakeLists.txt @@ -2,9 +2,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) + set(modules "${SDK_ARUCO_LIBPATH}" opencv_core opencv_calib3d opencv_imgproc opencv_videoio) + + 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" + OUTPUT_VARIABLE krap + LINK_LIBRARIES ${modules}) + 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) + endif() + otr_module(tracker-aruco) - set(modules opencv_core opencv_calib3d opencv_imgproc opencv_videoio) - target_link_libraries(opentrack-tracker-aruco opentrack-cv ${SDK_ARUCO_LIBPATH} ${modules}) + target_link_libraries(opentrack-tracker-aruco opentrack-cv ${modules}) target_include_directories(opentrack-tracker-aruco SYSTEM PUBLIC ${OpenCV_INCLUDE_DIRS}) endif() endif() diff --git a/tracker-aruco/compile-test/abi.cpp b/tracker-aruco/compile-test/abi.cpp new file mode 100644 index 00000000..633188de --- /dev/null +++ b/tracker-aruco/compile-test/abi.cpp @@ -0,0 +1,11 @@ +#include "../../compat/linkage-macros.hpp" + +#define ARUCO_ABI aruco_opentrack_fork_abi_1 + +extern "C" void ARUCO_ABI(void); + +int main(void) +{ + ARUCO_ABI(); + return 0; +} |