事实证明,我-g
在错误的地方添加了标志。
ISPC 示例包括一个“主”CMake 文件,该文件具有许多常用选项,称为AddISPCExample.cmake
. 该文件针对每个示例执行。每个示例还包括其自己CMakeLists.txt
的选项。我最初AddISPCExample.cmake
通过添加以下行进行修改:
# add debug flag
target_compile_options(${example_NAME} PRIVATE -g)
在更仔细地检查构建输出之后,事实证明这导致该-g
标志被添加到 MSVC 编译器的标志中simple.exe
([2/3] 命令),而不是 ispc 编译器的标志simple.ispc
([1/3] 命令)以下):
>------ Rebuild started: Project: CMakeLists, Configuration: Debug ------
Build started 14-Nov-19 6:40:58.
RunExternalTool:
[1/3] cmd.exe /C "cd /D "C:\Users\Daniel\CMakeBuilds\7d280c73-3384-fd31-a5a6-63248b2e8dd4\build\x64-Debug (default)\simple" && C:\bin\ispc.exe C:/Users/Daniel/Downloads/ispc-v1.12.0-windows/examples/simple/simple.ispc -O2 --target=sse2 --arch=x86-64 -h "C:/Users/Daniel/CMakeBuilds/7d280c73-3384-fd31-a5a6-63248b2e8dd4/build/x64-Debug (default)/simple/simple_ispc.h" -o "C:/Users/Daniel/CMakeBuilds/7d280c73-3384-fd31-a5a6-63248b2e8dd4/build/x64-Debug (default)/simple/simple_ispc.obj""
[2/3] C:\PROGRA~2\MICROS~1\2017\ENTERP~1\VC\Tools\MSVC\1416~1.270\bin\HostX64\x64\cl.exe /nologo /TP -Isimple /DWIN32 /D_WINDOWS /W3 /GR /EHsc /MDd /Zi /Ob0 /Od /RTC1 /fp:fast /Oi -g /showIncludes /Fosimple\CMakeFiles\simple.dir\simple.cpp.obj /Fdsimple\CMakeFiles\simple.dir\ /FS -c C:\Users\Daniel\Downloads\ispc-v1.12.0-windows\examples\simple\simple.cpp
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\cl : Command line warning D9002: ignoring unknown option '-g'
[3/3] cmd.exe /C "cd . && "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E vs_link_exe --intdir=simple\CMakeFiles\simple.dir --manifests -- C:\PROGRA~2\MICROS~1\2017\ENTERP~1\VC\Tools\MSVC\1416~1.270\bin\Hostx64\x64\link.exe /nologo simple\simple_ispc.obj simple\CMakeFiles\simple.dir\simple.cpp.obj /out:simple\simple.exe /implib:simple\simple.lib /pdb:simple\simple.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
LINK : simple\simple.exe not found or not built by the last incremental link; performing full link
相反,我通过添加标志修改了简单示例:CMakeLists.txt
-g
set (ISPC_FLAGS -O2 -g)
这会导致-g
标志被传递到 ispc 编译器的命令行(在下面的 [2/3] 中):
>------ Build started: Project: CMakeLists, Configuration: Debug ------
Build started 14-Nov-19 6:44:17.
RunExternalTool:
[1/3] cmd.exe /C "cd /D "C:\Users\Daniel\CMakeBuilds\7d280c73-3384-fd31-a5a6-63248b2e8dd4\build\x64-Debug (default)\simple" && C:\bin\ispc.exe C:/Users/Daniel/Downloads/ispc-v1.12.0-windows/examples/simple/simple.ispc -O2 -g --target=sse2 --arch=x86-64 -h "C:/Users/Daniel/CMakeBuilds/7d280c73-3384-fd31-a5a6-63248b2e8dd4/build/x64-Debug (default)/simple/simple_ispc.h" -o "C:/Users/Daniel/CMakeBuilds/7d280c73-3384-fd31-a5a6-63248b2e8dd4/build/x64-Debug (default)/simple/simple_ispc.obj""
[2/3] C:\PROGRA~2\MICROS~1\2017\ENTERP~1\VC\Tools\MSVC\1416~1.270\bin\HostX64\x64\cl.exe /nologo /TP -Isimple /DWIN32 /D_WINDOWS /W3 /GR /EHsc /MDd /Zi /Ob0 /Od /RTC1 /fp:fast /Oi /showIncludes /Fosimple\CMakeFiles\simple.dir\simple.cpp.obj /Fdsimple\CMakeFiles\simple.dir\ /FS -c C:\Users\Daniel\Downloads\ispc-v1.12.0-windows\examples\simple\simple.cpp
[3/3] cmd.exe /C "cd . && "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E vs_link_exe --intdir=simple\CMakeFiles\simple.dir --manifests -- C:\PROGRA~2\MICROS~1\2017\ENTERP~1\VC\Tools\MSVC\1416~1.270\bin\Hostx64\x64\link.exe /nologo simple\simple_ispc.obj simple\CMakeFiles\simple.dir\simple.cpp.obj /out:simple\simple.exe /implib:simple\simple.lib /pdb:simple\simple.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
LINK : simple\simple.exe not found or not built by the last incremental link; performing full link
Build succeeded.
现在,设置断点并进入 ispc 文件是可行的(尽管 UI 有点不稳定):