-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.py
80 lines (72 loc) · 2.23 KB
/
build.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
import argparse
import os
import subprocess
import platform
import threading
import time
import zipfile
from scripts.setupPremake import premake
from scripts.setupPython import PythonConfiguration as PythonRequirements
# Function to map 'Static' to 'StaticLib' and 'Shared' to 'SharedLib'
def api_type_mapping(value):
mapping = {
"C-API":"C",
"CPP-API":"CPP",
"C":"C",
"CPP":"CPP",
"COMBINED":"COMBINED",
"none":"NONE",
"NONE":"NONE"
}
if value not in mapping:
raise argparse.ArgumentTypeError(f"Invalid choice: {value} (choose from 'CPP', 'CPP-API', 'C', 'C-API,COMBINED')")
return mapping[value]
def lib_type_mapping(value):
mapping = {
'Static': 'StaticLib',
'Shared': 'SharedLib',
'StaticLib': 'StaticLib',
'SharedLib': 'SharedLib'
}
if value not in mapping:
raise argparse.ArgumentTypeError(f"Invalid choice: {value} (choose from 'SharedLib', 'Shared', 'StaticLib', 'Static')")
return mapping[value]
def main():
# parse options
parser = argparse.ArgumentParser(description="Install Premake and run premake.")
#these are used for pipeline building
parser.add_argument(
"--force-premake",
action="store_true",
help="Install premake without asking for permission.",
)
parser.add_argument(
"--force-python",
action="store_true",
help="Install pyhton packages without asking for permission.",
)
parser.add_argument(
"--enable-WSL",
action="store_true",
help="enables windows subsystem for linux building of Athena"
)
parser.add_argument(
"--api-type",
type=api_type_mapping,
choices=['C-API','C','CPP-API','CPP','COMBINED','NONE','none'],
help="Choose a api type.",
default="NONE"
)
parser.add_argument(
"--lib-type",
type=lib_type_mapping,
choices=['SharedLib','Shared','StaticLib','Static'],
help="Choose a library type.",
default="StaticLib"
)
args = parser.parse_args()
PythonRequirements.Validate(args.force_python)
premake(args)
input("Press Enter to continue...")
if __name__ == "__main__":
main()