From 85d3e8bdc37e7bfd8a4d7d62bc6d00da52bcf023 Mon Sep 17 00:00:00 2001 From: Christoph Haag Date: Tue, 5 Jan 2021 21:15:06 +0100 Subject: [PATCH] build/cmake: generate steamvr input profiles --- src/xrt/auxiliary/CMakeLists.txt | 2 ++ src/xrt/targets/steamvr_drv/CMakeLists.txt | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/xrt/auxiliary/CMakeLists.txt b/src/xrt/auxiliary/CMakeLists.txt index db151202c..52279823b 100644 --- a/src/xrt/auxiliary/CMakeLists.txt +++ b/src/xrt/auxiliary/CMakeLists.txt @@ -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) diff --git a/src/xrt/targets/steamvr_drv/CMakeLists.txt b/src/xrt/targets/steamvr_drv/CMakeLists.txt index 0a6d04de4..b080b5b65 100644 --- a/src/xrt/targets/steamvr_drv/CMakeLists.txt +++ b/src/xrt/targets/steamvr_drv/CMakeLists.txt @@ -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