-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.py
executable file
·80 lines (70 loc) · 2.28 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
#!/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="Build gdx.", parents=[vcpkg.build_argparser()]
)
parser.add_argument(
"--no-avx2",
dest="no_avx2",
action="store_true",
help="build with avx2 instructions",
)
parser.add_argument(
"--build-dir",
dest="build_dir",
default="gdx",
help="name of the build directory",
)
parser.add_argument(
"--python-path",
dest="python_path",
help="the path of the python interpreter (default=autodetect)",
)
args = parser.parse_args()
sys_platform = sysconfig.get_platform()
triplet = args.triplet
if sys_platform == "win-amd64":
triplet = "x64-windows-static-vs2022"
elif not triplet:
triplet = vcpkg.prompt_for_triplet()
cmake_args = [
"-DINFRA_EMBED_GDAL_DATA=OFF",
"-DGDX_ENABLE_TESTS=ON",
"-DGDX_PYTHON_BINDINGS=ON",
"-DGDX_ENABLE_TOOLS=ON",
"-DGDX_ENABLE_BENCHMARKS=ON",
"-DGDX_ENABLE_SIMD=ON",
"-DGDX_ENABLE_GEOMETRY=ON",
]
if not args.no_avx2 and not "arm" in sys_platform:
cmake_args.append("-DGDX_AVX2=ON")
if args.python_path:
cmake_args.append(f"-DPython3_EXECUTABLE={args.python_path}")
if args.build_dist:
vcpkg.build_project_release(
os.path.abspath(args.source_dir),
triplet=triplet,
cmake_args=cmake_args,
build_name=args.build_dir,
)
else:
vcpkg.build_project(
os.path.abspath(args.source_dir),
triplet=triplet,
cmake_args=cmake_args,
build_name=args.build_dir,
run_tests_after_build=args.run_tests,
test_arguments=["--verbose"],
)
except KeyboardInterrupt:
print("\nInterrupted")
sys.exit(-1)
except RuntimeError as e:
print(e)
sys.exit(-1)