File tree Expand file tree Collapse file tree 8 files changed +52
-30
lines changed
Expand file tree Collapse file tree 8 files changed +52
-30
lines changed Original file line number Diff line number Diff line change 22set (BUILDCC_INSTALL_LIB_PREFIX "lib/cmake" )
33set (BUILDCC_INSTALL_HEADER_PREFIX "include/buildcc" )
44
5+ # Flatbuffers schema
6+ add_subdirectory (schema)
7+
58if (${BUILDCC_BUILD_AS_SINGLE_LIB} )
69 add_library (buildcc STATIC
710 buildcc.h
Original file line number Diff line number Diff line change @@ -6,9 +6,6 @@ if (${TESTING})
66 add_subdirectory (test /target )
77endif ()
88
9- # Target flatc generator
10- include (cmake/fbs_gen.cmake)
11-
129# Target lib
1310include (cmake/target .cmake)
1411
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ add_library(mock_target STATIC
1818target_include_directories (mock_target PUBLIC
1919 ${CMAKE_CURRENT_SOURCE_DIR} /include
2020 ${CMAKE_CURRENT_SOURCE_DIR} /mock
21- ${CMAKE_CURRENT_BINARY_DIR} / generated
21+ ${SCHEMA_BUILD_DIR}
2222)
2323
2424target_compile_options (mock_target PUBLIC ${TEST_COMPILE_FLAGS} ${BUILD_COMPILE_FLAGS} )
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ if(${BUILDCC_BUILD_AS_SINGLE_LIB})
3232 $<INSTALL_INTERFACE:${BUILDCC_INSTALL_HEADER_PREFIX} >
3333 )
3434 target_include_directories (buildcc PRIVATE
35- ${CMAKE_CURRENT_BINARY_DIR} / generated
35+ ${SCHEMA_BUILD_DIR}
3636 )
3737 add_dependencies (buildcc fbs_to_header)
3838endif ()
@@ -57,7 +57,7 @@ if(${BUILDCC_BUILD_AS_INTERFACE})
5757 )
5858
5959 target_include_directories (target PRIVATE
60- ${CMAKE_CURRENT_BINARY_DIR} / generated
60+ ${SCHEMA_BUILD_DIR}
6161 )
6262 target_compile_options (target PRIVATE ${BUILD_COMPILE_FLAGS} )
6363 target_link_options (target PRIVATE ${BUILD_LINK_FLAGS} )
Original file line number Diff line number Diff line change 1+ # Generate files
2+ set (SCHEMA_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR} /generated CACHE PATH "Generate path of flatbuffer schema" )
3+
4+ set (FBS_FILES
5+ ${CMAKE_CURRENT_SOURCE_DIR} /path .fbs
6+ ${CMAKE_CURRENT_SOURCE_DIR} /target .fbs
7+ )
8+ set (FBS_GEN_FILES
9+ ${SCHEMA_BUILD_DIR} /path_generated.h
10+ ${SCHEMA_BUILD_DIR} /target_generated.h
11+ )
12+ set (FBS_GEN_OPTIONS
13+ -I ${CMAKE_CURRENT_SOURCE_DIR}
14+ --gen-object-api
15+ )
16+
17+ add_custom_command (OUTPUT ${FBS_GEN_FILES}
18+ COMMAND flatc -o ${SCHEMA_BUILD_DIR} ${FBS_GEN_OPTIONS} --cpp ${FBS_FILES}
19+ DEPENDS flatc ${FBS_FILES}
20+ )
21+
22+ add_custom_target (fbs_to_header
23+ DEPENDS ${FBS_GEN_FILES}
24+ )
Original file line number Diff line number Diff line change 1+ // Copyright 2021 Niket Naidu. All rights reserved.
2+ //
3+ // Licensed under the Apache License, Version 2.0 (the "License");
4+ // you may not use this file except in compliance with the License.
5+ // You may obtain a copy of the License at
6+ //
7+ // http://www.apache.org/licenses/LICENSE-2.0
8+ //
9+ // Unless required by applicable law or agreed to in writing, software
10+ // distributed under the License is distributed on an "AS IS" BASIS,
11+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ // See the License for the specific language governing permissions and
13+ // limitations under the License.
14+
15+ namespace schema.internal;
16+
17+ table Path {
18+ pathname:string (key);
19+ last_write_timestamp:uint64;
20+ }
Original file line number Diff line number Diff line change 1212// See the License for the specific language governing permissions and
1313// limitations under the License.
1414
15- namespace schema.internal ;
15+ include "path.fbs" ;
1616
17- table Path {
18- pathname:string (key);
19- last_write_timestamp:uint64;
20- }
17+ namespace schema.internal;
2118
2219enum TargetType : byte {
2320 Executable,
You can’t perform that action at this time.
0 commit comments