summaryrefslogtreecommitdiffhomepage
path: root/cmake
diff options
context:
space:
mode:
authorGuillaume Dollé <dolle.guillaume@gmail.com>2021-08-01 03:49:35 +0200
committerGuillaume Dollé <dolle.guillaume@gmail.com>2021-08-01 03:49:35 +0200
commitb0a65634d2527488824d1dacdd5a877d54eb7869 (patch)
tree5ac1ad9dc2ddbf52131d2deb196260bc35a5ae20 /cmake
parentef77e5d02ebf8bb2794301de143fb57890f5c330 (diff)
Add ONNXRuntime cmake module
Diffstat (limited to 'cmake')
-rw-r--r--cmake/FindONNXRuntime.cmake31
1 files changed, 31 insertions, 0 deletions
diff --git a/cmake/FindONNXRuntime.cmake b/cmake/FindONNXRuntime.cmake
new file mode 100644
index 00000000..733bdb36
--- /dev/null
+++ b/cmake/FindONNXRuntime.cmake
@@ -0,0 +1,31 @@
+# FindONNXRuntime
+# ===============
+#
+# Find an ONNX Runtime installation.
+# ONNX Runtime is a cross-platform inference and training machine-learning
+# accelerator.
+#
+# Input variables
+# ---------------
+#
+# ONNXRuntime_ROOT Set root installation.
+#
+# Output variable
+# ---------------
+#
+# ONNXRuntime_FOUND Variable indicating that ONNXRuntime has been
+# found.
+# ONNXRuntime_LIBRARIES Library implementing ONNXRuntime
+# ONNXRuntime_INCLUDE_DIRS Headers for ONNXRuntime
+
+find_library(ORT_LIB onnxruntime
+ CMAKE_FIND_ROOT_PATH_BOTH)
+find_path(ORT_INCLUDE onnxruntime/core/session/onnxruntime_cxx_api.h
+ CMAKE_FIND_ROOT_PATH_BOTH)
+
+if(ORT_LIB AND ORT_INCLUDE)
+ set(ONNXRuntime_FOUND TRUE)
+ # For CMake output only
+ set(ONNXRuntime_LIBRARIES "${ORT_LIB}" CACHE STRING "ONNX Runtime libraries")
+ set(ONNXRuntime_INCLUDE_DIRS "${ORT_INCLUDE}" CACHE STRING "ONNX Runtime include path")
+endif()