Make the platform responsible to create the buildenv.

It is now the platform who is responsible to:
- correctly add the toolchains as needed
- setup the cross environment
- create the cross files.
This commit is contained in:
Matthieu Gautier
2018-05-28 14:18:51 +02:00
parent 115fbfa147
commit 754df8df1d
29 changed files with 407 additions and 394 deletions

View File

@ -1,7 +1,8 @@
from .base import PlatformInfo
import subprocess
from .base import PlatformInfo
from kiwixbuild.utils import pj, xrun_find
class iOSPlatformInfo(PlatformInfo):
@ -13,7 +14,7 @@ class iOSPlatformInfo(PlatformInfo):
}
def __init__(self, name, arch):
super().__init__(name, 'iOS', True, ['iOS_sdk'],
super().__init__(name, 'iOS', True, [],
hosts=['Darwin'])
self.arch = arch
self.arch_full, self.cpu, self.sdk_name = self.__arch_infos[arch]
@ -29,9 +30,16 @@ class iOSPlatformInfo(PlatformInfo):
def __str__(self):
return "iOS"
def finalize_setup(self):
super().finalize_setup()
self.buildEnv.cmake_crossfile = self._gen_crossfile('cmake_ios_cross_file.txt')
self.buildEnv.meson_crossfile = self._gen_crossfile('meson_cross_file.txt')
def get_cross_config(self):
return {
'root_path': self.root_path,
'binaries': self.binaries,
'exec_wrapper_def': '',
'extra_libs': ['-fembed-bitcode', '-isysroot', self.root_path, '-arch', self.arch, '-miphoneos-version-min=9.0', '-stdlib=libc++'],
'extra_cflags': ['-fembed-bitcode', '-isysroot', self.root_path, '-arch', self.arch, '-miphoneos-version-min=9.0', '-stdlib=libc++'],
'host_machine': {
@ -53,6 +61,26 @@ class iOSPlatformInfo(PlatformInfo):
def get_bin_dir(self):
return [pj(self.root_path, 'bin')]
@property
def binaries(self):
return {
'CC': xrun_find('clang'),
'CXX': xrun_find('clang++'),
'AR': '/usr/bin/ar',
'STRIP': '/usr/bin/strip',
'RANLIB': '/usr/bin/ranlib',
'LD': '/usr/bin/ld',
}
@property
def configure_option(self):
return '--host={}'.format(self.arch_full)
def set_compiler(self, env):
env['CC'] = self.binaries['CC']
env['CXX'] = self.binaries['CXX']
iOSPlatformInfo('iOS_armv7', 'armv7')
iOSPlatformInfo('iOS_arm64', 'arm64')
iOSPlatformInfo('iOS_i386', 'i386')