forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathproj_bdo_llvm_build.py
executable file
·36 lines (26 loc) · 1.14 KB
/
proj_bdo_llvm_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
#!/usr/bin/env python3
import sys
import subprocess
CMAKE_CONFIG_FLAGS = [
"-DLLVM_ENABLE_PROJECTS='clang;clang-tools-extra;lldb;lld'",
"-DLLVM_TARGETS_TO_BUILD='AArch64;ARM;X86'",
"-DLLVM_TARGET_ARCH='AArch64'",
"-DLLVM_DEFAULT_TARGET_TRIPLE='aarch64-unknown-linux-gnu'",
"-DCMAKE_BUILD_TYPE='RelWithDebInfo'", "-DLLVM_ENABLE_ASSERTIONS='ON'",
"-DCMAKE_EXPORT_COMPILE_COMMANDS='ON'", "-DLLVM_CCACHE_BUILD='ON'",
"-DLLVM_ENABLE_LLD='ON'", "-DCMAKE_C_COMPILER='clang'",
"-DCMAKE_CXX_COMPILER='clang++'", "-DLLVM_ENABLE_ZLIB='ON'"]
def run(args, stderr=None, stdout=None, shell=False, executable=None):
print("[ " + " ".join(args) + " ]\n")
subprocess.run(args=args, stderr=stderr, stdout=stdout,
shell=shell, executable=executable)
def configure_llvm():
run(["cmake", "-G", "Ninja", "-S", "./llvm", "-B", "./build"] + CMAKE_CONFIG_FLAGS)
def build_llvm(target):
run(["cmake", "--build", "./build", "--target", target, "-j", "128"])
if __name__ == "__main__":
match sys.argv[1]:
case "config":
configure_llvm()
case "build":
build_llvm(sys.argv[2])