Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for NDK21 #6460

Merged
merged 136 commits into from
Feb 24, 2020
Merged
Show file tree
Hide file tree
Changes from 135 commits
Commits
Show all changes
136 commits
Select commit Hold shift + click to select a range
1203872
Merge 383208feb5e7305b839e58811cc0a3c1ed66ea75 into next-major
realm-ci Mar 14, 2018
58ffc86
Merge fbeb212907173f0a23735aca66ccce36fa79c6a2 into next-major
realm-ci Mar 15, 2018
7f60f45
Merge 5497ac901bf8f7479b887230662243bb0249902e into next-major
realm-ci Mar 15, 2018
002b77a
Prepare for next major version
cmelchior Mar 15, 2018
81e1e4b
Merge 087417ecb8f29e718cb8bff7959d91bb4ead27b0 into next-major
realm-ci Mar 16, 2018
65bc651
Merge ad302da32269e12c18c0795e24fd0917d70d54fd into next-major
realm-ci Mar 16, 2018
fc7875e
Merge 5a9dd479a1a30ba7ca1ed6e7b2a79115e6a24e97 into next-major
realm-ci Mar 16, 2018
5ade758
Merge fbfdb41a6904de4363ee29a8ab9648e27a87cbb8 into next-major
realm-ci Mar 16, 2018
602a27d
Merge f243b8f9ee63ea2159142bb263cd12412dca819b into next-major
realm-ci Mar 16, 2018
9c9cf51
Merge ddbebcb97a9b86ed458dece0e75143c60421e272 into next-major
realm-ci Mar 16, 2018
5ef0646
Merge 76fdc092991635c1eb64cdb998c5e49d8559cb5a into next-major
realm-ci Mar 21, 2018
83472df
Merge 3ee7fa2284a57f790b9e9add52c27c56b8ce9b03 into next-major
realm-ci Mar 22, 2018
5b25676
Merge c124469621a1b88abdf71bf99885e52138c8a430 into next-major
realm-ci Apr 3, 2018
8a7ab2b
Merge abd2f9bd1715ff69ce854f0990f88cd655d93910 into next-major
realm-ci Apr 4, 2018
e86a46c
Merge b7b33ceb3e9e6782accd7f608e8956ea646903a0 into next-major
realm-ci Apr 4, 2018
6765c46
Merge 8d37b06f78e6a912ccebc482ecdfcf48db10da8d into next-major
realm-ci Apr 8, 2018
c7e2d62
Merge 6c6b625db98964bf17899b885ee5e3c14af1eaa5 into next-major
realm-ci Apr 9, 2018
b7caa69
Merge e305a58bdd2b3a3dd37186c44ac41ac2cc4ad710 into next-major
realm-ci Apr 9, 2018
e52b288
Merge branch 'next-major' into merge-9c0963-to-next-major
nhachicha Apr 9, 2018
c2142d8
Merge pull request #5886 from realm/merge-9c0963-to-next-major
nhachicha Apr 9, 2018
22246f6
Merge f755bbcf7c89223b9c999c40789100d9af648e12 into next-major
realm-ci Apr 12, 2018
c0c1792
Merge ad88afe897a9fe6ca6f00fb04586e78f06b1b539 into next-major
realm-ci Apr 17, 2018
475bba0
Query-based sync are now the default mode for Sync (#5893)
cmelchior Apr 17, 2018
68a95c5
Use query-based sync terminology in all docs.
cmelchior Apr 17, 2018
4744e22
Merge 816239686fa101b3d582b7f3bb390692dcd4eb51 into next-major
realm-ci Apr 25, 2018
4e3579e
Merge branch 'next-major' into merge-efb60f-to-next-major
cmelchior Apr 25, 2018
6e52157
Merge pull request #5920 from realm/merge-efb60f-to-next-major
cmelchior Apr 26, 2018
57ed208
Merge 7282c27bc51df77c7e0e9dc804871d426b6a36f1 into next-major
realm-ci Apr 26, 2018
de4e17f
Merge 3529e041e2252c449c6b5f7bf1d1b2ff04781c34 into next-major
realm-ci Apr 30, 2018
7dadcfe
Merge 3f14e8821c9e877584d751eb1eeea294176981ad into next-major
realm-ci May 16, 2018
8b64ba2
Merge 53191054abb6047c1a0bb542290ee325f4580200 into next-major
realm-ci May 24, 2018
7313724
Merge d68d56b857836988d8d52bb7f0358aab8b916216 into next-major
realm-ci May 24, 2018
fec0fbc
Merge branch 'next-major' into merge-c27467-to-next-major
cmelchior May 24, 2018
3e5a7dd
Merge pull request #5971 from realm/merge-c27467-to-next-major
cmelchior May 24, 2018
b6a78c6
Merge branch 'next-major' into merge-c357ac-to-next-major
cmelchior Jun 6, 2018
9fda114
Fix bad merge
cmelchior Jun 7, 2018
1eeabe9
Merge pull request #5996 from realm/merge-c357ac-to-next-major
cmelchior Jun 7, 2018
6bcb047
Merge 3aaf5db578083ffacf858bdb95075ddfd7fa3458 into next-major
realm-ci Jun 8, 2018
11f2a62
Merge 27145b9eb42785a9f3fa2a501bdc8113d1622b17 into next-major
realm-ci Jun 8, 2018
bc77d89
Merge b9ae87b947b2c0731f969b199b283aa9262f2bb5 into next-major
realm-ci Jun 11, 2018
39cf11c
Merge 21a020734803a2bb6a30ca0de8708073d1df6019 into next-major
realm-ci Jun 11, 2018
e177861
Merge 949f63fcc8b4f5dbf09ae1b0b44ce92a71bb131e into next-major
realm-ci Jun 12, 2018
2960093
Merge branch 'next-major' into merge-2e121c-to-next-major
nhachicha Jun 19, 2018
a7c20c0
Merge pull request #6031 from realm/merge-2e121c-to-next-major
nhachicha Jun 19, 2018
f680f42
Merge branch 'next-major' into merge-347a37-to-next-major
nhachicha Jun 19, 2018
36aa9de
Merge pull request #6033 from realm/merge-347a37-to-next-major
nhachicha Jun 19, 2018
2537f5d
Merge ced57ca97312b51a8a17b9529ba8758789595776 into next-major
realm-ci Jun 23, 2018
4594779
Merge 7e5f3e58fee63768f0ee2104f342b4bb803a25f1 into next-major
realm-ci Jun 23, 2018
1905bbf
Merge 0e1464114782f88165309bd0d73d13a8fde72ab7 into next-major
realm-ci Jun 25, 2018
08774d1
Merge 4c4afb36313791dda975868a2c1f31763fe325b5 into next-major
realm-ci Jun 27, 2018
982187b
Merge 7f365495dba883020ef13ddaa4da9d88da0c5681 into next-major
realm-ci Jul 17, 2018
16e0cd9
Merge 0a0128fb64421b64cf9d138fb3c9568a353a3802 into next-major
realm-ci Jul 17, 2018
82b012f
Merge 293e746a202adfcb09f076a2542f4f7e7045690c into next-major
realm-ci Jul 18, 2018
fff60ee
Merge b8219c69c9bf728004f513e58d7fbd7e3d097bc4 into next-major
realm-ci Jul 22, 2018
efef378
Merge branch 'next-major' into merge-4667aa-to-next-major
nhachicha Jul 23, 2018
9dacb15
Merge pull request #6077 from realm/merge-4667aa-to-next-major
nhachicha Jul 23, 2018
151c967
Merge branch 'next-major' into merge-878a17-to-next-major
nhachicha Jul 23, 2018
dac4db9
Merge pull request #6078 from realm/merge-878a17-to-next-major
nhachicha Jul 23, 2018
0ac795a
Merge e3ae16a29c4a52b09ac0b791631438d2d8550e51 into next-major
realm-ci Jul 31, 2018
85c6bf2
Merge b74128802f24a220e26f4ff13e74b17f748395fe into next-major
realm-ci Jul 31, 2018
42716a1
Merge 4bd323b4efc86871494fe34e99e641a97e7a20d1 into next-major
realm-ci Aug 3, 2018
c523c1b
Merge 6b0eb23256cae0b19d66da4bb8e70787ba980000 into next-major
realm-ci Aug 9, 2018
88aa205
Merge 7896b8c597c4da5389f0a131ea48a2cacd8d25a9 into next-major
realm-ci Aug 9, 2018
af413d3
Merge 01fee448b46e32fc39a47e13023cc49edfe6fd71 into next-major
realm-ci Aug 9, 2018
12d6cb1
Merge 047b2080b0288c16bf8bd5e681317d21ae8bada5 into next-major
realm-ci Aug 10, 2018
8ed134c
Merge 7d8569355a24bf79c84c2970f88a62c20261c3f5 into next-major
realm-ci Aug 14, 2018
d925d01
Merge 976c9b7fb777de519ad5782da76612bc7727304b into next-major
realm-ci Aug 22, 2018
cd4743c
Merge ddd8fb96ac677e6ba29a31ce3c274663d1e7524b into next-major
realm-ci Aug 24, 2018
011b2f4
Merge 48abf007be3754d5038e9a797b1e865130a426d5 into next-major
realm-ci Aug 24, 2018
cb59376
Merge afc79e568d3f710fcdf99d30bf67b33c8134f6c6 into next-major
realm-ci Aug 27, 2018
4965488
Merge 32ba016da14963d5015af192b324d482ff4c0caf into next-major
realm-ci Aug 30, 2018
b61a314
Merge 4f9365f2a958a0d65d8514899d18b34f1fe0aff3 into next-major
realm-ci Aug 30, 2018
9805964
Merge bf8776dd8bc978cfff499fc8eb4b0e80be78bbdc into next-major
realm-ci Aug 31, 2018
284ae1f
Merge fa326012564c0ed4010275dda4068d3b3301cc4a into next-major
realm-ci Aug 31, 2018
eeb8361
Merge 8fa02e479efa686b1ef31debd04c9c6cb5f52900 into next-major
realm-ci Aug 31, 2018
9a66bd1
Merge f2fbfc81329314121e7ff163fc3fa19e36a1b516 into next-major
realm-ci Aug 31, 2018
656cd4f
Merge branch 'next-major' into merge-c1bdae-to-next-major
cmelchior Nov 5, 2018
6b53376
Merge pull request #6283 from realm/merge-c1bdae-to-next-major
cmelchior Nov 5, 2018
6b50a39
Merge f282fcbaed4047be5e7e282e98c74d4a3ee60682 into next-major
realm-ci Nov 6, 2018
f72c87a
Merge dc14781a9d6cd263eedab724c01b584dc627c1eb into next-major
realm-ci Nov 6, 2018
7abcb28
Merge 479db183be3c9f7562de9be03232615cdc450c47 into next-major
realm-ci Nov 6, 2018
a96e58e
Merge branch 'next-major' into merge-97e0c8-to-next-major
cmelchior Nov 6, 2018
3ce40b0
Merge pull request #6287 from realm/merge-97e0c8-to-next-major
cmelchior Nov 6, 2018
f365389
Merge 6ac1cb44d230e760c3c3b6621a37f43c419465aa into next-major
realm-ci Nov 6, 2018
ad0d37a
Merge a08e788a10b845ea70b60b66bedc7c8cedca66d3 into next-major
realm-ci Nov 6, 2018
635e26a
Merge 314d9af4c8ea0a9fba55ad0eb6d870b5ec071f33 into next-major
realm-ci Nov 10, 2018
32eeee7
Merge 22e9550594c0a2469d0bc62c5e85ac24f2fae130 into next-major
realm-ci Jan 15, 2019
f93d0cc
Merge branch 'next-major' into merge-11d073-to-next-major
cmelchior Feb 18, 2019
722c509
Merge pull request #6402 from realm/merge-11d073-to-next-major
cmelchior Feb 18, 2019
ee9817f
Preliminary work for NDK18 support
cmelchior Mar 12, 2019
afafdfb
Fix C++ cast error
cmelchior May 14, 2019
44d338a
Merge branch 'master' into next-major
cmelchior May 15, 2019
5e4a3a3
Merge branch 'next-major' into cm/ndk18
cmelchior May 15, 2019
3d1865c
Build locally
cmelchior May 15, 2019
5863045
Use proper release
cmelchior May 16, 2019
bb8ac2a
Fix compiler error in OS
cmelchior May 16, 2019
5868d11
Download proper version of NDK for Jenkins
cmelchior May 16, 2019
fdb6490
Remove unused file
cmelchior May 16, 2019
a5e6ab5
Cleanup
cmelchior May 16, 2019
fac0a54
Add debug information
cmelchior May 16, 2019
5e9452a
More debug
cmelchior May 16, 2019
4b67be5
Unzip in current directory
cmelchior May 16, 2019
b6db5a3
I'm an idiot and Linux is case sensitive while MacOS is not.
cmelchior May 16, 2019
0627c4a
Set minSdkVersion to 16
cmelchior May 16, 2019
41c1e15
Fix tests
cmelchior May 16, 2019
44ff7c8
Cleanup and formatting
cmelchior May 16, 2019
79594f6
Optimize compiler/linker flags for size
cmelchior May 17, 2019
a91fcca
Attempt to optimize size
cmelchior May 19, 2019
911c164
More minimizations
cmelchior May 19, 2019
533e47d
Optimize flags for size
cmelchior May 21, 2019
ad7e36a
Merge remote-tracking branch 'origin/master' into cm/ndk18
nhachicha May 27, 2019
945094d
update debug/release flag
nhachicha May 30, 2019
f99bd56
Merge branch 'next-major' into cm/ndk18
cmelchior Feb 10, 2020
816be06
Use proper NDK on CI
cmelchior Feb 11, 2020
465780c
Attempt to fix warning on Linux
cmelchior Feb 11, 2020
a231114
Update OS branch
cmelchior Feb 13, 2020
b760983
Bump to latest OS
cmelchior Feb 13, 2020
f63f7ef
Update OS
cmelchior Feb 13, 2020
5273516
Update OS
cmelchior Feb 13, 2020
3a42f0b
Disable unevaluated-expression
cmelchior Feb 13, 2020
e09c855
Disable more checks
cmelchior Feb 18, 2020
d1832a0
Don't use JavaGlobalRef in lambda capture
cmelchior Feb 18, 2020
ef3862c
Reduce CMake version
cmelchior Feb 18, 2020
a017c05
Disable more checks
cmelchior Feb 18, 2020
206427f
Remove test
cmelchior Feb 18, 2020
522225c
Fix test
cmelchior Feb 18, 2020
465fe9b
Cleanup. Disable broken test. Fix JSON tests
cmelchior Feb 19, 2020
829f306
Disable correct test
cmelchior Feb 19, 2020
4225b3d
Temp disable all Progress listener tests f
cmelchior Feb 20, 2020
f156998
Add helper script for finding size of library
cmelchior Feb 20, 2020
6f05d27
Also print AAR size
cmelchior Feb 21, 2020
36da844
Add debug for failing tests
cmelchior Feb 21, 2020
a9a1402
Has notifications gotten slower?
cmelchior Feb 21, 2020
67be8ea
Merge mistake
cmelchior Feb 21, 2020
6c73e8a
Cleanup
cmelchior Feb 21, 2020
cacac37
PR feedback
cmelchior Feb 24, 2020
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ NOTE: This version bumps the Realm file format to version 10. It is not possible
### Internal
* `OsSharedRealm.VersionID.hashCode()` was not implemented correctly and included the memory location in the hashcode.
* OKHttp was upgraded to 3.10.0 from 3.9.0.
* The NDK has been upgraded from r10e to r21.
* The compiler used for C++ code has changed from GCC to Clang.
* OpenSSL used by Realms encryption layer has been upgraded from 1.0.2k to 1.1.1b.


## 6.1.0(2020-01-17)
Expand Down
10 changes: 4 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,11 @@ RUN yes | sdkmanager \
# Install the NDK
RUN mkdir /opt/android-ndk-tmp && \
cd /opt/android-ndk-tmp && \
wget -q http://dl.google.com/android/ndk/android-ndk-r10e-linux-x86_64.bin -O android-ndk.bin && \
chmod a+x ./android-ndk.bin && \
./android-ndk.bin && \
mv android-ndk-r10e /opt/android-ndk && \
wget -q https://dl.google.com/android/repository/android-ndk-r21-linux-x86_64.zip -O android-ndk.zip && \
unzip android-ndk.zip && \
mv android-ndk-r21 /opt/android-ndk && \
rm -rf /opt/android-ndk-tmp && \
chmod -R a+rX /opt/android-ndk && \
echo "Pkg.Desc = Android NDK\nPkg.Revision = 10.0.0" > /opt/android-ndk/source.properties
chmod -R a+rX /opt/android-ndk

# Make the SDK universally writable
RUN chmod -R a+rwX ${ANDROID_HOME}
24 changes: 8 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,32 +67,24 @@ In case you don't want to use the precompiled version, you can build Realm yours
### Prerequisites

* Download the [**JDK 8**](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) from Oracle and install it.
* The latest stable version of Android Studio. Currently [3.5.2](https://developer.android.com/studio/).
* The latest stable version of Android Studio. Currently [3.5.3](https://developer.android.com/studio/).
* Download & install the Android SDK **Build-Tools 27.0.2**, **Android Oreo (API 27)** (for example through Android Studio’s **Android SDK Manager**).
* Install CMake from SDK manager in Android Studio ("SDK Tools" -> "CMake").
* Install the NDK (currently r21) from the SDK Manager in Android Studio or using the [website](https://developer.android.com/ndk/downloads). If downloaded
You may unzip the file wherever you choose. For macOS, a suggested location is `~/Library`. The download will unzip as the directory `android-ndk-r21`.

* Realm currently requires version r10e of the NDK. Download the one appropriate for your development platform, from the NDK [archive](https://developer.android.com/ndk/downloads/older_releases.html).
You may unzip the file wherever you choose. For macOS, a suggested location is `~/Library/Android`. The download will unzip as the directory `android-ndk-r10e`.

* If you will be building with Android Studio, you will need to tell it to use the correct NDK. To do this, define the variable `ndk.dir` in `realm/local.properties` and assign it the full pathname of the directory that you unzipped above. Note that there is a `local.properites` in the root directory that is *not* the one that needs to be edited.

```
ndk.dir=/Users/brian/Library/Android/android-ndk-r10e
* If you will be building with Android Studio, you will need to tell it to use the correct NDK. If you installed it using the SDK Manager, it will automatically be detected. Otherwise, you need to define the variable `ndk.dir` in `realm/local.properties` and assign it the full pathname of the directory that you unzipped above. Note that there is a `local.properites` in the root directory that is *not* the one that needs to be edited.

```
ndk.dir=/Users/<username>/Library/android-sdk/ndk/21.0.6113669

* You also need a file called `source.properties` to the `android-ndk-r10e` folder with the following content:

```
Pkg.Desc = Android NDK
Pkg.Revision = 10.0.0
```

* Add two environment variables to your profile (presuming you installed the NDK in `~/Library/android-ndk-r10e`):
* Add two environment variables to your profile (presuming you installed the NDK using the SDK Manager):

```
export ANDROID_HOME=~/Library/Android/sdk
export ANDROID_NDK_HOME=~/Library/Android/android-ndk-r10e
export ANDROID_HOME=~/Library/android-sdk
export ANDROID_NDK_HOME=~/Library/android-sdk/ndk/21.0.6113669
```

* If you are launching Android Studio from the macOS Finder, you should also run the following two commands:
Expand Down
6 changes: 3 additions & 3 deletions dependencies.list
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Realm Sync release used by Realm Java (This includes Realm Core)
# https://github.com/realm/realm-sync/releases
REALM_SYNC_VERSION=5.0.0-beta.2
REALM_SYNC_SHA256=bbe58ad5110d66fe8c55a838486e09593e93ee96db8d07aa93a22abb52ead220
REALM_SYNC_VERSION=5.0.0
REALM_SYNC_SHA256=93825d20e47627eae314d0793380908a65d622c3cdddbc0ca30fce3bb39d21cd

# Object Server Release used by Integration tests. Installed using NPM.
# Use `npm view realm-object-server versions` to get a list of available versions.
Expand All @@ -14,6 +14,6 @@ ANDROID_BUILD_TOOLS=28.0.3
# Common classpath dependencies
# Gradle 5 is not supported yet: https://issuetracker.google.com/issues/126433059
gradleVersion=4.10.1
ndkVersion=r10e
ndkVersion=21.0.6113669
BUILD_INFO_EXTRACTOR_GRADLE=4.7.5
GRADLE_BINTRAY_PLUGIN=1.8.4
2 changes: 1 addition & 1 deletion examples/architectureComponentsExample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ android {
defaultConfig {
applicationId 'io.realm.examples.arch'
targetSdkVersion rootProject.sdkVersion
minSdkVersion 16
minSdkVersion rootProject.minSdkVersion
versionCode 1
versionName "1.0"

Expand Down
2 changes: 1 addition & 1 deletion examples/multiprocessExample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ android {
defaultConfig {
applicationId "io.realm.examples.realmmultiprocessexample"
targetSdkVersion rootProject.sdkVersion
minSdkVersion 16
minSdkVersion rootProject.minSdkVersion
versionCode 1
versionName "1.0"
}
Expand Down
12 changes: 3 additions & 9 deletions realm/realm-library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ ext.coreDir = file("${project.coreDistributionDir.getAbsolutePath()}/core-${proj
ext.ccachePath = project.findProperty('ccachePath') ?: System.getenv('NDK_CCACHE')
ext.lcachePath = project.findProperty('lcachePath') ?: System.getenv('NDK_LCACHE')
// Set to true to enable linking with debug core.
ext.enableDebugCore = project.hasProperty('enableDebugCore') ? project.getProperty('enableDebugCore') : false //FIXME Use 'false' as default until https://github.com/realm/realm-java/issues/5354 is fixed
ext.enableDebugCore = project.hasProperty('enableDebugCore') ? project.getProperty('enableDebugCore') : true

android {
compileSdkVersion rootProject.compileSdkVersion
Expand All @@ -50,20 +50,14 @@ android {
externalNativeBuild {
cmake {
arguments "-DREALM_CORE_DIST_DIR:STRING=${project.coreDir.getAbsolutePath()}",
// FIXME:
// This is copied from https://dl.google.com/android/repository/cmake-3.4.2909474-linux-x86_64.zip
// because of the android.toolchain.cmake shipped with Android SDK CMake 3.6 doesn't work with our
// JNI build currently (lack of lto linking support).
// This file should be removed and use the one from Android SDK cmake package when it supports lto.
"-DCMAKE_TOOLCHAIN_FILE=${project.file('src/main/cpp/android.toolchain.cmake').path}",
"-DENABLE_DEBUG_CORE=$project.enableDebugCore"
if (project.ccachePath) arguments "-DNDK_CCACHE=$project.ccachePath"
if (project.lcachePath) arguments "-DNDK_LCACHE=$project.lcachePath"
if (project.coreSourcePath) arguments "-DCORE_SOURCE_PATH=${project.coreSourcePath.getAbsolutePath()}"
if (project.hasProperty('buildTargetABIs') && !project.getProperty('buildTargetABIs').trim().isEmpty()) {
abiFilters(*project.getProperty('buildTargetABIs').trim().split('\\s*,\\s*'))
} else {
// armeabi is not supported anymore.
// "armeabi" and "mips" are no longer supported by the NDK
abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
}
}
Expand Down Expand Up @@ -799,7 +793,7 @@ def checkNdk(String ndkPath) {
}
if (detectedNdkVersion != project.ndkVersion) {
throw new GradleException("Your NDK version: ${detectedNdkVersion}."
+ " Realm JNI must be compiled with the version ${project.ndkVersion} of NDK.")
+ " Realm JNI must be compiled with version ${project.ndkVersion} of the NDK.")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1774,18 +1774,16 @@ public void asJSON() throws JSONException {
" \"columnDate\": \"" + now + "\",\n" +
" \"columnBinary\": \"AQID\",\n" +
" \"columnMutableRealmInteger\": 0,\n" +
" \"columnRealmObject\": [\n" +
" {\n" +
" \"_key\": 100,\n" +
" \"name\": \"dog1\",\n" +
" \"age\": 1,\n" +
" \"height\": 1.1,\n" +
" \"weight\": 10.100000381469727,\n" +
" \"hasTail\": true,\n" +
" \"birthday\": \"" + now + "\",\n" +
" \"owner\": null\n" +
" }\n" +
" ],\n" +
" \"columnRealmObject\": {\n" +
" \"_key\": 100,\n" +
" \"name\": \"dog1\",\n" +
" \"age\": 1,\n" +
" \"height\": 1.1,\n" +
" \"weight\": 10.100000381469727,\n" +
" \"hasTail\": true,\n" +
" \"birthday\": \"" + now + "\",\n" +
" \"owner\": null\n" +
" },\n" +
" \"columnRealmList\": [\n" +
" {\n" +
" \"_key\": 101,\n" +
Expand All @@ -1805,14 +1803,12 @@ public void asJSON() throws JSONException {
" \"weight\": 30.100000381469727,\n" +
" \"hasTail\": true,\n" +
" \"birthday\": \"" + now + "\",\n" +
" \"owner\": [\n" +
" {\n" +
" \"_key\": 0,\n" +
" \"name\": \"Dog owner 1\",\n" +
" \"dogs\": [],\n" +
" \"cat\": null\n" +
" }\n" +
" ]\n" +
" \"owner\": {\n" +
" \"_key\": 0,\n" +
" \"name\": \"Dog owner 1\",\n" +
" \"dogs\": [],\n" +
" \"cat\": null\n" +
" }\n" +
" }\n" +
" ],\n" +
" \"columnStringList\": [\n" +
Expand Down Expand Up @@ -1876,20 +1872,18 @@ public void asJSON_cycles() throws JSONException {
" \"id\": 0,\n" +
" \"name\": \"One\",\n" +
" \"date\": \"" + now + "\",\n" +
" \"object\": [\n" +
" {\n" +
" \"_key\": 1,\n" +
" \"id\": 0,\n" +
" \"name\": \"Two\",\n" +
" \"date\": \"" + now + "\",\n" +
" \"object\": {\n" +
" \"table\": \"class_CyclicType\",\n" +
" \"key\": 0\n" +
" },\n" +
" \"otherObject\": null,\n" +
" \"objects\": []\n" +
" }\n" +
" ],\n" +
" \"object\": {\n" +
" \"_key\": 1,\n" +
" \"id\": 0,\n" +
" \"name\": \"Two\",\n" +
" \"date\": \"" + now + "\",\n" +
" \"object\": {\n" +
" \"table\": \"class_CyclicType\",\n" +
" \"key\": 0\n" +
" },\n" +
" \"otherObject\": null,\n" +
" \"objects\": []\n" +
" },\n" +
" \"otherObject\": null,\n" +
" \"objects\": []\n" +
" },\n" +
Expand All @@ -1898,20 +1892,18 @@ public void asJSON_cycles() throws JSONException {
" \"id\": 0,\n" +
" \"name\": \"Two\",\n" +
" \"date\": \"" + now + "\",\n" +
" \"object\": [\n" +
" {\n" +
" \"_key\": 0,\n" +
" \"id\": 0,\n" +
" \"name\": \"One\",\n" +
" \"date\": \"" + now + "\",\n" +
" \"object\": {\n" +
" \"table\": \"class_CyclicType\",\n" +
" \"key\": 1\n" +
" },\n" +
" \"otherObject\": null,\n" +
" \"objects\": []\n" +
" }\n" +
" ],\n" +
" \"object\": {\n" +
" \"_key\": 0,\n" +
" \"id\": 0,\n" +
" \"name\": \"One\",\n" +
" \"date\": \"" + now + "\",\n" +
" \"object\": {\n" +
" \"table\": \"class_CyclicType\",\n" +
" \"key\": 1\n" +
" },\n" +
" \"otherObject\": null,\n" +
" \"objects\": []\n" +
" },\n" +
" \"otherObject\": null,\n" +
" \"objects\": []\n" +
" }\n" +
Expand Down
57 changes: 21 additions & 36 deletions realm/realm-library/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,47 +101,31 @@ create_javah(TARGET jni_headers
)

include(RealmCore)

use_realm_core(${build_SYNC} "${REALM_CORE_DIST_DIR}" "${CORE_SOURCE_PATH}")

# Download openssl lib
#string(TOLOWER "${CMAKE_BUILD_TYPE}" openssl_build_TYPE)
set(openssl_build_TYPE "release")
# Download OpenSSL lib
# FIXME Read the openssl version from core when the core/sync release has that information.
set(openssl_VERSION "1.0.2k")
set(openssl_BUILD_NUMBER "1")
set(openssl_FILENAME "openssl-${openssl_build_TYPE}-${openssl_VERSION}-${openssl_BUILD_NUMBER}-Android-${ANDROID_ABI}")
set(openssl_URL "http://static.realm.io/downloads/openssl/${openssl_VERSION}/Android/${ANDROID_ABI}/${openssl_FILENAME}.tar.gz")
set(openssl_VERSION "1.1.1b")
set(openssl_FILENAME "openssl.tgz")
set(openssl_URL "https://static.realm.io/downloads/openssl/${openssl_VERSION}/Android/${ANDROID_ABI}/${openssl_FILENAME}")

message(STATUS "Downloading OpenSSL...")
file(DOWNLOAD "${openssl_URL}" "${PROJECT_BINARY_DIR}/${openssl_FILENAME}.tar.gz")

message(STATUS "Uncompressing OpenSSL...")
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xfz "${PROJECT_BINARY_DIR}/${openssl_FILENAME}.tar.gz"
WORKING_DIRECTORY "${PROJECT_BINARY_DIR}")
file(DOWNLOAD "${openssl_URL}" "${PROJECT_BINARY_DIR}/${openssl_FILENAME}")

message(STATUS "Uncompressing OpenSSL: ${PROJECT_BINARY_DIR}/${openssl_FILENAME}")
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xfz "${openssl_FILENAME}" WORKING_DIRECTORY "${PROJECT_BINARY_DIR}")
message(STATUS "Importing OpenSSL...")
include(${PROJECT_BINARY_DIR}/${openssl_FILENAME}/openssl.cmake)
get_target_property(openssl_include_DIR crypto INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(crypto_LIB crypto IMPORTED_LOCATION)
get_target_property(ssl_LIB ssl IMPORTED_LOCATION)
include(${PROJECT_BINARY_DIR}/lib/cmake/OpenSSL/OpenSSLConfig.cmake)
get_target_property(openssl_include_DIR OpenSSL::Crypto INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(crypto_LIB OpenSSL::Crypto IMPORTED_LOCATION)
get_target_property(ssl_LIB OpenSSL::SSL IMPORTED_LOCATION)

# build application's shared lib
include_directories(
${CMAKE_SOURCE_DIR}
${jni_headers_PATH}
${CMAKE_SOURCE_DIR}/object-store/src)

set(ANDROID_STL "gnustl_static")
set(ANDROID_NO_UNDEFINED OFF)
set(ANDROID_SO_UNDEFINED ON)

if (ARMEABI)
set(ABI_CXX_FLAGS "-mthumb")
elseif (ARMEABI_V7A)
set(ABI_CXX_FLAGS "-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16")
endif()

# Hack the memmove bug on Samsung device.
if (ARMEABI OR ARMEABI_V7A)
set(REALM_LINKER_FLAGS "${REALM_LINKER_FLAGS} -Wl,--wrap,memmove -Wl,--wrap,memcpy")
Expand All @@ -157,19 +141,20 @@ endif()
# -Wno-missing-field-initializers disable in object store as well.
set(WARNING_CXX_FLAGS "-Werror -Wall -Wextra -pedantic -Wmissing-declarations \
-Wempty-body -Wparentheses -Wunknown-pragmas -Wunreachable-code \
-Wno-missing-field-initializers -Wno-maybe-uninitialized -Wno-uninitialized")
set(REALM_COMMON_CXX_FLAGS "${REALM_COMMON_CXX_FLAGS} -DREALM_ANDROID -DREALM_HAVE_CONFIG -DPIC -pthread -fvisibility=hidden -std=c++14 -fsigned-char")
-Wno-missing-field-initializers -Wno-unevaluated-expression -Wno-unreachable-code")
set(REALM_COMMON_CXX_FLAGS "${REALM_COMMON_CXX_FLAGS} -DREALM_ANDROID -DREALM_HAVE_CONFIG -DPIC -fdata-sections -pthread -frtti -fvisibility=hidden -fsigned-char -fno-stack-protector -std=c++14")
if (build_SYNC)
set(REALM_COMMON_CXX_FLAGS "${REALM_COMMON_CXX_FLAGS} -DREALM_ENABLE_SYNC=1")
endif()
# There might be an issue with -Os of ndk gcc 4.9. It will hang the encryption related tests.
# And this issue doesn't seem to impact the core compiling.
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
#-ggdb doesn't play well with -flto
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -Oz")
# -ggdb doesn't play well with -flto
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -ggdb -Og")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similarly, should we suppress optimisation for glldb as well?

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${REALM_COMMON_CXX_FLAGS} ${WARNING_CXX_FLAGS} ${ABI_CXX_FLAGS}")

# Set link flags
# Set Linker flags flags
if (CMAKE_BUILD_TYPE STREQUAL "Release")
set(REALM_LINKER_FLAGS "${REALM_LINKER_FLAGS} -Wl,-gc-sections")
endif()
if (build_SYNC)
set(REALM_LINKER_FLAGS "${REALM_LINKER_FLAGS} -lz")
endif()
Expand Down Expand Up @@ -215,9 +200,9 @@ add_library(realm-jni SHARED ${jni_SRC} ${objectstore_SRC} ${objectstore_sync_SR
add_dependencies(realm-jni jni_headers)

if (build_SYNC)
target_link_libraries(realm-jni log android lib_realm_sync crypto ssl)
target_link_libraries(realm-jni log android lib_realm_sync OpenSSL::SSL OpenSSL::Crypto)
else()
target_link_libraries(realm-jni log android lib_realm_core crypto)
target_link_libraries(realm-jni log android lib_realm_core OpenSSL::Crypto)
endif()

# Strip the release so files and backup the unstripped versions
Expand Down
Loading