Browse Source

make app launch

although it crashes on start because of boost.filesystem
Andrey Filipenkov 4 years ago
parent
commit
fe86ac97b6
5 changed files with 107 additions and 11 deletions
  1. 59 0
      Info.plist
  2. 2 2
      client/CMakeLists.txt
  3. 19 0
      client/SDL_uikit_main.c
  4. 0 9
      client/main_ios.m
  5. 27 0
      package_ios.sh

+ 59 - 0
Info.plist

@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>BuildMachineOSBuild</key>
+	<string>19H524</string>
+	<key>CFBundleDevelopmentRegion</key>
+	<string>English</string>
+	<key>CFBundleExecutable</key>
+	<string>vcmiclient</string>
+	<key>CFBundleIdentifier</key>
+	<string>eu.vcmi.client</string>
+	<key>CFBundleInfoDictionaryVersion</key>
+	<string>6.0</string>
+	<key>CFBundleName</key>
+	<string>VCMI</string>
+	<key>CFBundlePackageType</key>
+	<string>APPL</string>
+	<key>CFBundleShortVersionString</key>
+	<string>1.0</string>
+	<key>CFBundleSignature</key>
+	<string>????</string>
+	<key>CFBundleSupportedPlatforms</key>
+	<array>
+		<string>iPhoneOS</string>
+	</array>
+	<key>CFBundleVersion</key>
+	<string>1</string>
+	<key>DTCompiler</key>
+	<string>com.apple.compilers.llvm.clang.1_0</string>
+	<key>DTPlatformBuild</key>
+	<string>17H22</string>
+	<key>DTPlatformName</key>
+	<string>iphoneos</string>
+	<key>DTPlatformVersion</key>
+	<string>13.7</string>
+	<key>DTSDKBuild</key>
+	<string>17H22</string>
+	<key>DTSDKName</key>
+	<string>iphoneos13.7</string>
+	<key>DTXcode</key>
+	<string>1170</string>
+	<key>DTXcodeBuild</key>
+	<string>11E801a</string>
+	<key>MinimumOSVersion</key>
+	<string>9.0</string>
+	<key>UIDeviceFamily</key>
+	<array>
+		<integer>1</integer>
+		<integer>2</integer>
+	</array>
+	<key>UIFileSharingEnabled</key>
+	<true/>
+	<key>UIRequiredDeviceCapabilities</key>
+	<array>
+		<string>arm64</string>
+	</array>
+</dict>
+</plist>

+ 2 - 2
client/CMakeLists.txt

@@ -154,7 +154,7 @@ endif()
 if(WIN32)
 	set(client_ICON "VCMI_client.rc")
 elseif(APPLE_IOS)
-	set(client_SRCS ${client_SRCS} main_ios.m)
+	set(client_SRCS ${client_SRCS} SDL_uikit_main.c)
 endif()
 
 if(ENABLE_DEBUG_CONSOLE)
@@ -177,7 +177,7 @@ if(WIN32)
 	target_compile_definitions(vcmiclient PRIVATE WINDOWS_IGNORE_PACKING_MISMATCH)
 elseif(APPLE_IOS)
 	target_link_libraries(vcmiclient PRIVATE
-		"-framework QuartzCore -framework CoreGraphics -framework CoreServices -framework ImageIO" # SDL2_image
+		"-framework Foundation -framework UIKit -framework QuartzCore -framework CoreGraphics -framework CoreServices -framework ImageIO" # SDL2_image
 	)
 endif()
 

+ 19 - 0
client/SDL_uikit_main.c

@@ -0,0 +1,19 @@
+/*
+    SDL_uikit_main.c, placed in the public domain by Sam Lantinga  3/18/2019
+*/
+// #include "../../SDL_internal.h"
+
+/* Include the SDL main definition header */
+#include "SDL_main.h"
+
+#ifdef main
+#undef main
+#endif
+
+int
+main(int argc, char *argv[])
+{
+    return SDL_UIKitRunApp(argc, argv, SDL_main);
+}
+
+/* vi: set ts=4 sw=4 expandtab: */

+ 0 - 9
client/main_ios.m

@@ -1,9 +0,0 @@
-@import UIKit;
-
-int main (int argc, char *argv[])
-{
-    @autoreleasepool
-    {
-        return UIApplicationMain(argc, argv, nil, nil);
-    }
-}

+ 27 - 0
package_ios.sh

@@ -0,0 +1,27 @@
+#!/usr/bin/env bash
+
+pushd bin/Debug
+mkdir -p vcmiclient.app/Frameworks
+cp *.dylib AI/*.dylib vcmiclient.app
+badInstallNamePrefix=$(pwd)
+cd vcmiclient.app
+
+sdl2Path=~/dev/ios/vcmi-ios-deps/SDL2-lib/lib
+cp "$sdl2Path/libSDL2.dylib" .
+install_name_tool -rpath "$sdl2Path" '@executable_path/Frameworks' vcmiclient
+
+for b in vcmiclient *.dylib; do
+  for l in minizip vcmi; do
+    libName="lib${l}.dylib"
+    install_name_tool -change "$badInstallNamePrefix/$libName" "@rpath/$libName" "$b"
+  done
+  if [ "$b" != vcmiclient ]; then
+    install_name_tool -id "@rpath/$b" "$b"
+  fi
+done
+
+mv -f *.dylib Frameworks
+popd
+
+cp -f ../vcmi/Info.plist "$badInstallNamePrefix/vcmiclient.app"
+cp -R bin/Debug-iphoneos/* "$badInstallNamePrefix/vcmiclient.app"