Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion cmake/build_shared.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,25 @@ function(build_firebase_shared LIBRARY_NAME ARTIFACT_NAME OUTPUT_NAME)
"lib${OUTPUT_NAME}.so"
COMMENT "Strip debug symbols done on final binary. lib${OUTPUT_NAME}.so")
endif()


# Strip the debug symbols from the Mac build to reduce sizes
if(APPLE AND NOT FIREBASE_IOS_BUILD AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
target_link_options(${shared_target} PRIVATE "-Wl,-dead_strip")

add_custom_command(TARGET ${shared_target} POST_BUILD
COMMAND "${CMAKE_STRIP}" -x "$<TARGET_FILE:${shared_target}>"
COMMENT "Stripping symbols from Mac bundle"
)
endif()

# Strip the debug symbols from the Linux build to reduce size
if(UNIX AND NOT APPLE AND NOT ANDROID AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
add_custom_command(TARGET ${shared_target} POST_BUILD
COMMAND "${CMAKE_STRIP}" --strip-unneeded "$<TARGET_FILE:${shared_target}>"
COMMENT "Stripping symbols from Linux shared object"
)
endif()

unity_pack_native(${shared_target})

if(ANDROID)
Expand Down
18 changes: 18 additions & 0 deletions cmake/build_universal.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,24 @@ function(build_uni TARGET_LINK_LIB_NAMES PROJECT_LIST_HEADER_VARIABLE)
COMMENT "Strip debug symbols done on final binary. lib${FIREBASE_APP_UNI_VERSIONED}.so")
endif()

# Strip the debug symbols from the Mac build to reduce size
if(APPLE AND NOT FIREBASE_IOS_BUILD AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
target_link_options(firebase_app_uni PRIVATE "-Wl,-dead_strip")

add_custom_command(TARGET firebase_app_uni POST_BUILD
COMMAND "${CMAKE_STRIP}" -x "$<TARGET_FILE:firebase_app_uni>"
COMMENT "Stripping symbols from Mac bundle"
)
endif()

# Strip the debug symbols from the Linux build to reduce size
if(UNIX AND NOT APPLE AND NOT ANDROID AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
add_custom_command(TARGET firebase_app_uni POST_BUILD
COMMAND "${CMAKE_STRIP}" --strip-unneeded "$<TARGET_FILE:firebase_app_uni>"
COMMENT "Stripping symbols from Linux shared object"
)
endif()

unity_pack_native(firebase_app_uni)

set_property(TARGET firebase_app_uni
Expand Down
1 change: 1 addition & 0 deletions docs/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ Release Notes
-------------
### Upcoming
- Changes
- General: Strip debug symbols from Mac and Linux libraries, to reduce library size.
- General (iOS): Improve initialization to address intermittent crashes on iOS 26.
([#1436](https://github.com/firebase/firebase-unity-sdk/issues/1436)).
- Firebase AI: Add support for Grounding with Google Maps.
Expand Down
Loading