mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-27 09:01:46 +00:00
cmake: Add ONNX Runtime as a dependency for the handtracking driver
Co-authored-by: Ryan Pavlik <ryan.pavlik@collabora.com> cmake-rebase
This commit is contained in:
parent
cef922946a
commit
4b5f4b9721
|
@ -62,6 +62,7 @@ find_package(cJSON)
|
|||
find_package(Systemd)
|
||||
find_package(OpenGLES COMPONENTS V3)
|
||||
find_package(LeapV2)
|
||||
find_package(ONNXRuntime)
|
||||
|
||||
#https://github.com/arsenm/sanitizers-cmake
|
||||
find_package(Sanitizers)
|
||||
|
@ -187,12 +188,13 @@ cmake_dependent_option(XRT_HAVE_SDL2 "Enable use of SDL2" ON "SDL2_FOUND AND XRT
|
|||
cmake_dependent_option(XRT_HAVE_SYSTEM_CJSON "Enable cJSON from system, instead of bundled source" ON "CJSON_FOUND" OFF)
|
||||
cmake_dependent_option(XRT_HAVE_GST "Enable gstreamer" ON "GST_FOUND" OFF)
|
||||
cmake_dependent_option(XRT_HAVE_PERCETTO "Enable percetto support" ON "PERCETTO_FOUND" OFF)
|
||||
cmake_dependent_option(XRT_HAVE_ONNXRUNTIME "Enable ONNX runtime support" ON "ONNXRUNTIME_FOUND" OFF)
|
||||
|
||||
cmake_dependent_option(XRT_BUILD_DRIVER_PSVR "Enable PSVR HMD driver" ON "HIDAPI_FOUND" OFF)
|
||||
cmake_dependent_option(XRT_BUILD_DRIVER_RS "Enable RealSense device driver" ON "realsense2_FOUND" OFF)
|
||||
cmake_dependent_option(XRT_BUILD_DRIVER_VIVE "Enable driver for HTC Vive, Vive Pro, Valve Index, and their controllers" ON "ZLIB_FOUND AND XRT_HAVE_LINUX" OFF)
|
||||
cmake_dependent_option(XRT_BUILD_DRIVER_OHMD "Enable OpenHMD driver" ON "OPENHMD_FOUND" OFF)
|
||||
cmake_dependent_option(XRT_BUILD_DRIVER_HANDTRACKING "Enable Camera Hand Tracking driver" ON "XRT_HAVE_V4L2" OFF)
|
||||
cmake_dependent_option(XRT_BUILD_DRIVER_HANDTRACKING "Enable Camera Hand Tracking driver" ON "XRT_HAVE_ONNXRUNTIME AND XRT_HAVE_OPENCV AND XRT_HAVE_V4L2" OFF)
|
||||
cmake_dependent_option(XRT_BUILD_DRIVER_DAYDREAM "Enable the Google Daydream View controller driver (BLE, via D-Bus)" ON "XRT_HAVE_DBUS" OFF)
|
||||
cmake_dependent_option(XRT_BUILD_DRIVER_ARDUINO "Enable Arduino input device with BLE via via D-Bus" ON "XRT_HAVE_DBUS" OFF)
|
||||
cmake_dependent_option(XRT_BUILD_DRIVER_ILLIXR "Enable ILLIXR driver" ON "ILLIXR_PATH" OFF)
|
||||
|
@ -360,6 +362,7 @@ message(STATUS "# LIBUVC: ${XRT_HAVE_LIBUVC}")
|
|||
message(STATUS "# FFMPEG: ${XRT_HAVE_FFMPEG}")
|
||||
message(STATUS "# SDL2: ${XRT_HAVE_SDL2}")
|
||||
message(STATUS "# PERCETTO: ${XRT_HAVE_PERCETTO}")
|
||||
message(STATUS "# ONNXRUNTIME: ${XRT_HAVE_ONNXRUNTIME}")
|
||||
message(STATUS "# SYSTEM_CJSON: ${XRT_HAVE_SYSTEM_CJSON}")
|
||||
message(STATUS "#")
|
||||
message(STATUS "# FEATURE_COMPOSITOR_MAIN: ${XRT_FEATURE_COMPOSITOR_MAIN}")
|
||||
|
|
78
cmake/FindONNXRuntime.cmake
Normal file
78
cmake/FindONNXRuntime.cmake
Normal file
|
@ -0,0 +1,78 @@
|
|||
# Copyright 2021, Collabora, Ltd.
|
||||
# SPDX-License-Identifier: BSL-1.0
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
#
|
||||
# Original Author:
|
||||
# 2021 Moses Turner <moses@collabora.com>
|
||||
# 2021 Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||
|
||||
#.rst:
|
||||
# FindONNXRuntime
|
||||
# ---------------
|
||||
#
|
||||
# Find the ONNX runtime
|
||||
#
|
||||
# Targets
|
||||
# ^^^^^^^
|
||||
#
|
||||
# If successful, the following import target is created.
|
||||
#
|
||||
# ``ONNXRuntime::ONNXRuntime``
|
||||
#
|
||||
# Cache variables
|
||||
# ^^^^^^^^^^^^^^^
|
||||
#
|
||||
# The following cache variable may also be set to assist/control the operation of this module:
|
||||
#
|
||||
# ``ONNXRuntime_ROOT_DIR``
|
||||
# The root to search for ONNX runtime.
|
||||
#
|
||||
|
||||
include(FeatureSummary)
|
||||
set_package_properties(
|
||||
ONNXRuntime PROPERTIES
|
||||
URL "https://onnxruntime.ai/"
|
||||
DESCRIPTION "Machine learning runtime")
|
||||
|
||||
set(ONNXRuntime_ROOT_DIR
|
||||
"${ONNXRuntime_ROOT_DIR}"
|
||||
CACHE PATH "Root to search for ONNXRuntime")
|
||||
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(PC_ONNXRuntime QUIET libonnxruntime)
|
||||
|
||||
find_library(
|
||||
ONNXRuntime_LIBRARY
|
||||
NAMES onnxruntime
|
||||
PATHS ${ONNXRuntime_ROOT_DIR}
|
||||
PATH_SUFFIXES lib
|
||||
HINTS ${PC_ONNXRuntime_LIBRARY_DIRS})
|
||||
find_path(
|
||||
ONNXRuntime_INCLUDE_DIR core/session/onnxruntime_cxx_api.h
|
||||
PATHS ${ONNXRuntime_ROOT_DIR}
|
||||
PATH_SUFFIXES onnxruntime include/onnxruntime
|
||||
HINTS ${PC_ONNXRuntime_INCLUDE_DIRS})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(
|
||||
ONNXRuntime REQUIRED_VARS ONNXRuntime_INCLUDE_DIR ONNXRuntime_LIBRARY)
|
||||
|
||||
if(ONNXRuntime_FOUND)
|
||||
set(ONNXRuntime_INCLUDE_DIRS ${ONNXRuntime_INCLUDE_DIR})
|
||||
set(ONNXRuntime_LIBRARIES "${ONNXRuntime_LIBRARY}")
|
||||
if(NOT TARGET ONNXRuntime::ONNXRuntime)
|
||||
add_library(ONNXRuntime::ONNXRuntime UNKNOWN IMPORTED)
|
||||
endif()
|
||||
set_target_properties(
|
||||
ONNXRuntime::ONNXRuntime PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
|
||||
"${ONNXRuntime_INCLUDE_DIRS}")
|
||||
set_target_properties(
|
||||
ONNXRuntime::ONNXRuntime
|
||||
PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION "${ONNXRuntime_LIBRARY}")
|
||||
mark_as_advanced(ONNXRuntime_INCLUDE_DIRS ONNXRuntime_LIBRARY)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(ONNXRuntime_ROOT_DIR)
|
Loading…
Reference in a new issue