@@ -51,9 +51,39 @@ find_package(FreeType REQUIRED)
5151if (FREETYPE_FOUND)
5252 message (STATUS "freetype include path: ${FREETYPE_INCLUDE_DIRS} " )
5353endif ()
54+
55+ # find flatbuffers
56+ if (NOT TARGET flatbuffers)
57+ find_package (flatbuffers REQUIRED)
58+ endif ()
59+ # ==================================================================================================
60+
61+ # ==================================================================================================
62+ function (render_pipeline_generate_schema_headers)
63+ # generate schema headers
64+ if (NOT FlatBuffers_flatc)
65+ message (FATAL_ERROR "Cannot find flatc program." )
66+ endif ()
67+
68+ file (GLOB flatc_input_files "${PROJECT_SOURCE_DIR} /resources/data/schema/*.fbs" )
69+ foreach (input_file ${flatc_input_files} )
70+ execute_process (
71+ COMMAND ${FlatBuffers_flatc} -c --scoped-enums "${input_file} "
72+ WORKING_DIRECTORY "${PROJECT_BINARY_DIR} /rpcore/schema"
73+ RESULT_VARIABLE flatc_result
74+ )
75+ if (NOT (${flatc_result} EQUAL "0" ))
76+ message (SEND_ERROR "flatc returns error for a file '${input_file} '" )
77+ endif ()
78+ endforeach ()
79+
80+ message (STATUS "Render Pipeline: Schema header files are generated." )
81+ endfunction ()
5482# ==================================================================================================
5583
5684# === target =======================================================================================
85+ render_pipeline_generate_schema_headers()
86+
5787include ("${PROJECT_SOURCE_DIR} /files.cmake" )
5888add_library (${PROJECT_NAME} SHARED ${render_pipeline_sources} ${render_pipeline_headers} )
5989
@@ -85,7 +115,7 @@ target_link_libraries(${PROJECT_NAME}
85115
86116 PRIVATE $<$<NOT :$<BOOL :${Boost_USE_STATIC_LIBS} >>:Boost::dynamic_linking>
87117 Boost::filesystem
88- ${FREETYPE_LIBRARIES} yaml-cpp spdlog::spdlog
118+ ${FREETYPE_LIBRARIES} yaml-cpp spdlog::spdlog flatbuffers
89119)
90120
91121set_target_properties (${PROJECT_NAME} PROPERTIES
0 commit comments