Compile Intel HLS project with CMake
Hello Intel Community,
I am having troubles with CMake using MVSC compiler directives when trying to compile with i++. I am compiling on Windows with Visual Studios 17 installed.
I am using the following command to build and compile.
HLS> cmake -G "Unix Makefiles" -DCMAKE_CXX_COMPILER=i++ ..
-- The CXX compiler identification is IntelLLVM 2021.1.0 with GNU-like command-line
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/hunto_efxy22i/jupyterProjects/HUBERT/build
HLS> cmake --build . --config Release
Scanning dependencies of target tensors
[ 25%] Building CXX object src/CMakeFiles/tensors.dir/tensors.cpp.obj
aocl-clang: error: no such file or directory: '/nologo'
aocl-clang: error: no such file or directory: '/TP'
aocl-clang: error: no such file or directory: '/FdCMakeFiles/tensors.dir/tensors.pdb'
HLS x86-64 compile FAILED.
make.exe[2]: *** [src/CMakeFiles/tensors.dir/tensors.cpp.obj] Error 1
make.exe[1]: *** [src/CMakeFiles/tensors.dir/all] Error 2
make.exe: *** [all] Error 2
I use Unix Makefiles as when I compile with Visual Studios as my generator, I get this output:
HLS> cmake -G "Visual Studio 15 2017 Win64" -D CMAKE_CXX_COMPILER=D:/Applications/intel_quartus/21.1/hls/bin/i++.exe ..
-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.19042.
-- The CXX compiler identification is unknown
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/hunto_efxy22i/jupyterProjects/HUBERT/build
HLS> cmake --build . --config Release
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Checking Build System
Building Custom Rule C:/Users/hunto_efxy22i/jupyterProjects/HUBERT/src/CMakeLists.txt
cl : Command line warning D9002: ignoring unknown option '-march=x86-64' [C:\Users\hunto_efxy22i\jupyterProjects\HUBERT
\build\src\tensors.vcxproj]
Which suggests that the CMake build system isnt using i++ at all. Since it fails to detect the compiler, I would rather stick with Unix makefiles.
I have attached the outermost CMakeLists.txt. I have skipped the compiler check as it fails for the same reason that it fails now, a bunch of unknown options are passed as it seems. I have also done by best to get rid of the irrelevant MSVC compiler options by setting the flags manually, however that only seems to get rid of a few.
Finally, my Cmake error file output.
I am hoping someone can help
1. Get rid of the MSVC compiler flags
2. Fix CMake not detecting the ABI so that it actually passes the correct flags by default.
Thanks,
Messn036