-
Notifications
You must be signed in to change notification settings - Fork 85
Expand file tree
/
Copy pathbuild_gpudrive.py
More file actions
32 lines (24 loc) · 882 Bytes
/
build_gpudrive.py
File metadata and controls
32 lines (24 loc) · 882 Bytes
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
import subprocess
import os
import logging
logging.basicConfig(level=logging.INFO)
def main():
# Cloning the repository, although typically you would not do this in the build step
# as the code should already be present. Including it just for completeness.
subprocess.check_call(
["git", "submodule", "update", "--init", "--recursive", "--force"]
)
# Create and enter the build directory
if not os.path.exists("build"):
os.mkdir("build")
os.chdir("build")
# Run CMake and Make
subprocess.check_call(["cmake", "..", "-DCMAKE_BUILD_TYPE=Release"])
subprocess.check_call(
["make", f"-j{os.cpu_count()}"]
) # Utilize all available cores
# Going back to the root directory
os.chdir("..")
if __name__ == "__main__":
logging.info("Building the C++ code and installing the Python package")
main()