-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsconstruct.py
34 lines (29 loc) · 1.07 KB
/
sconstruct.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
import glob
import os
cwd = GetLaunchDir()
root = os.getcwd()
testexe = os.path.join(cwd, 'tests')
testcpp = os.path.join(cwd, 'test.cpp')
with open(testcpp, 'w') as file:
includes = [
*glob.glob(os.path.join(cwd, '**/*_specialization.hpp'), recursive=True),
*glob.glob(os.path.join(cwd, '**/*_test.cpp'), recursive=True),
]
for include in includes:
localized = include.replace(cwd, '.')
file.write(f'#include "{localized}"\n')
print(
f'''
Building executable, "tests", under "{cwd}"
from newly created test.cpp file under "{cwd}"
that includes only *_test.cpp files under "{cwd}"
using sconstruct.py under "{root}".
''')
environment = Environment(
CCFLAGS="-std=c++20 -Wall -Werror -pedantic-errors -rdynamic -g -D GLM_FORCE_SWIZZLE",
CPPPATH=[os.path.join(root,path) for path in 'inc lib src sketch'.split()],
LIBS='glfw GL GLEW'.split(),
)
executable = environment.Program(target=testexe, source=testcpp)
# works on some linux distros, but doesn't work on Ubuntu
# environment.AddPostAction(executable, testexe.replace(cwd,'.'))