mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-05 03:24:56 +08:00
Restore iOS build support (#2352)
* initial commit * initial commit * add port files * ios: Changes to allow creating app bundle without xcode projects * ios: Added mic perms request * ios: Very basic app bundle creation script * ios: Fix -log parameter * ios: Sdk no longer hardcoded and option to compile for simulator * general: Update gitignore * ios: Enable game mode for the app * ios: Compile instructions and updated ipa creation script * ios: Code cleanup * ios: Remove dylibs * general: Remove extra submodules * ios: Remove dylibs again * ios: Implement suggested changes * ios: Fix building as dylib instead of binary * ios: Scripts for building mods * ios: Move 'ios' contents to engine/platform/ios/bundle and modify scripts * ios: Update createipa.sh to use waf install * ios: Clean script and updated README * general: Fix spelling mistake and outdated instructions * ios: Clean up in xcompile.py * ios: Fix createipa.sh generating an invalid ipa * ios: Temporary fix for launch dialog textfield colors in dark mode
This commit is contained in:
27
scripts/ios/buildhlsdk.sh
Executable file
27
scripts/ios/buildhlsdk.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
#cd into script directory
|
||||
SCRIPTDIR=${0%/*}
|
||||
cd $SCRIPTDIR
|
||||
|
||||
MODPATH=mod-build/$1
|
||||
if [ -z $1 ]; then
|
||||
MODPATH=mod-build/hlsdk
|
||||
git clone --recursive https://github.com/FWGS/hlsdk-portable -b mobile_hacks $MODPATH
|
||||
else
|
||||
git clone --recursive https://github.com/FWGS/hlsdk-portable -b $1 $MODPATH
|
||||
fi
|
||||
|
||||
mkdir ../../build/ios
|
||||
IOSDIR=$(realpath ../../build/ios)
|
||||
cd $MODPATH
|
||||
|
||||
#compiling hlsdk for ios release is broken, so just build for debug
|
||||
cmake -DCMAKE_SYSTEM_NAME=iOS -DGAMEDIR=$IOSDIR -DCMAKE_BUILD_TYPE=Debug -B build -S .
|
||||
cmake --build build --target install
|
||||
|
||||
cd ../../
|
||||
if [ -d mod-build ]; then
|
||||
rm -rf mod-build/
|
||||
fi
|
||||
exit 0
|
||||
38
scripts/ios/createipa.sh
Executable file
38
scripts/ios/createipa.sh
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
|
||||
#cd into script directory
|
||||
cd "${0%/*}"
|
||||
BUILDDIR=$(realpath ../../build)
|
||||
echo $BUILDDIR
|
||||
cd "../../engine/platform/ios/bundle"
|
||||
|
||||
if [ -d $BUILDDIR ]; then
|
||||
mkdir -p "$BUILDDIR/ios/xash3d.app"
|
||||
|
||||
cp -r "$BUILDDIR/ios/dlls" "$BUILDDIR/ios/xash3d.app"
|
||||
cp -r "$BUILDDIR/ios/cl_dlls" "$BUILDDIR/ios/xash3d.app"
|
||||
cp *.plist "$BUILDDIR/ios/xash3d.app"
|
||||
if [ ! -d $BUILDDIR/SDL2.framework ]; then
|
||||
echo "Couldn't find SDL2.framework, place it in the build directory"
|
||||
exit 1
|
||||
fi
|
||||
cp -r $BUILDDIR/SDL2.framework "$BUILDDIR/ios/xash3d.app"
|
||||
|
||||
cd ../../../../
|
||||
|
||||
./waf install --destdir="$BUILDDIR/ios/xash3d.app"
|
||||
|
||||
cd $BUILDDIR
|
||||
|
||||
rm -r "$BUILDDIR/ios/Payload/"
|
||||
mkdir "$BUILDDIR/ios/Payload"
|
||||
|
||||
cp -r "$BUILDDIR/ios/xash3d.app" ios/Payload/
|
||||
rm -r "$BUILDDIR/ios/xash3d.app"
|
||||
cd ios
|
||||
zip -r ../xash3d.ipa Payload
|
||||
else
|
||||
echo "Couldn't find the build directory, compile the engine before running this script!"
|
||||
exit 1
|
||||
fi
|
||||
exit 0
|
||||
@@ -45,6 +45,34 @@ PSVITA_ENVVARS = ['VITASDK']
|
||||
|
||||
PSP_ENVVARS = ['PSPDEV', 'PSPSDK', 'PSPTOOLCHAIN']
|
||||
|
||||
class iOS:
|
||||
ctx = None
|
||||
sdkpath = None
|
||||
target = None
|
||||
|
||||
def __init__(self, ctx, issim):
|
||||
self.ctx = ctx
|
||||
sdk = 'iphonesimulator' if issim else 'iphoneos'
|
||||
self.sdkpath = ctx.cmd_and_log('xcrun --show-sdk-path --sdk %s' % sdk).strip()
|
||||
self.target = '--target=aarch64-apple-ios'
|
||||
if issim: self.target += '-simulator'
|
||||
|
||||
def cflags(self, cxx = False):
|
||||
|
||||
cflags = [ '-isysroot' + self.sdkpath, self.target, '-mios-version-min=12.0' ]
|
||||
return cflags
|
||||
|
||||
def linkflags(self):
|
||||
|
||||
linkflags = [ '-isysroot' + self.sdkpath, self.target, '-mios-version-min=12.0' ]
|
||||
return linkflags
|
||||
|
||||
def cc(self):
|
||||
return 'clang'
|
||||
|
||||
def cxx(self):
|
||||
return 'clang++'
|
||||
|
||||
# This class does support ONLY r10e and r19c/r20 NDK
|
||||
class Android:
|
||||
ctx = None # waf context
|
||||
@@ -610,6 +638,10 @@ def options(opt):
|
||||
help='enable building for Emscripten')
|
||||
xc.add_option('--psp', action='store', dest='PSP_OPTS', default=None,
|
||||
help='enable building for PlayStation Portable, format: --psp=<module type>,<fw version>,<render type>, example: --psp=prx,660,HW')
|
||||
xc.add_option('--ios', action='store_true', dest='IOS', default=False,
|
||||
help='enable building for iOS [default: %(default)s]')
|
||||
xc.add_option('--ios-simulator', action='store_true', dest='IOSSIM', default=False,
|
||||
help='enable building for iOS Simulator [default: %(default)s]')
|
||||
|
||||
def configure(conf):
|
||||
if 'CROSS_COMPILE' in conf.environ:
|
||||
@@ -754,6 +786,18 @@ def configure(conf):
|
||||
|
||||
conf.env.PSP_RENDER_TYPE = psp.render_type
|
||||
conf.env.PSP_BUILD_PRX = psp.build_prx
|
||||
elif conf.options.IOS or conf.options.IOSSIM:
|
||||
issim = True if conf.options.IOSSIM else False
|
||||
|
||||
conf.ios = ios = iOS(conf, issim)
|
||||
|
||||
conf.environ['CC'] = ios.cc()
|
||||
conf.environ['CXX'] = ios.cxx()
|
||||
|
||||
conf.env.CFLAGS += ios.cflags()
|
||||
conf.env.CXXFLAGS += ios.cflags()
|
||||
conf.env.LINKFLAGS += ios.linkflags()
|
||||
conf.env.IOS = 1
|
||||
|
||||
conf.env.MAGX = conf.options.MAGX
|
||||
conf.env.MSVC_WINE = conf.options.MSVC_WINE
|
||||
|
||||
Reference in New Issue
Block a user