2021-11-11 23:41:58 +00:00
|
|
|
# Copyright 2020-2021, Collabora, Ltd.
|
2020-06-10 13:48:43 +00:00
|
|
|
# SPDX-License-Identifier: BSL-1.0
|
|
|
|
|
2021-01-05 20:15:06 +00:00
|
|
|
get_property(AUX_BINDINGS_DIR GLOBAL PROPERTY AUX_BINDINGS_DIR_PROP)
|
|
|
|
set(INPUT_PROFILES_INPUT_DIR ${AUX_BINDINGS_DIR})
|
|
|
|
set(INPUT_PROFILES_OUTPUT_DIR "${PROJECT_BINARY_DIR}/steamvr-monado/resources/input/")
|
|
|
|
|
2021-11-11 23:41:58 +00:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT "${INPUT_PROFILES_OUTPUT_DIR}"
|
|
|
|
COMMAND
|
|
|
|
${PYTHON_EXECUTABLE} ${INPUT_PROFILES_INPUT_DIR}/steamvr_profiles.py
|
aux/binding: Implement optional "steamvr_controllertypes" for SteamVR input bindings
Add an optional switch -s or --steamvr to steamvr_profiles.py, which enables
a different naming scheme for the "controller_type" field in the generated
SteamVR profile json files.
If the switch is provided and an interaction profile in bindings.json
provides the optional new property "steamvr_controllertype", that property
will be used for the "controller_type" field of the written out .json,
instead of the regular auto-generated name.
This allows to generate json files which use controller_type names normally
used by SteamVR, so Monado provided controllers are mapped to the same
OpenXR interaction profiles that SteamVR would normally map them to.
E.g., the standard controller_type for Oculus touch controllers used by
SteamVR is "oculus_touch" instead of Monado's "monado_oculus_touch_controller".
That in turn allows OpenXR clients to use the SteamVR/OpenXR runtime to
access controllers provided by Monado's SteamVR driver plugin. Without such
compatible json files, only standard OpenVR clients can use controllers
exposed by Monado's SteamVR driver by default, but not OpenXR clients.
Tested with an Oculus Rift CV-1, and shown to now enable OpenXR clients
to make full use of the Oculus touch controllers.
The mappings for controllers other than Oculus Touch are derived from
SteamVR log output, but not actually tested due to lack of suitable hw.
Per discussion for the merge request, we enable this '-s' flag by
default in the make file for SteamVR style naming scheme.
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
2023-01-17 04:11:49 +00:00
|
|
|
${INPUT_PROFILES_INPUT_DIR}/bindings.json "${INPUT_PROFILES_OUTPUT_DIR}" "-s"
|
2021-11-11 23:41:58 +00:00
|
|
|
DEPENDS ${INPUT_PROFILES_INPUT_DIR}/bindings.py ${INPUT_PROFILES_INPUT_DIR}/bindings.json
|
|
|
|
COMMENT "Generating SteamVR input profiles to ${INPUT_PROFILES_OUTPUT_DIR}"
|
|
|
|
)
|
|
|
|
add_custom_target(
|
|
|
|
steamvr_generated_input_profiles
|
|
|
|
DEPENDS "${INPUT_PROFILES_OUTPUT_DIR}"
|
|
|
|
COMMENT "Generating SteamVR input profiles"
|
|
|
|
)
|
2021-01-05 20:15:06 +00:00
|
|
|
|
2020-11-09 23:16:38 +00:00
|
|
|
add_library(driver_monado MODULE main.c)
|
2021-11-11 23:41:58 +00:00
|
|
|
add_dependencies(driver_monado steamvr_generated_input_profiles)
|
2020-06-10 13:48:43 +00:00
|
|
|
|
2020-11-09 23:16:38 +00:00
|
|
|
target_link_libraries(
|
2021-11-11 23:41:58 +00:00
|
|
|
driver_monado
|
|
|
|
PRIVATE
|
|
|
|
xrt-external-openvr
|
|
|
|
aux_util
|
|
|
|
st_ovrd
|
|
|
|
st_prober
|
|
|
|
target_lists
|
|
|
|
target_instance_no_comp
|
2020-06-10 13:48:43 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# meta data that the steamvr plugin needs in the base directory of the steamvr plugin
|
2020-11-09 23:16:38 +00:00
|
|
|
file(COPY driver.vrdrivermanifest DESTINATION ${PROJECT_BINARY_DIR}/steamvr-monado)
|
|
|
|
file(COPY resources DESTINATION ${PROJECT_BINARY_DIR}/steamvr-monado)
|
2020-06-10 13:48:43 +00:00
|
|
|
|
2021-11-11 23:41:58 +00:00
|
|
|
# determine the output directory for the steamvr plugin
|
2020-11-09 23:16:38 +00:00
|
|
|
if(WIN32)
|
|
|
|
# FIXME need to account for different architectures
|
|
|
|
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
|
2021-11-11 23:41:58 +00:00
|
|
|
set(PLUGINDIR "${PROJECT_BINARY_DIR}/steamvr-monado/bin/win64")
|
2020-11-09 23:16:38 +00:00
|
|
|
else()
|
2021-11-11 23:41:58 +00:00
|
|
|
set(PLUGINDIR "${PROJECT_BINARY_DIR}/steamvr-monado/bin/win32")
|
2020-11-09 23:16:38 +00:00
|
|
|
endif()
|
2020-06-10 13:48:43 +00:00
|
|
|
elseif(APPLE)
|
2020-11-09 23:16:38 +00:00
|
|
|
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
|
2021-11-11 23:41:58 +00:00
|
|
|
set(PLUGINDIR "${PROJECT_BINARY_DIR}/steamvr-monado/bin/osx64")
|
2020-11-09 23:16:38 +00:00
|
|
|
else()
|
2021-11-11 23:41:58 +00:00
|
|
|
set(PLUGINDIR "${PROJECT_BINARY_DIR}/steamvr-monado/bin/osx32")
|
2020-11-09 23:16:38 +00:00
|
|
|
endif()
|
2020-06-10 13:48:43 +00:00
|
|
|
elseif(NOT ANDROID)
|
2020-11-09 23:16:38 +00:00
|
|
|
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
|
2021-11-11 23:41:58 +00:00
|
|
|
set(PLUGINDIR "${PROJECT_BINARY_DIR}/steamvr-monado/bin/linux64")
|
2020-11-09 23:16:38 +00:00
|
|
|
else()
|
2021-11-11 23:41:58 +00:00
|
|
|
set(PLUGINDIR "${PROJECT_BINARY_DIR}/steamvr-monado/bin/linux32")
|
2020-11-09 23:16:38 +00:00
|
|
|
endif()
|
2020-06-10 13:48:43 +00:00
|
|
|
endif()
|
|
|
|
|
2021-11-11 23:41:58 +00:00
|
|
|
# message("SteamVR plugin path: ${PLUGINDIR}")
|
2020-06-10 13:48:43 +00:00
|
|
|
set_target_properties(driver_monado PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${PLUGINDIR}")
|
|
|
|
|
|
|
|
# don't add lib prefix to driver_monado.so
|
2020-11-09 23:16:38 +00:00
|
|
|
set_target_properties(driver_monado PROPERTIES PREFIX "")
|
2020-06-10 13:48:43 +00:00
|
|
|
|
2021-11-11 23:41:58 +00:00
|
|
|
install(
|
|
|
|
DIRECTORY "${PROJECT_BINARY_DIR}/steamvr-monado"
|
|
|
|
DESTINATION "${CMAKE_INSTALL_PREFIX}/share"
|
|
|
|
)
|