cmake: make ulv2 build a little better

This commit is contained in:
Moses Turner 2021-06-22 10:06:58 -05:00 committed by Jakob Bornecrantz
parent 960e68a976
commit 7461c57043
3 changed files with 65 additions and 15 deletions

View file

@ -60,19 +60,7 @@ find_package(ZLIB)
find_package(cJSON) find_package(cJSON)
find_package(Systemd) find_package(Systemd)
find_package(OpenGLES COMPONENTS V3) find_package(OpenGLES COMPONENTS V3)
find_package(LeapV2)
#find_package(Leap)
find_library(Leap
NAMES libLeap.so
PATHS /usr/local/lib
)
if (Leap)
include_directories(include /usr/local/include/)
message(STATUS "Found libLeap: ${Leap}")
else()
message(STATUS "Could NOT find libLeap: (missing: /usr/local/lib/libLeap.so)")
endif()
add_library(xrt-pthreads INTERFACE) add_library(xrt-pthreads INTERFACE)
@ -206,7 +194,7 @@ cmake_dependent_option(XRT_BUILD_DRIVER_DAYDREAM "Enable the Google Daydream Vie
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_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) cmake_dependent_option(XRT_BUILD_DRIVER_ILLIXR "Enable ILLIXR driver" ON "ILLIXR_PATH" OFF)
option(XRT_BUILD_DRIVER_DUMMY "Enable dummy driver" ON) option(XRT_BUILD_DRIVER_DUMMY "Enable dummy driver" ON)
cmake_dependent_option(XRT_BUILD_DRIVER_ULV2 "Enable Ultraleap v2 driver" ON "Leap" OFF) cmake_dependent_option(XRT_BUILD_DRIVER_ULV2 "Enable Ultraleap v2 driver" ON "LeapV2_FOUND" OFF)
cmake_dependent_option(XRT_BUILD_DRIVER_REMOTE "Enable remote debugging driver" ON "XRT_HAVE_LINUX OR ANDROID" OFF) cmake_dependent_option(XRT_BUILD_DRIVER_REMOTE "Enable remote debugging driver" ON "XRT_HAVE_LINUX OR ANDROID" OFF)
option(XRT_BUILD_DRIVER_WMR "Enable Windows Mixed Reality driver" ON) option(XRT_BUILD_DRIVER_WMR "Enable Windows Mixed Reality driver" ON)

62
cmake/FindLeapV2.cmake Normal file
View file

@ -0,0 +1,62 @@
# Copyright 2019-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>
#.rst:
# FindLeapV2
# ---------------
#
# Find the Ultraleap v2 drivers
#
# Targets
# ^^^^^^^
#
# If successful, the following import target is created.
#
# ``LeapV2::LeapV2``
#
# Cache variables
# ^^^^^^^^^^^^^^^
#
# The following cache variable may also be set to assist/control the operation of this module:
#
# ``LeapV2_ROOT_DIR``
# The root to search for Leap v2.
#
set(LeapV2_ROOT_DIR
"${LeapV2_ROOT_DIR}"
CACHE PATH "Root to search for LeapV2")
find_path(
LeapV2_INCLUDE_DIR
NAMES Leap.h LeapMath.h
PATHS ${LeapV2_ROOT_DIR}
PATH_SUFFIXES include)
find_library(
LeapV2_LIBRARY
NAMES Leap
PATHS ${LeapV2_ROOT_DIR}
PATH_SUFFIXES lib)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LeapV2 REQUIRED_VARS LeapV2_INCLUDE_DIR
LeapV2_LIBRARY)
if(LeapV2_FOUND)
set(LeapV2_INCLUDE_DIRS "${LeapV2_INCLUDE_DIR}")
set(LeapV2_LIBRARIES "${LeapV2_LIBRARY}")
if(NOT TARGET LeapV2::LeapV2)
add_library(LeapV2::LeapV2 UNKNOWN IMPORTED)
endif()
set_target_properties(
LeapV2::LeapV2 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
"${LeapV2_INCLUDE_DIR}")
set_target_properties(LeapV2::LeapV2 PROPERTIES IMPORTED_LOCATION
"${LeapV2_LIBRARY}")
mark_as_advanced(LeapV2_INCLUDE_DIR LeapV2_LIBRARY)
endif()
mark_as_advanced(LeapV2_ROOT_DIR)

View file

@ -133,7 +133,7 @@ if(XRT_BUILD_DRIVER_ULV2)
ultraleap_v2/ulv2_interface.h ultraleap_v2/ulv2_interface.h
) )
add_library(drv_ulv2 STATIC ${ULV2_SOURCE_FILES}) add_library(drv_ulv2 STATIC ${ULV2_SOURCE_FILES})
target_link_libraries(drv_ulv2 PRIVATE xrt-interfaces aux_util aux_math Leap) target_link_libraries(drv_ulv2 PRIVATE xrt-interfaces aux_util aux_math LeapV2::LeapV2)
endif() endif()
if(XRT_BUILD_DRIVER_OHMD) if(XRT_BUILD_DRIVER_OHMD)