Showing results for 
Search instead for 
Did you mean: 

Why does the post-Build event not pick up the OpenCL files where they have been specified

I have my OpenCL kernel source files in a separate directory ("cl") on my file system (Windows 7 machine).

This is no different from having my C++ source files available in yet another directory ("src") on my file system.

Adding them through "Solution:Pop Up Menu>Add Existing Item" puts the files in the respective "OpenCL Files" and "Source Files" container, as expected.

However, the build will fail with an error:

The system cannot find the file specified.

This is because the "Solution:Pop Up Menu>Properties:Configuration Properties:Build Events:Post-Build Event" simply states:

copy "*.cl" "$(OutDir)\"

I would expect the Post-Build Event to actually check the properties of my OpenCL kernel files, to see where they really are (they are not in the solution directory!!!).

So as a work around, I end up just manually putting a copy of my kernel files in the solution directory. I understand that the kernel files need to be copied to the output directory, so that my actual program can find them, to compile inline. I don't understand why the event just doesn't find them for me? 

Am I missing something?

0 Kudos
2 Replies

I agree, this is annoying. You could modify post-build event, so it will find your cl files as follows:

copy "cl\*.cl" "$(OutDir)\" 

0 Kudos

That solution is beautiful in its' simplicity, Robert, Thank You.

I actually modified it as follows now:

copy "$(SolutionDir)\..\cl\*.cl" "$(SolutionDir)"

1. I don't want to make assumptions about where the copy is invoked, so I provide a known anchor point.

2. The host application will actually be invoked from the $(SolutionDir). Since my application reads "local files" for the kernel (which I assume most programmers would do), I have to make sure that my kernel files end up there as well...

As I indicated in my initial inquiry, I really don't see why the Intel SDK for OpenCL doesn't do this in the first place...

Thank you again for the hint!

0 Kudos