Skip to content

Commit 3172c04

Browse files
committed
Fix Bazel build for --preserve-case
1 parent 95053e6 commit 3172c04

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+16610
-227
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ tests/monsterdata_javascript_wire.mon
7575
tests/monsterdata_lobster_wire.mon
7676
tests/monsterdata_rust_wire.mon
7777
tests/php/
78+
tests/ts/preserve_case/
79+
tests/java_preserve_case_*/
7880
CMakeLists.txt.user
7981
CMakeScripts/**
8082
CTestTestfile.cmake
@@ -156,4 +158,3 @@ kotlin/**/generated
156158
MODULE.bazel.lock
157159

158160
# Ignore the generated docs
159-
docs/site

BUILD.bazel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,16 @@ filegroup(
7171
"include/flatbuffers/detached_buffer.h",
7272
"include/flatbuffers/file_manager.h",
7373
"include/flatbuffers/flatbuffer_builder.h",
74+
"include/flatbuffers/flatc.h",
7475
"include/flatbuffers/flatbuffers.h",
7576
"include/flatbuffers/flex_flat_util.h",
7677
"include/flatbuffers/flexbuffers.h",
7778
"include/flatbuffers/grpc.h",
7879
"include/flatbuffers/hash.h",
7980
"include/flatbuffers/idl.h",
81+
"include/flatbuffers/idlnames.h",
8082
"include/flatbuffers/minireflect.h",
83+
"include/flatbuffers/options.h",
8184
"include/flatbuffers/reflection.h",
8285
"include/flatbuffers/reflection_generated.h",
8386
"include/flatbuffers/registry.h",

CMakeLists.txt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ endif()
112112
add_definitions(-DFLATBUFFERS_LOCALE_INDEPENDENT=$<BOOL:${FLATBUFFERS_LOCALE_INDEPENDENT}>)
113113

114114
if(NOT WIN32)
115-
include(CheckSymbolExists)
116115
check_symbol_exists(realpath "stdlib.h" HAVE_REALPATH)
117116
if(NOT HAVE_REALPATH)
118117
add_definitions(-DFLATBUFFERS_NO_ABSOLUTE_PATH_RESOLUTION)
@@ -136,6 +135,7 @@ set(FlatBuffers_Library_SRCS
136135
include/flatbuffers/hash.h
137136
include/flatbuffers/idl.h
138137
include/flatbuffers/minireflect.h
138+
include/flatbuffers/options.h
139139
include/flatbuffers/reflection.h
140140
include/flatbuffers/reflection_generated.h
141141
include/flatbuffers/registry.h
@@ -151,6 +151,7 @@ set(FlatBuffers_Library_SRCS
151151
src/idl_gen_text.cpp
152152
src/reflection.cpp
153153
src/util.cpp
154+
src/options.cpp
154155
)
155156

156157
set(FlatBuffers_Compiler_SRCS
@@ -449,26 +450,35 @@ if(FLATBUFFERS_BUILD_FLATLIB)
449450
endif()
450451
endif()
451452

453+
option(ENABLE_DEBUG_SYMBOLS "Enable debug symbols for flatc" OFF)
454+
452455
if(FLATBUFFERS_BUILD_FLATC)
453456
add_executable(flatc ${FlatBuffers_Compiler_SRCS})
457+
454458
if(FLATBUFFERS_ENABLE_PCH)
455459
add_pch_to_target(flatc include/flatbuffers/pch/flatc_pch.h)
456460
endif()
457461

458462
target_link_libraries(flatc PRIVATE $<BUILD_INTERFACE:ProjectConfig>)
463+
459464
target_compile_options(flatc
460465
PRIVATE
461466
$<$<AND:$<BOOL:${MSVC_LIKE}>,$<CONFIG:Release>>:
462467
/MT
463468
>
469+
$<$<BOOL:${ENABLE_DEBUG_SYMBOLS}>:
470+
-g -O0
471+
>
464472
)
465473

466474
if(FLATBUFFERS_CODE_SANITIZE AND NOT WIN32)
467475
add_fsanitize_to_target(flatc ${FLATBUFFERS_CODE_SANITIZE})
468476
endif()
477+
469478
if(NOT FLATBUFFERS_FLATC_EXECUTABLE)
470479
set(FLATBUFFERS_FLATC_EXECUTABLE $<TARGET_FILE:flatc>)
471480
endif()
481+
472482
if(FLATBUFFERS_STATIC_FLATC AND NOT MSVC)
473483
target_link_libraries(flatc PRIVATE -static)
474484
endif()

dart/test_preserve_case/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*_generated.dart
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Test for #7355
2+
table Foo {
3+
my_foo : foo_properties;
4+
}
5+
6+
struct foo_properties
7+
{
8+
a : bool;
9+
b : bool;
10+
}

dart/test_preserve_case/enums.fbs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
enum OptionsEnum : uint32
2+
{
3+
A = 1,
4+
B = 2,
5+
C = 3
6+
}
7+
8+
table MyTable {
9+
options : [OptionsEnum];
10+
}

0 commit comments

Comments
 (0)