Skip to content

Commit aa2ee69

Browse files
authored
Merge pull request #169 from firebase/version_workflow
Fixing iOS packing issues
2 parents 2013803 + f8cc85f commit aa2ee69

File tree

22 files changed

+138
-45
lines changed

22 files changed

+138
-45
lines changed

.github/workflows/android.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ jobs:
8787
run: |
8888
echo "UNITY_ROOT_DIR=$( python scripts/gha/print_matrix_configuration.py -u ${{ github.event.inputs.unity_version }} -k unity_path )" >> $GITHUB_ENV
8989
90+
- name: Display Swig Version
91+
shell: bash
92+
run: |
93+
swig -version
94+
9095
- name: Build SDK (Android)
9196
shell: bash
9297
run: |

.github/workflows/ios.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ jobs:
7676
run: |
7777
echo "UNITY_ROOT_DIR=$( python scripts/gha/print_matrix_configuration.py -u ${{ github.event.inputs.unity_version }} -k unity_path )" >> $GITHUB_ENV
7878
79+
- name: Display Swig Version
80+
shell: bash
81+
run: |
82+
swig -version
83+
7984
- name: Build SDK (iOS)
8085
shell: bash
8186
run: |

.github/workflows/sdk_build.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,11 @@ jobs:
125125
echo "$(swig -swiglib)" >> $GITHUB_PATH
126126
swig -swiglib
127127
echo "SWIG_DIR=$(swig -swiglib)" >> $GITHUB_ENV
128+
129+
- name: Display Swig Version
130+
shell: bash
131+
run: |
132+
swig -version
128133
129134
- name: Build SDK (Linux)
130135
if: startsWith(matrix.os, 'ubuntu')

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ option(FIREBASE_INCLUDE_AUTH
4040
${FIREBASE_INCLUDE_LIBRARY_DEFAULT})
4141
option(FIREBASE_INCLUDE_CRASHLYTICS
4242
"Include the Firebase Crashlytics library."
43-
${FIREBASE_INCLUDE_LIBRARY_DEFAULT})
43+
OFF)
4444
option(FIREBASE_INCLUDE_DATABASE
4545
"Include the Firebase Realtime Database library."
4646
${FIREBASE_INCLUDE_LIBRARY_DEFAULT})
@@ -304,7 +304,7 @@ endif()
304304

305305
if(FIREBASE_UNI_LIBRARY)
306306
if(FIREBASE_IOS_BUILD)
307-
ios_pack(firebase_lib_uni libFirebaseCppApp DEPS ${TARGET_LINK_LIB_NAMES})
307+
ios_pack(firebase_lib_uni libFirebaseCppApp DEPS "firebase_app" "firebase_app_swig" "flatbuffers")
308308
else()
309309
build_uni(
310310
"${TARGET_LINK_LIB_NAMES}"

analytics/CMakeLists.txt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,16 @@ mono_add_library(firebase_analytics_cs
5050
firebase_analytics_swig
5151
)
5252

53-
build_firebase_shared(
54-
analytics
55-
analytics
56-
FirebaseCppAnalytics
57-
)
53+
if(FIREBASE_IOS_BUILD)
54+
ios_pack(firebase_lib_analytics libFirebaseCppAnalytics DEPS firebase_analytics firebase_analytics_swig)
55+
else()
56+
build_firebase_shared(
57+
analytics
58+
analytics
59+
FirebaseCppAnalytics
60+
)
61+
endif()
5862

59-
unity_pack_native(firebase_analytics_swig)
6063
unity_pack_cs(firebase_analytics_cs)
6164

6265
if (FIREBASE_INCLUDE_UNITY)

app/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ mono_add_library(firebase_app_cs
9999
${firebase_native_library}
100100
)
101101

102-
unity_pack_native(firebase_app_swig)
103102
unity_pack_cs(firebase_app_cs)
104103

105104
if (FIREBASE_INCLUDE_UNITY)

app/src/swig/future.i

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,11 @@ namespace firebase {
158158
null, System.IntPtr.Zero);
159159
}
160160
System.GC.SuppressFinalize(this);
161+
#if SWIG_VERSION >= 0x040000
162+
base.Dispose(disposing);
163+
#else
161164
base.Dispose();
165+
#endif
162166
}
163167
}
164168

app/src/swig/serial_dispose.i

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@
3737
null, global::System.IntPtr.Zero);
3838
}
3939
global::System.GC.SuppressFinalize(this);
40+
#if SWIG_VERSION >= 0x040000
41+
base.Dispose(disposing);
42+
#else
4043
base.Dispose();
44+
#endif
4145
}
4246
}

auth/CMakeLists.txt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,16 @@ mono_add_library(firebase_auth_cs
6464
firebase_auth_swig
6565
)
6666

67-
build_firebase_shared(
68-
auth
69-
auth
70-
FirebaseCppAuth
71-
)
67+
if(FIREBASE_IOS_BUILD)
68+
ios_pack(firebase_lib_auth libFirebaseCppAuth DEPS firebase_auth firebase_auth_swig)
69+
else()
70+
build_firebase_shared(
71+
auth
72+
auth
73+
FirebaseCppAuth
74+
)
75+
endif()
7276

73-
unity_pack_native(firebase_auth_swig)
7477
unity_pack_cs(firebase_auth_cs)
7578

7679
if (FIREBASE_INCLUDE_UNITY)

cmake/build_shared.cmake

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,20 @@ include(build_firebase_aar)
2626
function(build_firebase_shared LIBRARY_NAME ARTIFACT_NAME OUTPUT_NAME)
2727

2828
set(shared_target "firebase_${LIBRARY_NAME}_shared")
29+
2930
add_library(${shared_target} SHARED
3031
${FIREBASE_SOURCE_DIR}/empty.cc
32+
$<TARGET_OBJECTS:firebase_${LIBRARY_NAME}>
33+
$<TARGET_OBJECTS:firebase_${LIBRARY_NAME}_swig>
3134
)
35+
36+
set(SHARED_TARGET_LINK_LIB_NAMES "firebase_${LIBRARY_NAME}" "firebase_${LIBRARY_NAME}_swig")
37+
3238
target_link_libraries(${shared_target}
33-
"firebase_${LIBRARY_NAME}_swig"
39+
${SHARED_TARGET_LINK_LIB_NAMES}
3440
)
3541

42+
# Update output name
3643
set_target_properties(${shared_target}
3744
PROPERTIES
3845
OUTPUT_NAME "${OUTPUT_NAME}"
@@ -52,12 +59,28 @@ function(build_firebase_shared LIBRARY_NAME ARTIFACT_NAME OUTPUT_NAME)
5259
PREFIX "lib"
5360
SUFFIX ".a"
5461
)
62+
elseif(ANDROID)
63+
set_target_properties(${shared_target}
64+
PROPERTIES
65+
PREFIX "lib"
66+
)
5567
else()
5668
set_target_properties(${shared_target}
5769
PROPERTIES
5870
PREFIX ""
5971
)
6072
endif()
73+
74+
if(ANDROID)
75+
target_link_options(${shared_target}
76+
PRIVATE
77+
"-llog"
78+
"-Wl,-z,defs"
79+
"-Wl,--no-undefined"
80+
# Link against the static libc++, which is the default done by Gradle.
81+
"-static-libstdc++"
82+
)
83+
endif()
6184

6285
unity_pack_native(${shared_target})
6386

0 commit comments

Comments
 (0)