diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-04-11 18:40:18 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-04-11 18:40:18 +0100 |
commit | 4d569af26d3bab55e27b3bb9ada14ef088e23f35 (patch) | |
tree | 8e97a1ecbdda90dab8e3bbaf7c7285bed77dbc0c | |
parent | Split out the glsl embedding jam rules (diff) | |
download | ilt-4d569af26d3bab55e27b3bb9ada14ef088e23f35.tar.bz2 ilt-4d569af26d3bab55e27b3bb9ada14ef088e23f35.tar.xz ilt-4d569af26d3bab55e27b3bb9ada14ef088e23f35.zip |
Support m4 includes as a Jam scanner
-rw-r--r-- | glsl.jam | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -1,6 +1,7 @@ import type : register ; import type : type ; import generators : register-standard ; +import scanner : register ; type.register GL_VERTEX_SHADER : vs ; type.register GL_GEOMETRY_SHADER : gs ; @@ -10,10 +11,22 @@ generators.register-standard glsl.embed : GL_VERTEX_SHADER : CPP(vs-%) H(vs-%) ; generators.register-standard glsl.embed : GL_GEOMETRY_SHADER : CPP(gs-%) H(gs-%) ; generators.register-standard glsl.embed : GL_FRAGMENT_SHADER : CPP(fs-%) H(fs-%) ; +class m4-scanner : common-scanner { + rule pattern ( ) { + return "s?include\\(`([^']*)'\\)" ; + } +} + +scanner.register m4-scanner : include ; + +type.set-scanner GL_VERTEX_SHADER : m4-scanner ; +type.set-scanner GL_GEOMETRY_SHADER : m4-scanner ; +type.set-scanner GL_FRAGMENT_SHADER : m4-scanner ; + actions glsl.embed { - m4 -DNAME=$(2:B) -DTYPE=$(2:S) > $(1[2]) lib/embed-glsl.h.m4 - m4 -DSOURCE=$(2) -DNAME=$(2:B) -DTYPE=$(2:S) -DGLTYPE=$(OPTIONS) > $(1[1]) lib/embed-glsl.cpp.m4 + m4 -I$(2:D) -DNAME=$(2:B) -DTYPE=$(2:S) > $(1[2]) lib/embed-glsl.h.m4 + m4 -I$(2:D) -DSOURCE=$(2) -DNAME=$(2:B) -DTYPE=$(2:S) -DGLTYPE=$(OPTIONS) > $(1[1]) lib/embed-glsl.cpp.m4 } rule glsl.embed ( targets * : sources * : properties * ) |