Can't use double quotes specifying compile include directory flag
Submitted by Andrew
Assigned to Xiuli Pan
Description
When specifying the include paths in the program build options, double quotes can't be used to escape special characters (for example spaces). It doesn't matter if the specified path is relative or absolute.
Example snippet:
cl_device_id dev; // some device cl_context context; // some context cl_program prog = clCreateProgramWithSource(context, 1, &src, &len, &err) const char* options = "-I"/home/user/dir/""; const char* src = "#include <a_file.cl>\n"; cl_int err = clBuildProgram(prog, 1, &dev, options, nullptr, nullptr); if(err != CL_SUCCESS) { size_t len = 0; clGetProgramBuildInfo(prog, dev, CL_PROGRAM_BUILD_LOG, 0, nullptr, &len); char* buf = new char[len]; clGetProgramBuildInfo(prog, dev, CL_PROGRAM_BUILD_LOG, len, log, nullptr); printf(log); }
Assume the file "/home/user/dir/a_file.cl" exists and is a valid OpenCL C source file. For reference, this example builds and runs on AMD's APP SDK implementation and NVidia's implementation, while interestingly it does not build on Beignet and Intel's proprietary OpenCL SDK.