monado/src/xrt/auxiliary/bindings/CMakeLists.txt
Ryan Pavlik cc4007a69e cmake: Substantial cleanups and simplifications
We now have a cmake-format config file.
We no longer use list variables for sources, instead using
target_sources when we need to add, in accordance with current
best practice. (This makes it a lot easier to edit too.) There's no more
include_directories(), add_definitions(), or other gently-deprecated
directory-scoped commands, nor any CMake scripts that include
a parent directory reference (named targets instead)
2021-11-12 09:48:37 -06:00

32 lines
1 KiB
CMake

# 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}")
target_link_libraries(aux_generated_bindings PRIVATE xrt-interfaces aux_util)