Skip to content

Commit 56f8754

Browse files
committed
Include Flatbuffers as source when building for mobile
The mobile platforms do not include the dependencies as part of the package step, so what the previous build system did was just include flatbuffers source files directly in app, which will be duplicated here.
1 parent f5995b4 commit 56f8754

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

app/CMakeLists.txt

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,15 @@ else()
298298
"${app_desktop_HDRS}")
299299
endif()
300300

301+
if(ANDROID OR IOS)
302+
# If building for Android or iOS, include the Flatbuffers source files directly.
303+
set(app_flatbuffers_srcs ${FlatBuffers_Library_SRCS})
304+
set(app_flatbuffers_lib)
305+
else()
306+
set(app_flatbuffers_srcs)
307+
set(app_flatbuffers_lib flatbuffers)
308+
endif()
309+
301310
add_library(firebase_app STATIC
302311
${log_SRCS}
303312
${log_HDRS}
@@ -311,7 +320,8 @@ add_library(firebase_app STATIC
311320
memory/atomic.h
312321
meta/move.h
313322
memory/unique_ptr.h
314-
memory/shared_ptr.h)
323+
memory/shared_ptr.h
324+
${app_flatbuffers_srcs})
315325

316326
set_property(TARGET firebase_app PROPERTY FOLDER "Firebase Cpp")
317327

@@ -339,7 +349,7 @@ target_compile_definitions(firebase_app
339349
# firebase_app has a dependency on flatbuffers, which needs to be included.
340350
target_link_libraries(firebase_app
341351
PRIVATE
342-
flatbuffers
352+
${app_flatbuffers_lib}
343353
${LIBSECRET_LIBRARIES}
344354
)
345355
# Automatically include headers that might not be declared.
@@ -533,4 +543,4 @@ if (IOS)
533543
# to destination dir "Headers/google_play_services/*"
534544
set_property(SOURCE "src/include/google_play_services/availability.h" PROPERTY
535545
MACOSX_PACKAGE_LOCATION Headers/google_play_services)
536-
endif()
546+
endif()

0 commit comments

Comments
 (0)