Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericoporto/cf3ce8d53e9b0214d691af03a9d6b57c to your computer and use it in GitHub Desktop.
Save ericoporto/cf3ce8d53e9b0214d691af03a9d6b57c to your computer and use it in GitHub Desktop.

Introduction

Here are some rough notes on building Kirikiri SDL2 for iOS and Android.
Please note that these may or may not be incomplete. Improved documentation is being planned, but not started yet.

Startup Directory selection

Since Android and iOS don't really have concepts of "current directory" or "command line arguments", you should probably hardcode the startup directory in TVPBeforeSystemInit in src/core/base/sdl2/SysInitImpl.cpp.

Android is still a work in progress. You may be able to use file://?/<file path> to access the Android assets folder, but this is untested.

For iOS, the startup directory will be searched in <app name>.app/Contents/Resources/:

  • content-data
  • data.xp3
  • data.exe
  • data

The data directory in the repository will automatically be copied into the app bundle on build.

Android

You probably need JRE 8 installed first.
Also, be sure to set up the Android SDK and NDK (ANDROID_HOME and ANDROID_NDK_HOME is set).
Don't use sdkmanager to install NDK, as it is missing the platforms directory and will not allow you to compile the Android version correctly. Instead, download from here: https://developer.android.com/ndk/downloads
Afterwards, you can change directory into android-project and run ./gradlew assembleRelease.
For debugging purposes, you may want to do ./gradlew assembleDebug instead.
To compile for a single platform, you can use a single one of these arguments on the Gradle command line:

  • armeabi-v7a: -Parmeabi-v7a
  • arm64-v8a: -Parm64-v8a
  • x86: -Px86
  • x86_64: -Px86_64

APK is located at app/build/outputs/apk/<release type>/app-<release type>.apk.

This is as far as I have gotten. I don't have an Android device to test on at the moment.

iOS

Use the Xcode generator when generating build file:

cmake .. -GXcode -DCMAKE_SYSTEM_NAME=iOS -DSDL_SHARED=OFF

Open krkrsdl2.xcodeproj in Xcode. (You can't build it on the command line yet; some additional settings needs to be changed)
Go to "Signing & Capabilities" and set it up (Automatically manage signing will get you most of the way there)

For each target, feel free to lower the iOS Deployment Target for your device if needed.

On the build target (probably upper left), select krkrsdl2>(your device name).

Build and run.

Run demonstration: https://twitter.com/xyx0no646/status/1350824993186189312

Before uploading the program to App Store Connect, make sure you do not have any stray executable files in the "data" directory, or the upload operation will fail.
To upload, use "Product->Archive" menu option and wait for the operation to complete.
Once that is done, go to "Window->Organizer" menu option, select "krkrsdl2" (wait a bit for it to show up), then press "Distribute App".

App Store Connect upload screenshot: https://twitter.com/pnfqno646/status/1351019729624977410

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment