monado/src/xrt/auxiliary/bindings/CMakeLists.txt

32 lines
1,023 B
CMake
Raw Normal View History

2021-01-21 00:04:11 +00:00
# Copyright 2019-2021, Collabora, Ltd.
# SPDX-License-Identifier: BSL-1.0
# Binding generation: pass filename to generate
function(bindings_gen output)
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${output}"
COMMAND
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/bindings.py
${CMAKE_CURRENT_SOURCE_DIR}/bindings.json
"${CMAKE_CURRENT_BINARY_DIR}/${output}"
VERBATIM
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bindings.py
${CMAKE_CURRENT_SOURCE_DIR}/bindings.json
COMMENT "Generating ${output}"
)
endfunction()
bindings_gen(b_generated_bindings.h)
bindings_gen(b_generated_bindings.c)
# Bindings library.
add_library(
aux_generated_bindings STATIC ${CMAKE_CURRENT_BINARY_DIR}/b_generated_bindings.c
${CMAKE_CURRENT_BINARY_DIR}/b_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}")
2022-05-22 12:21:10 +00:00
target_link_libraries(aux_generated_bindings PRIVATE xrt-interfaces)