This Continuation Using #include to Download OpenCL Code
I noticed that when you use the method described by grrussel (and used by Bullet Physics), the created line has all the lines of a new line (comments also seem to be deprived, but I'm not too worried about that), for the most part now this is fine if the included opencl code does not have any preprocessor definitions in it, but if the code is not compiled with the OpenCL compiler.
Is there a way to get #includeto save new lines there, or is there a better way to paste opencl code into my executable file (other than copying the line to the cpp file and placing quotes around everything)
I tested this in Visual Studio 2010, I'm not sure if other compilers show the same behavior. I would prefer a method that does not require any external tools and works with various compilers / platforms.
The copied code from another answer:
In source C ++ / C
#define MSTRINGIFY(A)
char* stringifiedSourceCL =
#include "VectorAddKernels.cl"
In OpenCL source
MSTRINGIFY(
__kernel void VectorAdd(__global float8* c)
{
return;
}
);
source
share