-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrebuild.py
More file actions
32 lines (22 loc) · 1.15 KB
/
rebuild.py
File metadata and controls
32 lines (22 loc) · 1.15 KB
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 os
import subprocess
import argparse
root_dir = os.path.dirname(os.path.abspath(__file__))
parser = argparse.ArgumentParser(description="Build and run tests for the project.")
parser.add_argument("--run-tests", action="store_true", help="Run tests after building the project.")
parser.add_argument("--preset", type=str, default="windows-release",
help="CMake configure preset to use (windows-release/linux-release/etc.)")
args = parser.parse_args()
preset = args.preset
# Configure using preset
print(f"Configuring with preset '{preset}'...")
subprocess.run(["cmake", "--preset", preset], cwd=root_dir, check=True)
# Figure out build dir from preset convention
build_dir = os.path.join(root_dir, "out", "build", preset)
print("Building the project...")
subprocess.run(["cmake", "--build", build_dir, "--config", "Release"], check=True)
# Build main executable (correct target name)
subprocess.run(["cmake", "--build", build_dir, "--target", "VulkanSceneRenderer", "--config", "Release"], check=True)
if args.run_tests:
subprocess.run(["ctest", "--test-dir", build_dir, "--output-on-failure"], check=True)
print("Rebuild complete.")