-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_tests.py
53 lines (38 loc) · 1.44 KB
/
build_tests.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
50
51
52
53
import os
from sys import platform
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-r", "--release", help="Generate release build (debug by default).", action="store_true")
args = parser.parse_args()
build_type = 'Release' if args.release else 'Debug'
source = os.path.dirname(os.path.realpath(__file__)) + '/tests'
def create_symlink(src, dst):
# create all parent directories of the symlink one
parent_dir = os.path.dirname(dst)
os.makedirs(parent_dir, exist_ok=True)
try:
os.symlink(src, dst)
except:
pass
def build(source, build_type, symlinks = [], symlink_pairs = []):
build_dir = '../build-tests/' + build_type + '/'
# create build directory
os.makedirs(build_dir, exist_ok=True)
os.chdir(build_dir)
# symlinks
for path in symlinks:
create_symlink(source + '/' + path, './' + path)
for src_path, dst_path in symlink_pairs:
create_symlink(source + '/' + src_path, './' + dst_path)
# conan
os.system('conan install "' + source + '/" --build=outdated -s arch=x86_64 -s build_type=' + build_type)
# choose premake generator based on OS
os.chdir(source)
def premake_generate(generator):
os.system('premake5 ' + generator + ' --location=../"' + build_dir + '"')
if platform == 'win32':
premake_generate('vs2019')
else:
premake_generate('gmake2')
premake_generate('vscode')
build(source, build_type)