I also had this issue. In some cases resources - is is bad idea, since e.g. you will need different implementations for windows/Linux.
I have more good solution.
You can do like this:
unsigned char openClCode[] =
{0x23,0x64,0x65,0x66,0x69,0x6E,0x65,0x20,0x55,0x53,
0x23,0x64,0x65,0x66,0x69,0x6E,0x65,0x20,0x55,0x53,
...
};
How I know In this case you do not have limits. I just tried to make file with code about 500K. So output header file where this variable located I have about 3 Mb.
You can make small program for convert your strings to header's with "char array's". I uses this good approach for e.g. save my OpenCL code to my applications without any resources and without any additionals files where my OpenCL code located. I just uses C-arrays in C++ program for save my code to my application.
So in my CL application I have like this:
__kernel void TestMul(__global const float* a, __global const float* b, __global float* c, int iNumElements)
{
and in my header file this converted to like this:
#pragma once
namespace Scl
{
const char g_clCode_ProgTestComonent[] =
{
0x5F, 0x5F, 0x6B, 0x65, 0x72, 0x6E, 0x65, 0x6C,
0x20, 0x76, 0x6F, 0x69, 0x64, 0x20, 0x54, 0x65,
0x73, 0x74, 0x4D, 0x75, 0x6C, 0x28, 0x5F, 0x5F,
0x67, 0x6C, 0x6F, 0x62, 0x61, 0x6C, 0x20, 0x63,
0x6F, 0x6E, 0x73, 0x74, 0x20, 0x66, 0x6C, 0x6F,
...
};
}