forked from godotengine/godot-mono-builds
-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.py
executable file
·119 lines (90 loc) · 2.75 KB
/
options.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
from dataclasses import dataclass
from os.path import abspath
@dataclass
class BaseOpts:
verbose_make: bool
jobs: str
configure_dir: str
install_dir: str
mono_source_root: str
mxe_prefix: str
@dataclass
class RuntimeOpts(BaseOpts):
configuration: str
release: bool
enable_cxx: bool
strip_libs: bool
@dataclass
class AndroidOpts(RuntimeOpts):
android_sdk_root: str
android_ndk_version: str
android_api_version: str
android_cmake_version: str
toolchain_name_fmt: str = '%s-api%s-clang'
@dataclass
class iOSOpts(RuntimeOpts):
ios_toolchain_path: str
ios_sdk_path: str
ios_version_min: str
osx_toolchain_path: str
osx_sdk_path: str
osx_triple_abi: str
@dataclass
class DesktopOpts(RuntimeOpts):
with_llvm: bool
@dataclass
class BclOpts(BaseOpts):
tests: bool
remove_pdb: bool
# Need to make paths absolute as we change cwd
def base_opts_from_args(args):
from os.path import abspath
return BaseOpts(
verbose_make = args.verbose_make,
jobs = args.jobs,
configure_dir = abspath(args.configure_dir),
install_dir = abspath(args.install_dir),
mono_source_root = abspath(args.mono_sources),
mxe_prefix = args.mxe_prefix
)
def runtime_opts_from_args(args):
return RuntimeOpts(
**vars(base_opts_from_args(args)),
configuration = args.configuration,
release = (args.configuration == 'release'),
enable_cxx = args.enable_cxx,
strip_libs = args.strip_libs
)
def android_opts_from_args(args):
return AndroidOpts(
**vars(runtime_opts_from_args(args)),
android_sdk_root = abspath(args.android_sdk),
android_ndk_version = args.android_ndk_version,
android_api_version = args.android_api_version,
android_cmake_version = args.android_cmake_version
)
def ios_opts_from_args(args):
return iOSOpts(
**vars(runtime_opts_from_args(args)),
ios_toolchain_path = abspath(args.ios_toolchain),
ios_sdk_path = abspath(args.ios_sdk) if args.ios_sdk else '',
ios_version_min = args.ios_version_min,
osx_toolchain_path = abspath(args.osx_toolchain),
osx_sdk_path = abspath(args.osx_sdk) if args.ios_sdk else '',
osx_triple_abi = args.osx_triple_abi
)
def bcl_opts_from_args(args):
return BclOpts(
**vars(base_opts_from_args(args)),
tests = args.tests,
remove_pdb = args.remove_pdb
)
def desktop_opts_from_args(args):
return DesktopOpts(
**vars(runtime_opts_from_args(args)),
with_llvm = args.with_llvm
)
def make_default_args(opts: BaseOpts):
make_args = ['-j%s' % opts.jobs]
make_args += ['V=1'] if opts.verbose_make else []
return make_args