Skip to content

Commit

Permalink
iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
automactic committed Oct 19, 2023
1 parent 44a8963 commit 51dcd32
Showing 1 changed file with 39 additions and 34 deletions.
73 changes: 39 additions & 34 deletions kiwixbuild/platforms/ios.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class ApplePlatformInfo(PlatformInfo):
target = None
sdk_name = None
min_iphoneos_version = None
min_macos_version = None

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
Expand All @@ -40,14 +41,12 @@ def get_cross_config(self):
'binaries': self.binaries,
'exe_wrapper_def': '',
'extra_libs': [
'-fembed-bitcode',
'-isysroot', self.root_path,
'-arch', self.arch,
'-target', self.target,
'-stdlib=libc++'
],
'extra_cflags': [
'-fembed-bitcode',
'-isysroot', self.root_path,
'-arch', self.arch,
'-target', self.target,
Expand All @@ -66,24 +65,31 @@ def get_cross_config(self):
if self.min_iphoneos_version:
config['extra_libs'].append('-miphoneos-version-min={}'.format(self.min_iphoneos_version))
config['extra_cflags'].append('-miphoneos-version-min={}'.format(self.min_iphoneos_version))
if self.min_macos_version:
config['extra_libs'].append('-mmacosx-version-min={}'.format(self.min_macos_version))
config['extra_cflags'].append('-mmacosx-version-min={}'.format(self.min_macos_version))
return config

def get_env(self):
env = super().get_env()
env['MACOSX_DEPLOYMENT_TARGET'] = '10.15'
cflags = [env['CFLAGS']]
if self.min_iphoneos_version:
cflags.append('-miphoneos-version-min={}'.format(self.min_iphoneos_version))
if self.min_macos_version:
cflags.append('-mmacosx-version-min={}'.format(self.min_macos_version))
env['CFLAGS'] = ' '.join(cflags)
return env

def set_comp_flags(self, env):
super().set_comp_flags(env)
cflags = [
'-fembed-bitcode',
'-isysroot {}'.format(self.root_path),
'-arch {}'.format(self.arch),
'-target {}'.format(self.target),
env['CFLAGS'],
]
if self.min_iphoneos_version:
cflags.append('-miphoneos-version-min={}'.format(self.min_iphoneos_version))
env['CC'] = 'clang'
env['CXX'] = 'clang++'
env['CFLAGS'] = ' '.join(cflags)
env['CXXFLAGS'] = ' '.join([
env['CFLAGS'],
Expand Down Expand Up @@ -120,54 +126,53 @@ class iOSArm64(ApplePlatformInfo):
name = 'iOS_arm64'
arch = cpu = 'arm64'
host = 'arm-apple-darwin'
target = 'aarch64-apple-ios'
target = 'arm64-apple-ios'
sdk_name = 'iphoneos'
min_iphoneos_version = '13.0'
min_iphoneos_version = '15.0'


class iOSSimulatorX86(ApplePlatformInfo):
"""iOS / iPadOS simulator on Intel"""

class iOSx64(ApplePlatformInfo):
name = 'iOS_x86_64'
name = 'iOS_simulator_x86'
arch = cpu = 'x86_64'
host = 'x86_64-apple-darwin'
target = 'x86_64-apple-ios'
sdk_name = 'iphonesimulator'
min_iphoneos_version = '13.0'
min_iphoneos_version = '15.0'


class iOSMacABI(ApplePlatformInfo):
name = 'iOS_Mac_ABI'
arch = cpu = 'x86_64'
host = 'x86_64-apple-darwin'
target = 'x86_64-apple-ios14.0-macabi'
sdk_name = 'macosx'
min_iphoneos_version = '14.0'
class iOSSimulatorArm64(ApplePlatformInfo):
"""iOS / iPadOS simulator on Apple Silicon"""


class macOSArm64(ApplePlatformInfo):
name = 'macOS_arm64_static'
name = 'iOS_simulator_arm64'
arch = cpu = 'arm64'
host = 'aarch64-apple-darwin'
target = 'arm64-apple-macos11'
sdk_name = 'macosx'
min_iphoneos_version = None
host = 'arm-apple-darwin'
target = 'arm64-apple-ios-simulator'
sdk_name = 'iphonesimulator'
min_iphoneos_version = '15.0'


class macOSArm64(ApplePlatformInfo):
"""macOS on Apple Silicon"""

class macOSArm64Mixed(MixedMixin('macOS_arm64_static'), ApplePlatformInfo):
name = 'macOS_arm64_mixed'
name = 'macOS_arm64'
arch = cpu = 'arm64'
host = 'aarch64-apple-darwin'
target = 'arm64-apple-macos11'
host = 'arm-apple-darwin'
target = 'arm64-apple-macos'
sdk_name = 'macosx'
min_iphoneos_version = None
min_macos_version = '12.0'


class macOSx64(ApplePlatformInfo):
name = 'macOS_x86_64'
class macOSX86(ApplePlatformInfo):
"""macOS on Intel"""

name = 'macOS_x86'
arch = cpu = 'x86_64'
host = 'x86_64-apple-darwin'
target = 'x86_64-apple-macos10.12'
target = 'x86_64-apple-macos'
sdk_name = 'macosx'
min_iphoneos_version = None
min_macos_version = '12.0'


class IOS(MetaPlatformInfo):
Expand Down

0 comments on commit 51dcd32

Please sign in to comment.