blob: 22e8f0d41390f1e0722a5567ec0d67a32c64e072 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
include(common)
function(target_fbs_source Tgt Key Src)
get_built_tool_path(flatc_bin flatc_dependency contrib/libs/flatbuffers/flatc flatc)
file(RELATIVE_PATH fbsRel ${PROJECT_SOURCE_DIR} ${Src})
get_filename_component(OutputBase ${fbsRel} NAME_WLE)
get_filename_component(OutputDir ${PROJECT_BINARY_DIR}/${fbsRel} DIRECTORY)
add_custom_command(
OUTPUT
${PROJECT_BINARY_DIR}/${fbsRel}.h
${PROJECT_BINARY_DIR}/${fbsRel}.cpp
${OutputDir}/${OutputBase}.iter.fbs.h
${OutputDir}/${OutputBase}.bfbs
COMMAND Python3::Interpreter
${PROJECT_SOURCE_DIR}/build/scripts/cpp_flatc_wrapper.py
${flatc_bin}
${FBS_CPP_FLAGS} ${ARGN}
-o ${PROJECT_BINARY_DIR}/${fbsRel}.h
${Src}
DEPENDS ${PROJECT_SOURCE_DIR}/build/scripts/cpp_flatc_wrapper.py ${Src} ${flatc_dependency}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
)
target_sources(${Tgt} ${Key}
${PROJECT_BINARY_DIR}/${fbsRel}.cpp
${PROJECT_BINARY_DIR}/${fbsRel}.h
${OutputDir}/${OutputBase}.iter.fbs.h
)
endfunction()
|