So I would like to have a file that I can conditionally include as either code or a string. Like this:
#define something
#include "myfile.inc"
#undef something
const char myfileasastring =
#include "myfile.inc"
myfile.inc would be simple code like this:
something // anything extra here is fine as long as it goes away in the code include case
int myfunc() { return 23; }
Is this possible? I tried having #define something R("mystring and start myfile with it but that does not seem to work.
My specific use case for this is a GLSL shader that, when running under GL I need as a string to pass to the GL driver but when running it in software emulation I want to compile it as CPP code.
I would love to have the same file for both cases. I know many workarounds on the project/make/build level, and even just cut and paste is not terrible, but it would be neat to have a portable compiler level way of doing this.
Aucun commentaire:
Enregistrer un commentaire