-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.py
executable file
·82 lines (71 loc) · 2.06 KB
/
bootstrap.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
#!/usr/bin/env python3
import os
import sys
import sysconfig
import argparse
from deps.vcpkg.scripts.buildtools import vcpkg
if __name__ == "__main__":
try:
parser = argparse.ArgumentParser(
description="Bootstrap infra.", parents=[vcpkg.bootstrap_argparser()]
)
parser.add_argument(
"--cpp20",
dest="cpp20_enabled",
action="store_true",
help="build with C++20 support",
)
parser.add_argument(
"-p",
"--prompt",
dest="prompt",
action="store_true",
help="prompt for triplet selection",
)
args = parser.parse_args()
platform = sysconfig.get_platform()
triplet = args.triplet
if platform == "win-amd64" and not args.prompt:
triplet = "x64-windows-static-vs2022"
elif platform == "mingw":
triplet = "x64-mingw"
if not triplet:
triplet = vcpkg.prompt_for_triplet()
extras = []
features = [
"log",
"cliprogress",
"process",
"hashing",
"xml",
"tbb",
"numeric",
"charset",
"compression",
"gdal",
"db",
"testing",
]
if not args.cpp20_enabled:
features.append("cpp17")
build_root = None
packages_root = None
if args.clean:
vcpkg.clean(triplet=triplet)
else:
vcpkg.bootstrap(
ports_dir=os.path.join(".", "deps"),
clean_after_build=args.clean_after_build,
triplet=triplet,
additional_ports=extras,
build_root=build_root,
install_root=f"vcpkgs-{triplet}",
packages_root=packages_root,
additional_features=features,
)
except KeyboardInterrupt:
print("\nInterrupted")
sys.exit(-1)
except RuntimeError as e:
print(e)
sys.exit(-1)