On Thu, Dec 25, 2014 at 1:58 PM, Antony Polukhin
There is a possible hack for that case! You'll need two helper header files `import.pp` and `end_import.pp`. Something like the following could work (not tested).
[snip]
That's it. Now if you need that kernel as a string, you just write the following:
#define IMPORT_AS variable_name #include "import.pp" #include "kernel.cl" #include "end_import.pp"
I think raw string literals could make it cleaner: #define BEGIN_CL "opencl( #define END_CL )opencl" const char cl_program[] = #include "kernel.cl" // In kernel.cl: BEGIN_CL <code here> END_CL I wonder how debugging goes in OpenCL though. If the kernel does not compile or is not working, you probably get pointers to the kernel string, not the C++ source. Is there a convenient way to translate between the two?