From e2edd9f141699ce4be1664f590438369db9573e6 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 11 Apr 2023 18:36:41 +0100 Subject: Split out the glsl embedding jam rules --- glsl.jam | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 glsl.jam (limited to 'glsl.jam') diff --git a/glsl.jam b/glsl.jam new file mode 100644 index 0000000..03e93e9 --- /dev/null +++ b/glsl.jam @@ -0,0 +1,23 @@ +import type : register ; +import type : type ; +import generators : register-standard ; + +type.register GL_VERTEX_SHADER : vs ; +type.register GL_GEOMETRY_SHADER : gs ; +type.register GL_FRAGMENT_SHADER : fs ; + +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-%) ; + +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 +} + +rule glsl.embed ( targets * : sources * : properties * ) +{ + DEPENDS $(targets) : lib/embed-glsl.h.m4 lib/embed-glsl.cpp.m4 ; + OPTIONS on $(targets) = [ type.type $(sources) ] ; +} -- cgit v1.2.3 From 4d569af26d3bab55e27b3bb9ada14ef088e23f35 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 11 Apr 2023 18:40:18 +0100 Subject: Support m4 includes as a Jam scanner --- glsl.jam | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'glsl.jam') diff --git a/glsl.jam b/glsl.jam index 03e93e9..87dee61 100644 --- a/glsl.jam +++ b/glsl.jam @@ -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 * ) -- cgit v1.2.3