-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathbuild_bulk_libldks.py
53 lines (40 loc) · 1.89 KB
/
build_bulk_libldks.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import os
import subprocess
import sys
import build_individual_libldk
from script_config import ScriptConfig, BuildConfig
CALL_INDIVIDUAL_BUILD_METHOD_VIA_SHELL = False
def parse_config() -> ScriptConfig:
config = ScriptConfig.parse(
allow_ldk_argument=True,
parse_configuration=(not CALL_INDIVIDUAL_BUILD_METHOD_VIA_SHELL)
)
individual_configurations: [BuildConfig] = [
BuildConfig('iphoneos', '', ['arm64']),
BuildConfig('iphonesimulator', '-simulator', ['arm64', 'x86_64']),
BuildConfig('macosx', '', ['arm64', 'x86_64']),
BuildConfig('macosx', '-macabi', ['arm64', 'x86_64'])
]
config.LIBLDK_BUILD_CONFIGURATIONS = individual_configurations
return config
def run(config: ScriptConfig):
child_environment = dict(os.environ)
child_environment['LDK_C_BINDINGS_BASE'] = config.LDK_C_BINDINGS_BASE
child_environment['LDK_C_BINDINGS_DIRECTORY'] = config.LDK_C_BINDINGS_DIRECTORY
individual_libldk_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'build_individual_libldk.py')
libldk_build_configurations = config.LIBLDK_BUILD_CONFIGURATIONS
for current_build_config in libldk_build_configurations:
current_platform: str = current_build_config.platform
current_llvm_target_triple_suffix: str = current_build_config.llvm_target_triple_suffix
current_architectures: [str] = current_build_config.architectures
if CALL_INDIVIDUAL_BUILD_METHOD_VIA_SHELL:
child_environment['PLATFORM'] = current_platform
child_environment['LLVM_TARGET_TRIPLE_SUFFIX'] = current_llvm_target_triple_suffix
child_environment['ARCHS'] = ' '.join(current_architectures)
subprocess.check_call([sys.executable, individual_libldk_file], env=child_environment)
else:
current_config_clone = config
current_config_clone.LIBLDK_BUILD_CONFIGURATIONS = [current_build_config]
build_individual_libldk.run(config=current_config_clone)
if __name__ == '__main__':
run(config=parse_config())