-
Notifications
You must be signed in to change notification settings - Fork 1
Android Build
- get android ndk (I used r25b) and sdk, gradle also needs to be installed
- clone
git clone https://github.com/Bauumm/SSVOpenHexagon.git --recursive
cd SSVOpenHexagon
git checkout android_test
git submodule update --recursive
- build
cd buildlx
cmake -DCMAKE_SYSTEM_NAME=Android -DCMAKE_ANDROID_NDK=path/to/ndk -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a -DCMAKE_ANDROID_STL_TYPE=c++_static -DCMAKE_BUILD_TYPE=Debug -DVRM_PP_INCLUDE_DIR=../extlibs/vrm_pp/include -DSSVUTILS_INCLUDE_DIR=../extlibs/SSVUtils/include -DSSVMENUSYSTEM_INCLUDE_DIR=../extlibs/SSVMenuSystem/include -DSSVSTART_INCLUDE_DIR=../extlibs/SSVStart/include ..
add JNIEXPORT
in front of void ANativeActivity_onCreate
in _deps/sfml-src/src/SFML/Main/SFMLActivity.cpp
at line 135.
JNIEXPORT void ANativeActivity_onCreate(ANativeActivity* activity, void* savedState, std::size_t savedStateSize)
then run make
- modify android example
cd _deps/sfml-src/examples/android/
modify build.gradle:
classpath 'com.android.tools.build:gradle:3.0.0'
to
classpath 'com.android.tools.build:gradle:7.1.0'
ceate local.properties:
ndk.dir=path/to/ndk
sdk.dir=path/to/sdk
then
cd app
modify build.gradle and remove:
29 externalNativeBuild {
30 ndkBuild {
31 path "src/main/jni/Android.mk"
32
33 }
34 }
(since we want to bundle prebuilt libs and not build with gradle)
also in the same file change compileSdkVersion to 30 and targetSdkVersion to 30 so gradle won't complain,
then
cd src/main
modify AndroidManifest.xml to this:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.sfmldev.android"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-feature android:glEsVersion="0x00010001" />
<application android:label="@string/app_name"
android:icon="@drawable/sfml_logo"
android:hasCode="false"
android:allowBackup="true">
<activity android:name="android.app.NativeActivity"
android:label="@string/app_name"
android:icon="@drawable/sfml_logo"
android:configChanges="keyboardHidden|orientation|screenSize">
<meta-data android:name="android.app.lib_name" android:value="sfml-activity-d" />
<meta-data android:name="sfml.app.lib_name" android:value="SSVOpenHexagon" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
remove example assets and copy our own
cd assets
rm *
cp -r path/To/OH/Assets .
cd ..
Remove example code
rm -r jni
Put in the libs
mkdir jniLibs
mkdir jniLibs/armeabi-v7a
cd jniLibs/armeabi-v7a
cp path/to/oh/buildlx/_deps/sfml-build/lib/libsfml-*.so .
cp path/to/oh/Downloads/ohandrepro/buildlx/_deps/libsodium-cmake-build/libsodium.so .
cp path/to/oh/Downloads/ohandrepro/buildlx/_deps/luajit-build/src/libluajit.so .
cp path/to/oh/Downloads/ohandrepro/buildlx/_deps/sfml-src/extlibs/libs-android/armeabi-v7a/libopenal.so .
cp path/to/oh/Downloads/ohandrepro/buildlx/_deps/zlib-build/libz.so .
cp path/to/oh/Downloads/ohandrepro/buildlx/SSVOpenHexagon libSSVOpenHexagon.so
cd ../../../../..
and finally
gradle build
apk is now at app/build/outputs/apk/debug/app-debug.apk
make sure to copy the Assets
and the Packs
folder to /storage/self/primary/Android/data/org.sfmldev.android/files
otherwise the app will just crash