Reputation: 53
I was trying to run a program using intel compilers but while compiling the program it showed error. It was was due to cmake.
cmake -G "Visual Studio 17 2022" -A x64 -T "Intel(R) oneAPI DPC++ Compiler" ..
-- CMAKE_BUILD_TYPE is unset, defaulting to Release
-- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.25099.
CMake Error at CMakeLists.txt:81 (project):
Failed to run MSBuild command:
C:/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/amd64/MSBuild.exe
to get the value of VCTargetsPath:
MSBuild version 17.3.1+2badb37d1 for .NET Framework
Build started 9/2/2022 10:51:43 AM.
Project "C:\Users\mtc\source\repos\onednn\build\CMakeFiles\3.23.1\VCTargetsPath.vcxproj" on node 1 (default targets).
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(460,5): error MSB8020: The build tools for Intel(R) oneAPI DPC++ Compiler (Platform Toolset = 'Intel(R) oneAPI DPC++ Compiler') cannot be found.
To build using the Intel(R) oneAPI DPC++ Compiler build tools, please install Intel(R) oneAPI DPC++ Compiler build tools.
Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". [C:\Users\mtc\source\repos\onednn\build\CMakeFiles\3.23.1\VCTargetsPath.vcxproj]
Done Building Project "C:\Users\mtc\source\repos\onednn\build\CMakeFiles\3.23.1\VCTargetsPath.vcxproj" (default targets) -- FAILED
"C:\Users\mtc\source\repos\onednn\build\CMakeFiles\3.23.1\VCTargetsPath.vcxproj" (default target) (1) ->
(PrepareForBuild target) ->
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(460,5): error MSB8020: The build tools for Intel(R) oneAPI DPC++ Compiler (Platform Toolset = 'Intel(R) oneAPI DPC++ Compiler') cannot be found. To build using the Intel(R) oneAPI DPC++ Compiler build tools,
please install Intel(R) oneAPI DPC++ Compiler build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". [C:\Users\mtc\source\repos\onednn\build\CMakeFiles\3.23.1\VCTargetsPath.vcxproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.15
Exit code: 1
Upvotes: 1
Views: 1731
Reputation: 614
Ninja is the only CMake generator for Windows that works with the oneAPI DPC++ Compiler.
Please adhere to the instructions in the following link if you wish to utilise the Intel oneAPI DPC++ compiler: https://oneapi-src.github.io/oneDNN/dev_guide_build.html#id1
To use the Intel NextGen Compiler, could you please use the below command:
cmake -G ""Visual Studio 17 2022"" -T ""Intel C++ Compiler 2022"" ...
Upvotes: 2
Reputation: 65
There are a couple things that might be causing your problem.
C:\Program Files (x86)\Intel\oneAPI\setvars.bat
.find_package(IntelDPCPP REQUIRED)
.Also, once you are able to get your target to build, I recommend that you switch to using a CMakePresets.json
file to configure your CMake build. I have one that looks like this:
In this preset file, the cache variable INTEL_COMPILER
is used to turn on/off specific intel compiler flags in my CMakeLists.txt
such as /fp:precise
.
CMakePresets.json
{
"version": 3,
"cmakeMinimumRequired": {
"major": 3,
"minor": 22,
"patch": 2
},
"configurePresets": [
{
"name": "base",
"hidden": true,
"binaryDir": "${sourceDir}/_build/${presetName}"
},
{
"name": "Windows",
"hidden": true,
"inherits": [
"base"
],
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"vendor": {
"microsoft.com/VisualStudioSettings/CMake/1.0": {
"hostOS": "Windows"
}
}
},
{
"name": "Debug",
"hidden": true,
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "Release",
"hidden": true,
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "Intel - IDE",
"hidden": true,
"toolset": "Intel C++ Compiler 2022",
"cacheVariables": {
"INTEL_COMPILER": "ON"
}
},
{
"name": "Visual Studio 2022 - Intel",
"displayName": "Visual Studio 2022 using Intel compiler",
"inherits": [
"Windows",
"Intel - IDE"
],
"generator": "Visual Studio 17 2022"
}
],
"buildPresets": [
{
"name": "Windows",
"hidden": true,
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"vendor": {
"microsoft.com/VisualStudioSettings/CMake/1.0": {
"hostOS": "Windows"
}
}
},
{
"name": "Visual Studio 2022 - Intel",
"displayName": "Visual Studio 2022 using Intel compiler",
"inherits": [
"Windows"
],
"configurePreset": "Visual Studio 2022 - Intel"
}
]
}
Upvotes: 0