-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathbuild.py
executable file
·49 lines (39 loc) · 1006 Bytes
/
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
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env python3
import os
import sys
from glob import glob
from subprocess import check_call
filename = "cheMVP.pro"
N_PROCS = os.cpu_count()
os.makedirs("build", exist_ok=True)
os.chdir("build")
sections = {
"SOURCES": "cpp",
"HEADERS": "h",
"RESOURCES": "qrc",
}
out = "\n".join(
f"{section} = " + " \\ \n".join(glob(f"../src/*.{ext}"))
for section, ext in sections.items()
)
out += """
CONFIG += debug_and_release static
QT += svg printsupport
QMAKE_CXXFLAGS_DEBUG = " -O0 -g"
macx{
ICON = ../images/icon.icns
CONFIG += x86
LIBS += -llapack -lblas
QMAKE_INFO_PLIST = ../chemvp.plist
}
win32{
RC_FILE = ../images/icon.rc
CONFIG -= debug
QMAKE_CXXFLAGS_RELEASE -= -mthreads
QMAKE_LFLAGS_RELEASE -= -mthreads
}"""
with open(filename, "w") as f:
f.write(out)
qmake_flags = "-spec macx-g++" if len(sys.argv) > 1 and sys.argv[1] == "mac" else ""
check_call(f"qmake {qmake_flags} {filename}".split())
check_call(f"time nice make -j {N_PROCS}".split())