2021-01-21 00:04:11 +00:00
|
|
|
# Copyright 2019-2021, Collabora, Ltd.
|
2021-01-12 00:41:27 +00:00
|
|
|
# SPDX-License-Identifier: BSL-1.0
|
|
|
|
|
2021-11-11 23:41:58 +00:00
|
|
|
# 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
|
2021-01-12 00:41:27 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/bindings.json
|
2021-11-11 23:41:58 +00:00
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/${output}"
|
|
|
|
VERBATIM
|
2021-01-12 00:41:27 +00:00
|
|
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bindings.py
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/bindings.json
|
2021-11-11 23:41:58 +00:00
|
|
|
COMMENT "Generating ${output}"
|
|
|
|
)
|
|
|
|
endfunction()
|
2021-01-12 00:41:27 +00:00
|
|
|
|
2021-11-11 23:41:58 +00:00
|
|
|
bindings_gen(b_generated_bindings.h)
|
|
|
|
bindings_gen(b_generated_bindings.c)
|
2021-01-12 00:41:27 +00:00
|
|
|
|
|
|
|
# Bindings library.
|
2021-11-11 23:41:58 +00:00
|
|
|
add_library(
|
|
|
|
aux_generated_bindings STATIC ${CMAKE_CURRENT_BINARY_DIR}/b_generated_bindings.c
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/b_generated_bindings.h
|
|
|
|
)
|
2021-01-12 00:41:27 +00:00
|
|
|
|
|
|
|
# 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)
|