mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-01 12:46:12 +00:00
build: Move bindings build to bindings/subdir
The generated files should be in auxiliary/bindings/*.{c,h}. For this to work meson.build has to be in the bindings/ subdir: https://github.com/mesonbuild/meson/issues/2320 Move CMakeLists.txt there too for some consistency. Also fixes the previous include hack.
This commit is contained in:
parent
07218c9878
commit
46ec938f8a
|
@ -1,36 +1,6 @@
|
|||
# Copyright 2019-2020, Collabora, Ltd.
|
||||
# SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
###
|
||||
# Binding generation
|
||||
#
|
||||
|
||||
function(bindings_gen output custom_target)
|
||||
add_custom_command(OUTPUT ${output}
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/bindings/bindings.py
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/bindings/bindings.json
|
||||
${output}
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bindings/bindings.py
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/bindings/bindings.json
|
||||
)
|
||||
add_custom_target(${custom_target} DEPENDS ${output})
|
||||
endfunction(bindings_gen)
|
||||
|
||||
bindings_gen(${CMAKE_CURRENT_BINARY_DIR}/b_generated_bindings.h generated_bindings_h)
|
||||
bindings_gen(${CMAKE_CURRENT_BINARY_DIR}/b_generated_bindings.c generated_bindings_c)
|
||||
|
||||
# Bindings library.
|
||||
add_library(aux_generated_bindings STATIC ${CMAKE_CURRENT_BINARY_DIR}/b_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)
|
||||
# HACK: linking xrt-interfaces doesn't work for some reason
|
||||
target_include_directories(aux_generated_bindings PUBLIC "../include")
|
||||
|
||||
set(ANDROID_SOURCE_FILES
|
||||
android/android_ahardwarebuffer_allocator.c
|
||||
android/android_ahardwarebuffer_allocator.h
|
||||
|
@ -188,7 +158,7 @@ set(VK_SOURCE_FILES
|
|||
|
||||
# Common includes
|
||||
add_library(aux-includes INTERFACE)
|
||||
target_include_directories(aux-includes INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_include_directories(aux-includes INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
|
||||
target_link_libraries(aux-includes INTERFACE xrt-interfaces)
|
||||
|
||||
if(XRT_HAVE_OPENGL OR XRT_HAVE_OPENGLES)
|
||||
|
@ -288,3 +258,5 @@ if(ANDROID)
|
|||
CXX_STANDARD_REQUIRED ON)
|
||||
target_link_libraries(aux_vk PUBLIC aux_android)
|
||||
endif()
|
||||
|
||||
add_subdirectory(bindings)
|
||||
|
|
30
src/xrt/auxiliary/bindings/CMakeLists.txt
Normal file
30
src/xrt/auxiliary/bindings/CMakeLists.txt
Normal file
|
@ -0,0 +1,30 @@
|
|||
# Copyright 2019-2020, Collabora, Ltd.
|
||||
# SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
###
|
||||
# Binding generation
|
||||
#
|
||||
|
||||
function(bindings_gen output custom_target)
|
||||
add_custom_command(OUTPUT ${output}
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/bindings.py
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/bindings.json
|
||||
${output}
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bindings.py
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/bindings.json
|
||||
)
|
||||
add_custom_target(${custom_target} DEPENDS ${output})
|
||||
endfunction(bindings_gen)
|
||||
|
||||
bindings_gen(${CMAKE_CURRENT_BINARY_DIR}/b_generated_bindings.h generated_bindings_h)
|
||||
bindings_gen(${CMAKE_CURRENT_BINARY_DIR}/b_generated_bindings.c generated_bindings_c)
|
||||
|
||||
# Bindings library.
|
||||
add_library(aux_generated_bindings STATIC ${CMAKE_CURRENT_BINARY_DIR}/b_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}")
|
||||
|
||||
target_include_directories(aux_generated_bindings PRIVATE aux-includes xrt-interfaces)
|
||||
target_link_libraries(aux_generated_bindings PRIVATE xrt-interfaces aux_util)
|
39
src/xrt/auxiliary/bindings/meson.build
Normal file
39
src/xrt/auxiliary/bindings/meson.build
Normal file
|
@ -0,0 +1,39 @@
|
|||
# Copyright 2019-2020, Collabora, Ltd.
|
||||
# SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
###
|
||||
# Binding generation
|
||||
#
|
||||
|
||||
aux_bindings_dir = meson.current_source_dir()
|
||||
|
||||
prog_python = import('python').find_installation('python3')
|
||||
|
||||
generated_bindings = custom_target('bindings code',
|
||||
command: [prog_python, '@INPUT@', '@OUTPUT@'],
|
||||
input: ['bindings.py', 'bindings.json'],
|
||||
output: [
|
||||
'b_generated_bindings.h',
|
||||
'b_generated_bindings.c',
|
||||
]
|
||||
)
|
||||
|
||||
generated_bindings_h = generated_bindings[0]
|
||||
generated_bindings_c = generated_bindings[1]
|
||||
|
||||
lib_aux_generated_bindings = static_library(
|
||||
'aux_generated_bindings',
|
||||
generated_bindings_c,
|
||||
include_directories: [
|
||||
xrt_include,
|
||||
aux_include,
|
||||
],
|
||||
dependencies: [
|
||||
xrt_config_have,
|
||||
]
|
||||
)
|
||||
|
||||
aux_generated_bindings = declare_dependency(
|
||||
include_directories: aux_include,
|
||||
link_with: lib_aux_generated_bindings,
|
||||
)
|
|
@ -3,48 +3,14 @@
|
|||
|
||||
aux_include = include_directories('.')
|
||||
|
||||
subdir('bindings')
|
||||
|
||||
u_git_tag_c = vcs_tag(
|
||||
input: 'util/u_git_tag.c.in',
|
||||
output: 'u_git_tag.c',
|
||||
replace_string: '@GIT_DESC@',
|
||||
)
|
||||
|
||||
###
|
||||
# Binding generation
|
||||
#
|
||||
|
||||
aux_bindings_dir = join_paths(meson.current_source_dir(), 'bindings')
|
||||
|
||||
prog_python = import('python').find_installation('python3')
|
||||
|
||||
generated_bindings = custom_target('bindings code',
|
||||
command: [prog_python, '@INPUT@', '@OUTPUT@'],
|
||||
input: ['bindings/bindings.py', 'bindings/bindings.json'],
|
||||
output: [
|
||||
'b_generated_bindings.h',
|
||||
'b_generated_bindings.c',
|
||||
]
|
||||
)
|
||||
|
||||
generated_bindings_h = generated_bindings[0]
|
||||
generated_bindings_c = generated_bindings[1]
|
||||
|
||||
lib_aux_generated_bindings = static_library(
|
||||
'aux_generated_bindings',
|
||||
generated_bindings_c,
|
||||
include_directories: [
|
||||
xrt_include,
|
||||
],
|
||||
dependencies: [
|
||||
xrt_config_have,
|
||||
]
|
||||
)
|
||||
|
||||
aux_generated_bindings = declare_dependency(
|
||||
include_directories: aux_include,
|
||||
link_with: lib_aux_generated_bindings,
|
||||
)
|
||||
|
||||
lib_aux_util = static_library(
|
||||
'aux_util',
|
||||
files(
|
||||
|
|
|
@ -84,6 +84,7 @@ target_link_libraries(st_oxr PRIVATE
|
|||
aux_math
|
||||
aux_generated_bindings
|
||||
comp_client
|
||||
aux-includes
|
||||
PUBLIC
|
||||
aux_os
|
||||
Vulkan::Vulkan
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "b_generated_bindings.h"
|
||||
#include "bindings/b_generated_bindings.h"
|
||||
|
||||
/*
|
||||
*
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "util/u_misc.h"
|
||||
|
||||
#include "xrt/xrt_compiler.h"
|
||||
#include "b_generated_bindings.h"
|
||||
#include "bindings/b_generated_bindings.h"
|
||||
|
||||
#include "oxr_objects.h"
|
||||
#include "oxr_logger.h"
|
||||
|
|
|
@ -29,7 +29,7 @@ extern "C" {
|
|||
#include "xrt/xrt_device.h"
|
||||
#include "xrt/xrt_instance.h"
|
||||
|
||||
#include "b_generated_bindings.h"
|
||||
#include "bindings/b_generated_bindings.h"
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
|
|
Loading…
Reference in a new issue