File tree 8 files changed +52
-30
lines changed
8 files changed +52
-30
lines changed Original file line number Diff line number Diff line change 2
2
set (BUILDCC_INSTALL_LIB_PREFIX "lib/cmake" )
3
3
set (BUILDCC_INSTALL_HEADER_PREFIX "include/buildcc" )
4
4
5
+ # Flatbuffers schema
6
+ add_subdirectory (schema)
7
+
5
8
if (${BUILDCC_BUILD_AS_SINGLE_LIB} )
6
9
add_library (buildcc STATIC
7
10
buildcc.h
Original file line number Diff line number Diff line change @@ -6,9 +6,6 @@ if (${TESTING})
6
6
add_subdirectory (test /target )
7
7
endif ()
8
8
9
- # Target flatc generator
10
- include (cmake/fbs_gen.cmake)
11
-
12
9
# Target lib
13
10
include (cmake/target .cmake)
14
11
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
18
18
target_include_directories (mock_target PUBLIC
19
19
${CMAKE_CURRENT_SOURCE_DIR} /include
20
20
${CMAKE_CURRENT_SOURCE_DIR} /mock
21
- ${CMAKE_CURRENT_BINARY_DIR} / generated
21
+ ${SCHEMA_BUILD_DIR}
22
22
)
23
23
24
24
target_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})
32
32
$<INSTALL_INTERFACE:${BUILDCC_INSTALL_HEADER_PREFIX} >
33
33
)
34
34
target_include_directories (buildcc PRIVATE
35
- ${CMAKE_CURRENT_BINARY_DIR} / generated
35
+ ${SCHEMA_BUILD_DIR}
36
36
)
37
37
add_dependencies (buildcc fbs_to_header)
38
38
endif ()
@@ -57,7 +57,7 @@ if(${BUILDCC_BUILD_AS_INTERFACE})
57
57
)
58
58
59
59
target_include_directories (target PRIVATE
60
- ${CMAKE_CURRENT_BINARY_DIR} / generated
60
+ ${SCHEMA_BUILD_DIR}
61
61
)
62
62
target_compile_options (target PRIVATE ${BUILD_COMPILE_FLAGS} )
63
63
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 12
12
// See the License for the specific language governing permissions and
13
13
// limitations under the License.
14
14
15
- namespace schema.internal ;
15
+ include "path.fbs" ;
16
16
17
- table Path {
18
- pathname:string (key);
19
- last_write_timestamp:uint64;
20
- }
17
+ namespace schema.internal;
21
18
22
19
enum TargetType : byte {
23
20
Executable,
You can’t perform that action at this time.
0 commit comments