-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathengine.py
More file actions
67 lines (52 loc) · 1.88 KB
/
Copy pathengine.py
File metadata and controls
67 lines (52 loc) · 1.88 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import jmake
import argparse
import subprocess
from pathlib import Path
jmake.setupenv()
workspace = jmake.Workspace("engine")
workspace.lang = 'cpp20'
engine = jmake.Project("engine", jmake.Target.EXECUTABLE)
files = jmake.glob('src', '**/*.cpp')
engine.add(jmake.fullpath(files))
modules = jmake.glob('src', '**/*.hpp')
engine.add_module(jmake.fullpath(modules), True)
engine.include(jmake.fullpath('src'))
debug = engine.filter("debug")
debug["debug"] = True
test = jmake.Project("test", jmake.Target.EXECUTABLE)
files.remove(jmake.fullpath('src/main.cpp')[0])
files = files + jmake.glob('test', '**/*.cpp') + jmake.glob('test', '**/*.h')
test.add(jmake.fullpath(files))
test.add_module(jmake.fullpath(modules))
test.include(jmake.fullpath('src'))
debug = test.filter("debug")
debug["debug"] = True
host = jmake.Env()
if host.os == jmake.Platform.WIN32:
engine.define('JOLLY_WIN32', 1)
engine.define('WIN32_LEAN_AND_MEAN', 1)
test.define('JOLLY_WIN32', 1)
test.define('WIN32_LEAN_AND_MEAN', 1)
vulkan = jmake.builtin('vulkan')
spirv_reflect = jmake.package("spirv_reflect", "https://github.com/DanDanCool/SPIRV-Reflect")
engine.depend(vulkan)
engine.depend(spirv_reflect)
test.depend(vulkan)
test.depend(spirv_reflect)
workspace.add(engine)
workspace.add(test)
def compileshaders(workspace, args):
p = Path('assets/shaders')
for shader in p.glob('*'):
if shader.suffix not in [ '.vert', '.frag' ]:
continue
print(f"compiling shader {str(shader)}...")
cmd = [ 'glslc', str(shader), '-o', str(p / f"{shader.name}.spv") ]
res = subprocess.run(cmd, capture_output=True, text=True)
print(res.stdout)
print(res.stderr)
parser = argparse.ArgumentParser()
subparser = parser.add_subparsers()
shader_parser = subparser.add_parser('shader')
shader_parser.set_defaults(func=compileshaders)
jmake.generate(workspace, parser, subparser)