build/cmake: generate steamvr input profiles

This commit is contained in:
Christoph Haag 2021-01-05 21:15:06 +01:00
parent 334864de7f
commit 85d3e8bdc3
2 changed files with 20 additions and 0 deletions

View file

@ -23,6 +23,8 @@ bindings_gen(${CMAKE_CURRENT_BINARY_DIR}/xrt_generated_bindings.c generated_bind
add_library(aux_generated_bindings STATIC ${CMAKE_CURRENT_BINARY_DIR}/xrt_generated_bindings.c)
add_dependencies(aux_generated_bindings generated_bindings_h)
# needed globally for steamvr input profile generation in steamvr target
set_property(GLOBAL PROPERTY AUX_BINDINGS_DIR_PROP "${CMAKE_CURRENT_SOURCE_DIR}/bindings")
target_include_directories(aux_generated_bindings PUBLIC "${CMAKE_CURRENT_BINARY_DIR}" ".")
target_link_libraries(aux_generated_bindings INTERFACE xrt-interfaces aux_util)

View file

@ -1,7 +1,25 @@
# Copyright 2020, Collabora, Ltd.
# SPDX-License-Identifier: BSL-1.0
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/")
function(input_profiles_gen output custom_target)
add_custom_command(OUTPUT ${output}
COMMAND ${PYTHON_EXECUTABLE} ${INPUT_PROFILES_INPUT_DIR}/steamvr_profiles.py
${INPUT_PROFILES_INPUT_DIR}/bindings.json
${output}
DEPENDS ${INPUT_PROFILES_INPUT_DIR}/bindings.py
${INPUT_PROFILES_INPUT_DIR}/bindings.json
)
add_custom_target(${custom_target} DEPENDS ${output})
endfunction(input_profiles_gen)
input_profiles_gen(${INPUT_PROFILES_OUTPUT_DIR} generated_input_profiles)
add_library(driver_monado MODULE main.c)
add_dependencies(driver_monado generated_input_profiles)
target_link_libraries(
driver_monado PRIVATE xrt-external-openvr aux_util st_ovrd st_prober target_lists target_instance_no_comp