-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_binary.py
More file actions
48 lines (38 loc) · 1.02 KB
/
build_binary.py
File metadata and controls
48 lines (38 loc) · 1.02 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python3
import subprocess
import sys
import os
import glob
import shutil
def main():
# Build with cmake
subprocess.run(
[
"cmake",
"-B",
"build",
"-S",
"cpp",
"-DRUNKMC_VERSION=0.1.1",
"-DCMAKE_POLICY_VERSION_MINIMUM=3.5",
],
check=True,
)
subprocess.run(["cmake", "--build", "build"], check=True)
# Create destination directory
os.makedirs("runkmc/build", exist_ok=True)
# Find the binary (Windows puts it in Debug/ subfolder)
if sys.platform == "win32":
pattern = "build/**/RunKMC.exe"
else:
pattern = "build/**/RunKMC"
matches = glob.glob(pattern, recursive=True)
if not matches:
raise FileNotFoundError(f"Could not find binary matching {pattern}")
src = matches[0]
print(f"Found binary: {src}")
# Copy to destination
shutil.copy2(src, "runkmc/build/")
print(f"Copied to runkmc/build/")
if __name__ == "__main__":
main()