Skip to content

Commit

Permalink
[RKOTLIN-877] Avoid exporting Core's symbols to allow mixing multiple…
Browse files Browse the repository at this point in the history
… SDKs (#1780)
  • Loading branch information
nhachicha authored Jul 6, 2024
1 parent 5e41c65 commit fb796f0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ jobs:
-DREALM_ENABLE_SYNC=1 \
-DREALM_NO_TESTS=1 \
-DREALM_BUILD_LIB_ONLY=true \
-DCMAKE_CXX_VISIBILITY_PRESET=hidden \
../../src/jvm
make -j8
Expand Down Expand Up @@ -213,6 +214,7 @@ jobs:
-DCMAKE_BUILD_TYPE=Release `
-DREALM_ENABLE_SYNC=ON `
-DREALM_NO_TESTS=1 `
-DCMAKE_CXX_VISIBILITY_PRESET=hidden `
-DVCPKG_TARGET_TRIPLET=x64-windows-static
cmake --build . --config Release
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- None.

### Enhancements
- Avoid exporting Core's symbols so we can statically build the Kotlin SDK with other SDKs like Swift in the same project. (Issue [JIRA](https://jira.mongodb.org/browse/RKOTLIN-877)).
- Improved mechanism for unpacking of JVM native libs suitable for local development. (Issue [#1715](https://github.com/realm/realm-kotlin/issues/1715) [JIRA](https://jira.mongodb.org/browse/RKOTLIN-1065)).

### Fixed
Expand Down
4 changes: 4 additions & 0 deletions packages/cinterop/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,10 @@ fun getSharedCMakeFlags(buildType: BuildType, ccache: Boolean = true): Array<Str
add("-DREALM_NO_TESTS=1")
add("-DREALM_BUILD_LIB_ONLY=true")
add("-DREALM_CORE_SUBMODULE_BUILD=true")
// This will prevent exporting Core's symbols which is useful when combining for example the Swift SDK and Kotlin Multiplatform
// in the same app. The generated dynamically linked shared Framework from Kotlin/Native can then be linked dynamically into the iOS app (!use_frameworks in Cocoapods)
// or statically. This will also reduce the binary size a little bit (avoid storing metadata about exported symbols)
add("-DCMAKE_CXX_VISIBILITY_PRESET=hidden")
}
return args.toTypedArray()
}
Expand Down

0 comments on commit fb796f0

Please sign in to comment.