Issues with 2.3 on Windows 10 x64 - compute++ unusable

Hi,

I had to make a few changes to get the CMake example to find compute++:

  • add cmake_minimum_version and include(FindComputeCpp) (and add some CMAKE_MODULE_PATH)
  • in FindComputeCpp.cmake, fix ENV{COMPUTECPP_DIR} to ENV{COMPUTECPP_ROOT_DIR} to make what the installer set

However, I get:

C:\src\computecpp-sdk\samples\build>cmake …
– Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.19041.
– platform - your system can support ComputeCpp
– Found ComputeCpp: C:/Program Files/Codeplay/ComputeCpp (found version “CE 2.3.0 2020/11/19”)
– compute++ flags - -O2;-mllvm;-inline-threshold=1000;-intelspirmetadata;-sycl-target;spir64;-DSYCL_LANGUAGE_VERSION=2017
CMake Error at /src/computecpp-sdk/cmake/Modules/ComputeCppCompilerChecks.cmake:52 (message):
compute++ cannot consume hosted STL headers. This means that compute++
can’t compile a simple program in this platform and will fail when used in
this system.
Call Stack (most recent call first):
/src/computecpp-sdk/cmake/Modules/FindComputeCpp.cmake:160 (include)
CMakeLists.txt:5 (include)

This is with the latest non-preview Visual Studio Community 2019, 16.8.3, and in my INCLUDE I have:

  • C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include
  • C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared (etc)

Is there a workaround?

Yes, there is.

The problem we have so far is that clang 8, which is the version our compiler is based on as of today, is not able to parse MSVC 14.27 (or newer) headers. That’s why you get the message compute++ cannot consume hosted STL headers.

To work around this you need to use MSVC 14.26 (or older) until we update compute++ to clang 10. There are a couple of options on how to do this. See Side-by-side Minor Version MSVC Toolsets in Visual Studio 2019 | C++ Team Blog (microsoft.com).

With that said, the easiest solution so far I’ve encountered is to use the Visual Studio CMake Integration. Just open your project using “Open Folder” in Visual Studio and add

"environments": [ { "VCToolsVersion": "14.26" } ],

To your CMakeSettings.json. This will force the use of MSVC 14.26.