File: winbuild.py

package info (click to toggle)
veryfasttree 4.0.4%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,308 kB
  • sloc: cpp: 7,403; python: 209; sh: 38; makefile: 36
file content (38 lines) | stat: -rw-r--r-- 1,158 bytes parent folder | download
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
import os
import subprocess
import shutil
import sys

binary = " VeryFastTree"

binaries = {
    "OpenMP": [],
    "OpenMP-AVX2": ["-DUSE_AVX2=ON"],
    "OpenMP-AVX512": ["-DUSE_AVX512=ON"],
}


def main():
    version = sys.argv[1]
    for name, options in binaries.items():
        shutil.rmtree("win-build", ignore_errors=True)
        shutil.copytree(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "win-build")
        os.chdir("win-build")
        subprocess.call(["cmake", "."] + options)
        subprocess.call(["cmake", "--build", "."])
        os.chdir("..")
        os.mkdir("win-build/release")
        for file in os.listdir("win-build/Debug/"):
            if file.endswith(".exe"):
                shutil.copy("win-build/Debug/" + file, "win-build/release/")
        shutil.copy("README.md", "win-build/release")
        shutil.copy("LICENSE", "win-build/release")
        shutil.make_archive(binary + version + "Win64-" + name, 'zip', "win-build/release")
        shutil.rmtree("win-build", ignore_errors=True)


if __name__ == "__main__":
    if len(sys.argv) < 2:
        print("version required")
        exit(-1)
    main()