Skip to content

Commit caba09f

Browse files
author
Cynthia Jiang
committed
test
1 parent a538ea3 commit caba09f

File tree

5 files changed

+50
-15
lines changed

5 files changed

+50
-15
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ option(FIREBASE_INCLUDE_INSTALLATIONS
5252
${FIREBASE_INCLUDE_LIBRARY_DEFAULT})
5353
option(FIREBASE_INCLUDE_FIRESTORE
5454
"Include the Firebase Firestore library."
55-
${FIREBASE_INCLUDE_LIBRARY_DEFAULT})
55+
OFF)
5656
option(FIREBASE_INCLUDE_FUNCTIONS
5757
"Include the Cloud Functions for Firebase library."
5858
${FIREBASE_INCLUDE_LIBRARY_DEFAULT})

auth/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ include(build_shared)
1919
# Firebase Auth Swig input files
2020
set(firebase_auth_swig
2121
src/swig/auth.i
22-
${FIREBASE_SOURCE_DIR}/empty.cc
2322
)
2423

2524
# Firebase Auth CSharp files

cmake/build_shared.cmake

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,19 @@ include(build_firebase_aar)
2525
# OUTPUT_NAME: The output name to use for the shared library
2626
function(build_firebase_shared LIBRARY_NAME ARTIFACT_NAME OUTPUT_NAME)
2727

28-
set(shared_target "firebase_${LIBRARY_NAME}_swig")
28+
set(shared_target "firebase_${LIBRARY_NAME}_shared")
2929

30-
# add_library(${shared_target} SHARED
31-
# ${FIREBASE_SOURCE_DIR}/empty.cc
32-
# )
30+
add_library(${shared_target} SHARED
31+
${FIREBASE_SOURCE_DIR}/empty.cc
32+
)
3333

3434
set(SHARED_TARGET_LINK_LIB_NAMES "firebase_${LIBRARY_NAME}" "firebase_${LIBRARY_NAME}_swig")
3535
message("SHARED_TARGET_LINK_LIB_NAMES is ${SHARED_TARGET_LINK_LIB_NAMES}")
3636

37+
target_link_libraries(${shared_target}
38+
${SHARED_TARGET_LINK_LIB_NAMES}
39+
)
40+
3741
# Update output name
3842
set_target_properties(${shared_target}
3943
PROPERTIES
@@ -66,16 +70,32 @@ function(build_firebase_shared LIBRARY_NAME ARTIFACT_NAME OUTPUT_NAME)
6670
)
6771
endif()
6872

69-
if(ANDROID)
73+
if (MSVC)
74+
target_link_options(${shared_target}
75+
PRIVATE
76+
"/WHOLEARCHIVE"
77+
)
78+
elseif (APPLE)
79+
target_link_options(${shared_target}
80+
PRIVATE
81+
"-Wl,-all_load"
82+
)
83+
elseif (ANDROID)
7084
target_link_options(${shared_target}
7185
PRIVATE
7286
"-llog"
7387
"-Wl,-z,defs"
7488
"-Wl,--no-undefined"
7589
# Link against the static libc++, which is the default done by Gradle.
7690
"-static-libstdc++"
91+
"-Wl,--whole-archive"
7792
)
78-
endif()
93+
else ()
94+
target_link_options(${shared_target}
95+
PRIVATE
96+
"-Wl,--whole-archive"
97+
)
98+
endif ()
7999

80100
unity_pack_native(${shared_target})
81101

cmake/build_universal.cmake

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,32 @@ function(build_uni TARGET_LINK_LIB_NAMES PROJECT_LIST_HEADER_VARIABLE)
7878
${FIREBASE_SYSTEM_DEPS}
7979
)
8080

81-
if(ANDROID)
81+
if (MSVC)
82+
target_link_options(firebase_app_uni
83+
PRIVATE
84+
"/WHOLEARCHIVE"
85+
)
86+
elseif (APPLE)
87+
target_link_options(firebase_app_uni
88+
PRIVATE
89+
"-Wl,-all_load"
90+
)
91+
elseif (ANDROID)
8292
target_link_options(firebase_app_uni
8393
PRIVATE
8494
"-llog"
8595
"-Wl,-z,defs"
8696
"-Wl,--no-undefined"
8797
# Link against the static libc++, which is the default done by Gradle.
8898
"-static-libstdc++"
99+
"-Wl,--whole-archive"
89100
)
90-
endif()
101+
else ()
102+
target_link_options(firebase_app_uni
103+
PRIVATE
104+
"-Wl,--whole-archive"
105+
)
106+
endif ()
91107

92108
unity_pack_native(firebase_app_uni)
93109

cmake/unity_pack.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,10 @@ function(unity_pack_native name)
232232

233233
get_target_property(target_type ${name} TYPE)
234234

235-
# if(NOT "${target_type}" STREQUAL "SHARED_LIBRARY")
236-
# message("unity_pack_native ${target_type} not equal SHARED_LIBRARY, returned")
237-
# return()
238-
# endif()
235+
if(NOT "${target_type}" STREQUAL "SHARED_LIBRARY")
236+
message("unity_pack_native ${target_type} not equal SHARED_LIBRARY, returned")
237+
return()
238+
endif()
239239

240240
set(dll_dest "${UNITY_PACK_NATIVE_DIR}/")
241241

@@ -258,7 +258,7 @@ function(unity_pack_native name)
258258
DESTINATION "${dll_dest}"
259259
COMPONENT "runtime"
260260
ARCHIVE
261-
DESTINATION "${dll_dest}"
261+
DESTINATION "${lib_dest}"
262262
COMPONENT "runtime"
263263
)
264264

0 commit comments

Comments
 (0)