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

#394 Build for 64bit Android #395

Merged
merged 3 commits into from
Feb 15, 2016
Merged
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
2 changes: 2 additions & 0 deletions NuGet/NuGet.Library/Realm.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
<file src="../../Realm.XamarinAndroid/bin/Release/Realm.dll" target="lib\MonoAndroid44" />
<file src="../../wrappers/build/Release-android/armeabi/libwrappers.so" target="lib\MonoAndroid44\armeabi" />
<file src="../../wrappers/build/Release-android/armeabi-v7a/libwrappers.so" target="lib\MonoAndroid44\armeabi-v7a" />
<file src="../../wrappers/build/Release-android/arm64-v8a/libwrappers.so" target="lib\MonoAndroid44\arm64-v8a" />
<file src="../../wrappers/build/Release-android/x86/libwrappers.so" target="lib\MonoAndroid44\x86" />
<file src="../../wrappers/build/Release-android/x86_64/libwrappers.so" target="lib\MonoAndroid44\x86_64" />
</files>
</package>
24 changes: 18 additions & 6 deletions NuGet/NuGet.Library/Realm.targets
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<AndroidNativeLibrary Include="../packages/Realm.0.72.0/lib/MonoAndroid44/armeabi/libwrappers.so">
<Link>../packages/Realm.0.72.0/lib/MonoAndroid44/armeabi/libwrappers.so</Link>
<AndroidNativeLibrary Include="../packages/Realm.0.72.1/lib/MonoAndroid44/armeabi/libwrappers.so">
<Link>../packages/Realm.0.72.1/lib/MonoAndroid44/armeabi/libwrappers.so</Link>
</AndroidNativeLibrary>
<AndroidNativeLibrary Include="../packages/Realm.0.72.0/lib/MonoAndroid44/armeabi-v7a/libwrappers.so">
<Link>../packages/Realm.0.72.0/lib/MonoAndroid44/armeabi-v7a/libwrappers.so</Link>
<AndroidNativeLibrary Include="../packages/Realm.0.72.1/lib/MonoAndroid44/armeabi-v7a/libwrappers.so">
<Link>../packages/Realm.0.72.1/lib/MonoAndroid44/armeabi-v7a/libwrappers.so</Link>
</AndroidNativeLibrary>
<AndroidNativeLibrary Include="../packages/Realm.0.72.0/lib/MonoAndroid44/x86/libwrappers.so">
<Link>../packages/Realm.0.72.0/lib/MonoAndroid44/x86/libwrappers.so</Link>
<AndroidNativeLibrary Include="../packages/Realm.0.72.1/lib/MonoAndroid44/x86/libwrappers.so">
<Link>../packages/Realm.0.72.1/lib/MonoAndroid44/x86/libwrappers.so</Link>
</AndroidNativeLibrary>
<!-- disabled until clarify need and Xamarin support
<AndroidNativeLibrary Include="../packages/Realm.0.72.1/lib/MonoAndroid44/mips/libwrappers.so">
<Link>../packages/Realm.0.72.1/lib/MonoAndroid44/mips/libwrappers.so</Link>
</AndroidNativeLibrary>
-->
<!-- 64bit -->
<AndroidNativeLibrary Include="../packages/Realm.0.72.1/lib/MonoAndroid44/arm64-v8a/libwrappers.so">
<Link>../packages/Realm.0.72.1/lib/MonoAndroid44/arm64-v8a/libwrappers.so</Link>
</AndroidNativeLibrary>
<AndroidNativeLibrary Include="../packages/Realm.0.72.1/lib/MonoAndroid44/x86_64/libwrappers.so">
<Link>../packages/Realm.0.72.1/lib/MonoAndroid44/x86_64/libwrappers.so</Link>
</AndroidNativeLibrary>
</ItemGroup>
</Project>
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,29 @@ We support the current Xamarin _Stable_ and _Beta_ update channels, at the time
* Xamarin Android version 6.0.0.34
* Xamarin Studio version 5.10

Building Realm dotnet is not yet automated.

### Building Realm Steps

**Note for Debugging** that the following steps mention building for **Release.** If you are debugging, just substitute **Debug** and you probably also want to choose **Debug | iPhoneSimulator** as a platform.

1. Open a terminal window in the `wrappers` directory
1. `make clean`
1. `make all` - this will probably download a current version of core binaries, unless you have built recently. The download and subsequent builds will take some time, depending on your system, as it builds a binary wrapper library for each platform including all Android CPU variations.
1. Open the `Realm.sln` in `Xamarin Studio` on OS X
1. Choose the Solution `Realm` in the Solution navigator and context menu to `Clean Realm`
1. platform popup **Release | Default**
1. select `Realm.PCL` project and Build
1. select `RealmWeaver.Fody` project and Build
1. select platform popup **Release | ARM**
1. select `Realm.XamarinAndroid` project and Build
1. ensure you have an iOS device attached
1. select platform popup **Release | iPhone**
1. select `Realm.XamarinIOS` project and Build

1. If you want to build the NuGet packages, go on from this point and follow the steps in `internals/RealmDotnetNugetBuild.md`

If you are actively testing code against the Realm source, see also the unit test projects and other tests under the Tests folder.

## Contributing

Expand Down
4 changes: 3 additions & 1 deletion Realm.XamarinAndroid/Realm.XamarinAndroid.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<AndroidResgenFile>Resources\Resource.Designer.cs</AndroidResgenFile>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk>
<TargetFrameworkVersion>v4.4</TargetFrameworkVersion>
<TargetFrameworkVersion>v6.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|ARM' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -24,6 +24,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RunCodeAnalysis>false</RunCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|ARM' ">
<Optimize>true</Optimize>
Expand All @@ -32,6 +33,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RunCodeAnalysis>false</RunCodeAnalysis>
</PropertyGroup>
<ItemGroup>
<Reference Include="Mono.Android" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<AndroidApplication>True</AndroidApplication>
<AndroidUseLatestPlatformSdk>False</AndroidUseLatestPlatformSdk>
<AssemblyName>IntegrationTests.XamarinAndroid</AssemblyName>
<TargetFrameworkVersion>v4.4</TargetFrameworkVersion>
<TargetFrameworkVersion>v5.1</TargetFrameworkVersion>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
Expand All @@ -27,6 +27,7 @@
<WarningLevel>4</WarningLevel>
<AndroidLinkMode>None</AndroidLinkMode>
<ConsolePause>false</ConsolePause>
<RunCodeAnalysis>false</RunCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
Expand All @@ -36,6 +37,7 @@
<WarningLevel>4</WarningLevel>
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
<ConsolePause>false</ConsolePause>
<RunCodeAnalysis>false</RunCodeAnalysis>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="IntegrationTests.XamarinAndroid">
<uses-sdk />
<uses-sdk android:minSdkVersion="10" />
<application android:label="IntegrationTests.XamarinAndroid" android:icon="@drawable/icon"></application>
</manifest>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions internals/Realm-dotnet Code Change Diary - Andy Dent.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1583,3 +1583,29 @@ Realm.nuspec

RealmWeaverFody.nuspec
- set version number as 0.72.0


-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#394 BUILD FOR ARM64, x86_64 with some Android cleanup

wrappers/Makefile
- incremented NDK command min API from 9 to 10 to match Xamarin

Realm.targets
- set version number in paths as 0.72.1
- added arm64-v8a and x86_64 lib build instructions and dependencies

Realm.nuspec
- added arm64-v8a and x86_64 <file> elements
(skipping mips for now until clarify if shipping)

wrappers/jni/Application.mk
- added x86_64 arm64-v8a to APP_ABI
(so they are built into the libs dir)

IntegrationTests.XamarinAndroid
- Project Options - Build - General
set Target Framework to API 22
- Project Options - Build - Android Application
set Minimum Android Version to 2.3 (API 10)

12 changes: 1 addition & 11 deletions internals/RealmDotnetNugetBuild.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,7 @@ Paths below assume you're starting in the root dir `realm-dotnet` checked out fr
Building the DLLS
-----------------

* go into the Wrappers dir in terminal
* `make clean`
* `make all`
* In Xamarin Studio, open`Realm.sln`
* select platform popup **Release | ARM**
* select Realm.XamarinAndroid project and Rebuild
* ensure you have an iOS device attached
* select platform popup **Release | iPhone**
* select Realm.XamarinIOS project and Rebuild
* platform popup **Release | AnyCPU**
* select Realm.PCL project and Rebuild
Follow the _Building Realm Steps_ section in `README.md` if you haven't built them already.

Once you have your DLLS, follow these next steps to set version numbers and build NuGet.

Expand Down
28 changes: 26 additions & 2 deletions wrappers/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ build/Debug-ios-universal/libwrappers.a: build/Debug-iphoneos/libwrappers.a buil

# Android ====================

android: build/Release-android/armeabi/libwrappers.so build/Release-android/armeabi-v7a/libwrappers.so build/Release-android/x86/libwrappers.so
android: build/Release-android/armeabi/libwrappers.so build/Release-android/armeabi-v7a/libwrappers.so build/Release-android/x86/libwrappers.so build/Release-android/x86_64/libwrappers.so build/Release-android/arm64-v8a/libwrappers.so build/Release-android/mips/libwrappers.so

core-android: realm-core-android-$(CORE_ANDROID_VER).tar.gz
mkdir -p core-android
Expand All @@ -84,6 +84,12 @@ core-android: realm-core-android-$(CORE_ANDROID_VER).tar.gz
mv core-android/librealm-android-arm-v7a.a core-android/armeabi-v7a/librealm-android.a
mkdir -p core-android/x86
mv core-android/librealm-android-x86.a core-android/x86/librealm-android.a
mkdir -p core-android/arm64-v8a
mv core-android/librealm-android-arm64.a core-android/arm64-v8a/librealm-android.a
mkdir -p core-android/x86_64
mv core-android/librealm-android-x86_64.a core-android/x86_64/librealm-android.a
mkdir -p core-android/mips
mv core-android/librealm-android-mips.a core-android/mips/librealm-android.a
touch core-android

realm-core-android-$(CORE_ANDROID_VER).tar.gz:
Expand All @@ -107,8 +113,26 @@ build/Release-android/x86:
build/Release-android/x86/libwrappers.so: | build/Release-android/x86 libs
cp ./libs/x86/librealm-android.so ./build/Release-android/x86/libwrappers.so

build/Release-android/x86_64:
mkdir -p build/Release-android/x86_64

build/Release-android/x86_64/libwrappers.so: | build/Release-android/x86_64 libs
cp ./libs/x86_64/librealm-android.so ./build/Release-android/x86_64/libwrappers.so

build/Release-android/arm64-v8a:
mkdir -p build/Release-android/arm64-v8a

build/Release-android/arm64-v8a/libwrappers.so: | build/Release-android/arm64-v8a libs
cp ./libs/arm64-v8a/librealm-android.so ./build/Release-android/arm64-v8a/libwrappers.so

build/Release-android/mips:
mkdir -p build/Release-android/mips

build/Release-android/mips/libwrappers.so: | build/Release-android/mips libs
cp ./libs/mips/librealm-android.so ./build/Release-android/mips/libwrappers.so

libs: | core-android
$(NDK_ROOT)/ndk-build APP_PLATFORM=android-9 V=1
$(NDK_ROOT)/ndk-build APP_PLATFORM=android-10 V=1


.PHONY: android
Expand Down
2 changes: 1 addition & 1 deletion wrappers/jni/Application.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#NDK_TOOLCHAIN_VERSION := clang
NDK_TOOLCHAIN_VERSION := 4.9
APP_ABI := armeabi armeabi-v7a x86
APP_ABI := armeabi armeabi-v7a x86 x86_64 arm64-v8a

# Enable C++14
APP_CPPFLAGS += -std=c++14
Expand Down