2014-12-24 23:15 GMT+04:00 Pavan Yalamanchili
I am a bit late to the party, but we faced the same problem with our library, ArrayFire.
The solution we came up with is the following.
- The kernels are written as .cl files and are part of the repository. - During the build process, the kernels in .cl files are converted to strings in *new* .hpp files. - The auto-generated kernel headers are the files that are included when trying to compile the said kernel.
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). /// import.pp #define TO_STRING(...) \ #__VA_ARGS__ /// end_import.pp #undef TO_STRING #undef IMPORT_AS Now you'll need to write kernels like this: /// kernel.cl #ifdef IMPORT_AS char IMPORT_AS[] = TO_STRING( #endif // Code goes here #ifdef IMPORT_AS ); // not sure that this will work #endif 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" -- Best regards, Antony Polukhin