Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting "cannot open source file "CL/cl.h" after the SDK installation #53

Open
irimitladder opened this issue Sep 15, 2022 · 1 comment

Comments

@irimitladder
Copy link

I've installed this SDK on a Windows 11 x64 machine- well, actually, I'm not that good with CMake and stuff, but these two commands were executed successfully:

cmake -A x64 -B ./OpenCL-SDK/build -S ./OpenCL-SDK
cmake --build ./OpenCL-SDK/build --target install

However, I'm still getting the cannot open source file "CL/cl.h" error in Visual Studio Community 2022 for

#ifdef __APPLE__
#include <OpenCL/opencl.h>
#else
#include <CL/cl.h>
#endif

I appreciate any help with my issue, and thank you in advance.

@MathiasMagnus
Copy link
Collaborator

I have to assume a lot of things, because you're omitting some info on how you consume the result of the build.

  • The --target install will install the SDK to some place, I believe by default under Program Files so you were likely also prompted for admin priviliges.
  • Because you didn't specify a build type, CMake by default builds Debug, so you have a Debug builds of everything. (Which may be what you want, initially while developing it's surely the more useful build type, before wanting to benchmark or release when Release build type will be needed.)
    • We recently merged the ability to install Debug and Release builds on top of each other, allowing ton consume both build types on Windows from a single install location.
  • When using the SDK, you have to specify where you installed the SDK. This is typically done using CMAKE_PREFIX_PATH by specifying -D CMAKE_PREFIX_PATH=<root_of_SDK_install> while configuring your project using the SDK.
  • Please give the Getting Started on Windows from the OpenCL-Guide where you'll find Windows specific information as well as generic info on CMake support for consuming the SDK.

What we're going to put into this quarterly release of the OpenCL ecosystem (including the SDK) will look something like this:

cmake -G "Visual Studio 17 2022" -A x64 -T v143 -D OPENCL_SDK_BUILD_SAMPLES=OFF -S <source_root> -B <build_root>
cmake --build <build_root> --config Debug
cmake --build <build_root> --config Release
cmake --install <build_root> --config Debug --prefix <install_root>
cmake --install <build_root> --config Release --prefix <install_root>

and then package it up using CPack.

On the consuming side, it's:

cmake -G "Visual Studio 17 2022" -A x64 -T v143 -D CMAKE_PREFIX_PATH=<opencl_sdk_install_root> -S <my_project_source_root> -B <my_project_build_root>

Let us know if this helped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants