Skip to content

Instantly share code, notes, and snippets.

@uyjulian
Last active September 30, 2023 16:28
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save uyjulian/29cf0d615caabfecaab332491e082b6a to your computer and use it in GitHub Desktop.
Save uyjulian/29cf0d615caabfecaab332491e082b6a 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

For iOS, the startup directory will be searched in <app name>.app/Contents/Resources/.
For Android, the startup directory will be searched in the root of the assets directory embedded in the apk. For best performance, the file should be stored uncomompressed.

Startup folder candidates:

  • 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 have not tested further than this.

iOS

The last thing that needs to be done manually is set/setup KRKRSDL2_IOS_CODE_SIGN_IDENTITY.
This could be set to either "iPhone Developer" or "iPhone Distribution", or this may also possibly be set to another value.

Use the Xcode generator when generating build file:

cmake .. -GXcode -DCMAKE_SYSTEM_NAME=iOS -DKRKRSDL2_IOS_CODE_SIGN_IDENTITY="iPhone Developer"

Open krkrsdl2.xcodeproj in Xcode.
Optionally: 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