diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a45e2da2e..892959e7f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -266,6 +266,42 @@ jobs: path: | build/opengothic/* + ios: + runs-on: macos-15 + strategy: + fail-fast: false + matrix: + sdk: [iphoneos, iphonesimulator] + env: + DEVELOPER_DIR: /Applications/Xcode_26.0.app/Contents/Developer + steps: + - uses: actions/checkout@v6 + with: + submodules: recursive + + - name: Install dependencies + run: brew install glslang + + - name: Configure + run: | + cmake -B build -G Xcode \ + -DCMAKE_SYSTEM_NAME=iOS \ + -DCMAKE_OSX_SYSROOT=${{ matrix.sdk }} \ + -DCMAKE_OSX_ARCHITECTURES=arm64 \ + -DCMAKE_OSX_DEPLOYMENT_TARGET=15.0 \ + -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED=NO + + - name: Build + run: cmake --build build --config ${{ env.BUILD_TYPE }} -j "$(sysctl -n hw.ncpu)" + + - name: Check app bundle + run: | + app=build/opengothic/${{ env.BUILD_TYPE }}/Gothic2Notr.app + plutil -lint "$app/Info.plist" + executable=$(plutil -extract CFBundleExecutable raw -o - "$app/Info.plist") + test -x "$app/$executable" + plutil -extract UIApplicationSceneManifest.UISceneConfigurations.UIWindowSceneSessionRoleApplication.0.UISceneConfigurationName raw -o - "$app/Info.plist" + release: if: startsWith(github.ref, 'refs/tags/') needs: [setup, linux, linux-deb, windows, macos-arm64, macos-x64] diff --git a/CMakeLists.txt b/CMakeLists.txt index 24fcd1862..35f84d394 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -194,13 +194,16 @@ endif() # the game if(IOS) - set_directory_properties("${CMAKE_SOURCE_DIR}" PROPERTIES - PROPERTY XCODE_STARTUP_PROJECT "Gothic2Notr") + set(OPENGOTHIC_IOS_BUNDLE_IDENTIFIER "opengothic.gothic2" CACHE STRING + "Bundle identifier for the iOS application") + set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS Info.plist.in) set_target_properties(Gothic2Notr PROPERTIES - MACOSX_BUNDLE_INFO_PLIST "Info.plist.in" - MACOSX_BUNDLE_GUI_IDENTIFIER "opengothic.gothic2" + MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in" + MACOSX_BUNDLE_GUI_IDENTIFIER "${OPENGOTHIC_IOS_BUNDLE_IDENTIFIER}" + MACOSX_BUNDLE_BUNDLE_NAME "OpenGothic" MACOSX_BUNDLE_BUNDLE_VERSION 1 MACOSX_BUNDLE_SHORT_VERSION_STRING "1.0" + XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "${OPENGOTHIC_IOS_BUNDLE_IDENTIFIER}" XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer") endif() diff --git a/Info.plist.in b/Info.plist.in index db96c3f43..0487d1457 100644 --- a/Info.plist.in +++ b/Info.plist.in @@ -34,12 +34,22 @@ LSSupportsOpeningDocumentsInPlace - com.apple.developer.kernel.increased-memory-limit - - UILaunchScreen + UIApplicationSceneManifest - UIColorName - black + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneConfigurationName + OpenGothic + + + + UILaunchScreen + diff --git a/README.md b/README.md index 7062bc9b0..bbecaf7cb 100644 --- a/README.md +++ b/README.md @@ -147,6 +147,36 @@ cmake --build ./build --target Gothic2Notr ``` Executables can be located at `OpenGothic/build/opengothic`. +### iOS + +Requires Xcode 26 or newer and targets iOS 15 or newer. Clone with submodules +as above, then generate an Xcode project: + +```bash +brew install glslang +cmake -S . -B build-ios -G Xcode \ + -DCMAKE_SYSTEM_NAME=iOS \ + -DCMAKE_OSX_SYSROOT=iphoneos \ + -DCMAKE_OSX_ARCHITECTURES=arm64 \ + -DCMAKE_OSX_DEPLOYMENT_TARGET=15.0 \ + -DOPENGOTHIC_IOS_BUNDLE_IDENTIFIER=org.example.opengothic +open build-ios/OpenGothic.xcodeproj +``` + +Choose the `Gothic2Notr` scheme, select your development team under Signing +& Capabilities, and run on your device. The bundle identifier must be unique +to your signing team. The existing target name also applies to Gothic 1. + +For an unsigned build, add `-DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED=NO` +when configuring, then run `cmake --build build-ios --config Release`. +The application is generated at `build-ios/opengothic/Release/Gothic2Notr.app`. +Use a separate build directory with `-DCMAKE_OSX_SYSROOT=iphonesimulator` +for the simulator. + +Game data is not included. Before launching, copy your installation's +`Data`, `_work`, and `System` folders into the app's Documents directory +using Finder file sharing. Missing game data currently makes the app exit. + ### Android Install dependencies: JDK 17, Gradle 8.9, CMake 3.22.1 or newer, Ninja and the Android SDK with SDK 35, build-tools 35.0.0, NDK 27.0.12077973 and SDK CMake 3.22.1. Set `JAVA_HOME`, `ANDROID_HOME` and `VULKAN_SDK`. Put Gradle, Ninja and the host Vulkan SDK's `glslangValidator` on `PATH`.