<HTML>
<HEAD>
<TITLE>Converting a OpenCL program into a C++ header?</TITLE>
</HEAD>
<BODY>
<FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Hi,<BR>
<BR>
We would like to convert an OpenCL program written in a separate file to a C++ header (essentially a long string).<BR>
<BR>
For example, if my OpenCL program is in the file Square.cl<BR>
<BR>
__kernel square( <BR>
__global float* input, <BR>
__global float* output, <BR>
const unsigned int count) <BR>
{ <BR>
int i = get_global_id(0); <BR>
if(i < count) <BR>
output[i] = input[i] * input[i]; <BR>
} <BR>
<BR>
I’d like to turn it into something like this in Square.h:<BR>
<BR>
const char *KernelSource = "\n" \<BR>
"__kernel square( \n" \<BR>
" __global float* input, \n" \<BR>
" __global float* output, \n" \<BR>
" const unsigned int count) \n" \<BR>
"{ \n" \<BR>
" int i = get_global_id(0); \n" \<BR>
" if(i < count) \n" \<BR>
" output[i] = input[i] * input[i]; \n" \<BR>
"} \n" \<BR>
"\n";<BR>
<BR>
So that my OpenCL code can be directly compiled into my executable. This is also useful for OpenGL shaders.<BR>
<BR>
The question: is this something that CMake could do? If so, any examples where to begin looking?<BR>
<BR>
Thanks,<BR>
-dan<BR>
-- <BR>
<B>Daniel Blezek, PhD<BR>
</B>Medical Imaging Informatics Innovation Center<BR>
<BR>
P 127 or (77) 8 8886<BR>
T 507 538 8886<BR>
E <a href="blezek.daniel@mayo.edu">blezek.daniel@mayo.edu</a><BR>
<BR>
Mayo Clinic<BR>
200 First St. S.W.<BR>
Harwick SL-44<BR>
Rochester, MN 55905<BR>
mayoclinic.org<BR>
<BR>
</SPAN></FONT>
</BODY>
</HTML>