Closed woshiwstt50123 closed 1 year ago
Bot detected the issue body's language is not English, translate it automatically.
Title: add_sysincludedirs is invalid
手动传下 --lsp=clangd
xmake project -k compile_commands --lsp=clangd
Bot detected the issue body's language is not English, translate it automatically.
Manually pass
--lsp=clangd
xmake project -k compile_commands --lsp=clangd
{ "directory": "C:\Users\TangTao\MyWork\embedded_work\gd32w5\test1", "arguments": ["C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\bin\HostX64\x64\cl.exe", "/c", "/nologo", "/O2", "/fp:fast", "/Iinc", "/EHsc", "/IGD32W51x_Firmware_Library_V1.0.2\Firmware\CMSIS", "/IGD32W51x_Firmware_Library_V1.0.2\Firmware\CMSIS\GD\GD32W51x\Include", "/IGD32W51x_Firmware_Library_V1.0.2\Firmware\GD32W51x_standard_peripheral\Include", "/IGD32W51x_Firmware_Library_V1.0.2\Utilities", "/IC:\Users\TangTao\AppData\Local\Arm\Packs\ARM\CMSIS\5.9.0\CMSIS\Core\Include", "/DNDEBUG", "/Fobuild\.objs\test1\windows\x64\release\src\systick.c.obj", "src\systick.c"], "file": "src\systick.c" }] 生成的是这样的代码,还是不行。
这不正常么,msvc 哪来的 -isystem
Bot detected the issue body's language is not English, translate it automatically.
Is this abnormal? Where does msvc come from -isytem
是这样的。但是我之前把toolchain调成了clang,然后保存时它自动又调整回default的toolchain了。
Bot detected the issue body's language is not English, translate it automatically.
Is such that. But I adjusted the toolchain to clang before, and then it automatically adjusted back to the default toolchain when saving.
按理不会,我这里没这个问题
Bot detected the issue body's language is not English, translate it automatically.
No way, I don't have this problem here
Xmake 版本
xmake v2.8.1+dev.732d60063
操作系统版本和架构
Windows11 10.0.22621
描述问题
使用VSCode里的xmake插件,新建一个项目,将项目的toolchain换成clang。设置xmake.lua,设置了add_sysincludedirs和add_includedirs,但是生成的compile_commands.json中并没有将两者区分开,clangd也依然提示add_sysincludedirs目录中文件的错误。
期待的结果
add_sysincludedirs目录中的文件不报错,并且其他文件依然可以正常引用这些目录里的文件。
工程配置
xmake.lua
add_rules("mode.debug", "mode.release")
target("test1") set_kind("binary") add_files("src/*.c") add_includedirs("inc") add_sysincludedirs("GD32W51x_Firmware_Library_V1.0.2/Firmware/CMSIS","GD32W51x_Firmware_Library_V1.0.2/Firmware/CMSIS/GD/GD32W51x/Include","GD32W51x_Firmware_Library_V1.0.2/Firmware/GD32W51x_standard_peripheral/Include","GD32W51x_Firmware_Library_V1.0.2/Utilities","C:/Users/TangTao/AppData/Local/Arm/Packs/ARM/CMSIS/5.9.0/CMSIS/Core/Include")
xmake自动生成的compile_commands.json [ { "directory": "c:\Users\TangTao\MyWork\embedded_work\gd32w5\test1", "arguments": ["C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\bin\HostX64\x64\cl.exe", "/c", "/nologo", "/O2", "/fp:fast", "/Iinc", "/EHsc", "/IGD32W51x_Firmware_Library_V1.0.2\Firmware\CMSIS", "/IGD32W51x_Firmware_Library_V1.0.2\Firmware\CMSIS\GD\GD32W51x\Include", "/IGD32W51x_Firmware_Library_V1.0.2\Firmware\GD32W51x_standard_peripheral\Include", "/IGD32W51x_Firmware_Library_V1.0.2\Utilities", "/IC:\Users\TangTao\AppData\Local\Arm\Packs\ARM\CMSIS\5.9.0\CMSIS\Core\Include", "/DNDEBUG", "/Fobuild\.objs\test1\windows\x64\release\src\gd32w51x_it.c.obj", "src\gd32w51x_it.c"], "file": "src\gd32w51x_it.c" }, { "directory": "c:\Users\TangTao\MyWork\embedded_work\gd32w5\test1", "arguments": ["C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\bin\HostX64\x64\cl.exe", "/c", "/nologo", "/O2", "/fp:fast", "/Iinc", "/EHsc", "/IGD32W51x_Firmware_Library_V1.0.2\Firmware\CMSIS", "/IGD32W51x_Firmware_Library_V1.0.2\Firmware\CMSIS\GD\GD32W51x\Include", "/IGD32W51x_Firmware_Library_V1.0.2\Firmware\GD32W51x_standard_peripheral\Include", "/IGD32W51x_Firmware_Library_V1.0.2\Utilities", "/IC:\Users\TangTao\AppData\Local\Arm\Packs\ARM\CMSIS\5.9.0\CMSIS\Core\Include", "/DNDEBUG", "/Fobuild\.objs\test1\windows\x64\release\src\main.c.obj", "src\main.c"], "file": "src\main.c" }, { "directory": "c:\Users\TangTao\MyWork\embedded_work\gd32w5\test1", "arguments": ["C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\bin\HostX64\x64\cl.exe", "/c", "/nologo", "/O2", "/fp:fast", "/Iinc", "/EHsc", "/IGD32W51x_Firmware_Library_V1.0.2\Firmware\CMSIS", "/IGD32W51x_Firmware_Library_V1.0.2\Firmware\CMSIS\GD\GD32W51x\Include", "/IGD32W51x_Firmware_Library_V1.0.2\Firmware\GD32W51x_standard_peripheral\Include", "/IGD32W51x_Firmware_Library_V1.0.2\Utilities", "/IC:\Users\TangTao\AppData\Local\Arm\Packs\ARM\CMSIS\5.9.0\CMSIS\Core\Include", "/DNDEBUG", "/Fobuild\.objs\test1\windows\x64\release\src\systick.c.obj", "src\systick.c"], "file": "src\systick.c" }]
当中希望出现的片段“-isystem C:\Users\TangTao\AppData\Local\Arm\Packs\ARM\CMSIS\5.9.0\CMSIS\Core\Include”
附加信息和错误日志
无。