summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGuillaume Dollé <dolle.guillaume@gmail.com>2021-08-01 03:47:02 +0200
committerGuillaume Dollé <dolle.guillaume@gmail.com>2021-08-01 03:47:02 +0200
commitef77e5d02ebf8bb2794301de143fb57890f5c330 (patch)
tree1347b8cb09fc078a8110e6fafccd37036f47c339
parentfef1936f3c320ec026a0fdf65f103494385e15e3 (diff)
Find ONNXRuntime using cmake modules
-rw-r--r--tracker-neuralnet/CMakeLists.txt16
-rw-r--r--tracker-neuralnet/ftnoir_tracker_neuralnet.h4
2 files changed, 8 insertions, 12 deletions
diff --git a/tracker-neuralnet/CMakeLists.txt b/tracker-neuralnet/CMakeLists.txt
index d06f0c83..f02911b0 100644
--- a/tracker-neuralnet/CMakeLists.txt
+++ b/tracker-neuralnet/CMakeLists.txt
@@ -1,18 +1,14 @@
include(opentrack-opencv)
find_package(OpenCV QUIET)
find_package(OpenMP QUIET) # Used to control number of onnx threads.
-set(SDK_ONNX_LIBPATH "" CACHE FILEPATH "Full path of onnx library")
-
-if(OpenCV_FOUND AND SDK_ONNX_LIBPATH AND OpenMP_FOUND)
- get_filename_component(ONNX_INCLUDE_DIR "${SDK_ONNX_LIBPATH}" DIRECTORY)
- get_filename_component(ONNX_INCLUDE_DIR "${ONNX_INCLUDE_DIR}" ABSOLUTE)
- set(ONNX_INCLUDE_DIR "${ONNX_INCLUDE_DIR}/../include")
+find_package(ONNXRuntime REQUIRED)
+if(OpenCV_FOUND AND ONNXRuntime_FOUND AND OpenMP_FOUND)
otr_module(tracker-neuralnet)
target_include_directories(${self} SYSTEM PUBLIC
- ${OpenCV_INCLUDE_DIRS} "${ONNX_INCLUDE_DIR}")
- target_link_libraries(${self}
- opentrack-cv "${SDK_ONNX_LIBPATH}" opencv_imgproc opencv_core
+ ${OpenCV_INCLUDE_DIRS} "${ONNXRuntime_INCLUDE_DIRS}")
+ target_link_libraries(${self} "${ONNXRuntime_LIBRARIES}"
+ opentrack-cv opencv_imgproc opencv_core
opencv_imgcodecs opencv_calib3d
OpenMP::OpenMP_C)
@@ -20,4 +16,4 @@ if(OpenCV_FOUND AND SDK_ONNX_LIBPATH AND OpenMP_FOUND)
FILES "models/head-localizer.onnx" "models/head-pose.onnx"
DESTINATION "${opentrack-libexec}/models"
PERMISSIONS ${opentrack-perms-file})
-endif() \ No newline at end of file
+endif()
diff --git a/tracker-neuralnet/ftnoir_tracker_neuralnet.h b/tracker-neuralnet/ftnoir_tracker_neuralnet.h
index b2eca6e3..6c3af079 100644
--- a/tracker-neuralnet/ftnoir_tracker_neuralnet.h
+++ b/tracker-neuralnet/ftnoir_tracker_neuralnet.h
@@ -26,7 +26,7 @@
#include <memory>
#include <cinttypes>
-#include <onnxruntime_cxx_api.h>
+#include <onnxruntime/core/session/onnxruntime_cxx_api.h>
#include <opencv2/core.hpp>
#include <opencv2/core/types.hpp>
@@ -230,4 +230,4 @@ class neuralnet_metadata : public Metadata
using neuralnet_tracker_ns::neuralnet_tracker;
using neuralnet_tracker_ns::neuralnet_dialog;
-using neuralnet_tracker_ns::neuralnet_metadata; \ No newline at end of file
+using neuralnet_tracker_ns::neuralnet_metadata;