Add Mac catalyst as a new target

This commit is contained in:
Chris Li 2020-05-31 22:01:20 -04:00 committed by ChrisLi
parent ea78ba37df
commit 149ed01f12
1 changed files with 58 additions and 11 deletions

View File

@ -1,15 +1,19 @@
import subprocess import subprocess
from .base import PlatformInfo, MetaPlatformInfo
from kiwixbuild.utils import pj, xrun_find
from kiwixbuild._global import option from kiwixbuild._global import option
from kiwixbuild.utils import pj, xrun_find
from .base import PlatformInfo, MetaPlatformInfo
class iOSPlatformInfo(PlatformInfo): class iOSPlatformInfo(PlatformInfo):
build = 'iOS' build = 'iOS'
static = True static = True
compatible_hosts = ['Darwin'] compatible_hosts = ['Darwin']
min_iphoneos_version = '11.0' min_iphoneos_version = '11.0'
arch = None
arch_full = None
target = None
sdk_name = None
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
@ -35,8 +39,23 @@ class iOSPlatformInfo(PlatformInfo):
'root_path': self.root_path, 'root_path': self.root_path,
'binaries': self.binaries, 'binaries': self.binaries,
'exe_wrapper_def': '', 'exe_wrapper_def': '',
'extra_libs': ['-fembed-bitcode', '-isysroot', self.root_path, '-arch', self.arch, '-miphoneos-version-min={}'.format(self.min_iphoneos_version), '-stdlib=libc++'], 'extra_libs': [
'extra_cflags': ['-fembed-bitcode', '-isysroot', self.root_path, '-arch', self.arch, '-miphoneos-version-min={}'.format(self.min_iphoneos_version), '-stdlib=libc++', '-I{}'.format(pj(self.buildEnv.install_dir, 'include'))], '-fembed-bitcode',
'-isysroot', self.root_path,
'-arch', self.arch,
'-target', self.target,
'-miphoneos-version-min={}'.format(self.min_iphoneos_version),
'-stdlib=libc++'
],
'extra_cflags': [
'-fembed-bitcode',
'-isysroot', self.root_path,
'-arch', self.arch,
'-target', self.target,
'-miphoneos-version-min={}'.format(self.min_iphoneos_version),
'-stdlib=libc++',
'-I{}'.format(pj(self.buildEnv.install_dir, 'include'))
],
'host_machine': { 'host_machine': {
'system': 'Darwin', 'system': 'Darwin',
'lsystem': 'darwin', 'lsystem': 'darwin',
@ -54,10 +73,24 @@ class iOSPlatformInfo(PlatformInfo):
def set_comp_flags(self, env): def set_comp_flags(self, env):
super().set_comp_flags(env) super().set_comp_flags(env)
env['CFLAGS'] = " -fembed-bitcode -isysroot {SDKROOT} -arch {arch} -miphoneos-version-min={min_iphoneos_version} ".format(SDKROOT=self.root_path, min_iphoneos_version=self.min_iphoneos_version, arch=self.arch) + env['CFLAGS'] env['CFLAGS'] = ' '.join([
env['CXXFLAGS'] = env['CFLAGS'] + " -stdlib=libc++ -std=c++11 "+env['CXXFLAGS'] '-fembed-bitcode',
env['LDFLAGS'] = " -arch {arch} -isysroot {SDKROOT} ".format(SDKROOT=self.root_path, arch=self.arch) '-isysroot {}'.format(self.root_path),
'-arch {}'.format(self.arch),
'-miphoneos-version-min={}'.format(self.min_iphoneos_version),
'-target {}'.format(self.target),
env['CFLAGS'],
])
env['CXXFLAGS'] = ' '.join([
env['CFLAGS'],
'-stdlib=libc++',
'-std=c++11',
env['CXXFLAGS'],
])
env['LDFLAGS'] = ' '.join([
' -arch {}'.format(self.arch),
'-isysroot {}'.format(self.root_path),
])
def get_bin_dir(self): def get_bin_dir(self):
return [pj(self.root_path, 'bin')] return [pj(self.root_path, 'bin')]
@ -78,18 +111,32 @@ class iOSPlatformInfo(PlatformInfo):
def configure_option(self): def configure_option(self):
return '--host={}'.format(self.arch_full) return '--host={}'.format(self.arch_full)
class iOSArm64(iOSPlatformInfo): class iOSArm64(iOSPlatformInfo):
name = 'iOS_arm64' name = 'iOS_arm64'
arch = cpu = 'arm64' arch = cpu = 'arm64'
arch_full = 'arm-apple-darwin' arch_full = 'arm-apple-darwin'
target = 'aarch64-apple-ios'
sdk_name = 'iphoneos' sdk_name = 'iphoneos'
class iOSx64(iOSPlatformInfo): class iOSx64(iOSPlatformInfo):
name = 'iOS_x86_64' name = 'iOS_x86_64'
arch = cpu = 'x86_64' arch = cpu = 'x86_64'
arch_full = 'x86_64-apple-darwin' arch_full = 'x86_64-apple-darwin'
target = 'x86_64-apple-ios'
sdk_name = 'iphonesimulator' sdk_name = 'iphonesimulator'
class iOSMacABI(iOSPlatformInfo):
name = 'iOS_Mac_ABI'
arch = cpu = 'x86_64'
arch_full = 'x86_64-apple-darwin'
target = 'x86_64-apple-ios13.0-macabi'
sdk_name = 'macosx'
min_iphoneos_version = '13.0'
class IOS(MetaPlatformInfo): class IOS(MetaPlatformInfo):
name = "iOS_multi" name = "iOS_multi"
compatible_hosts = ['Darwin'] compatible_hosts = ['Darwin']