forked from mcpp-community/mcpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.mcpp
More file actions
27 lines (25 loc) · 1.08 KB
/
Copy pathbuild.mcpp
File metadata and controls
27 lines (25 loc) · 1.08 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
import std;
import mcpp;
import mcpp.plugins;
import mcpp.rules.spirv;
// THE SHADERS ARE REACHED BY IMPORTING A MODULE.
//
// `src/vulkan/render.cpp` opened with `#include "triangle_vert.h"` and
// `#include "triangle_frag.h"` -- two names no line in this project produced,
// and which no reader could derive without opening the rule. One import
// replaces both, and the accessors are named after the files:
// `shaders/triangle.vert` becomes `offscreen::shaders::triangle_vert()`.
//
// `module_name` is stated rather than defaulted so the module root matches the
// project rather than its directory: the package is `offscreen-triangle`, and
// the default would be `offscreen_triangle.shaders`.
int main() {
mcpp::rerun_if_changed_glob("shaders/**/*.vert");
mcpp::rerun_if_changed_glob("shaders/**/*.frag");
mcpp::rerun_if_changed_glob("shaders/**/*.glsl");
mcpp::rules::spirv::options opt;
opt.includes = { "shaders" };
opt.surface = mcpp::plugins::surface::kind::module_;
opt.module_name = "offscreen.shaders";
return mcpp::rules::spirv::compile(opt) ? 0 : 1;
}