Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xmake不能为test生成compile commands #4750

Closed
24bit-xjkp opened this issue Feb 20, 2024 · 3 comments
Closed

xmake不能为test生成compile commands #4750

24bit-xjkp opened this issue Feb 20, 2024 · 3 comments
Labels

Comments

@24bit-xjkp
Copy link
Contributor

Xmake 版本

v2.8.6

操作系统版本和架构

Windows 11 24H2

描述问题

源代码

// a.cpp
int main() {}
// b.cpp
int main() {}
target("test")
    add_files("a.cpp")
    add_tests("test", {files = "b.cpp", remove_files = "a.cpp"})

命令

-- xmake.lua
xmake f
xmake build
xmake project -k compile_commands --lsp=clangd

结果

// compile_commands.json
[{
  "directory": "C:\\Users\\22835\\Desktop\\test",
  "arguments": ["clang.exe", "-c", "-Qunused-arguments", "-m64", "-fexceptions", "-fcxx-exceptions", "-o", "build\\.objs\\test\\windows\\x64\\release\\a.cpp.obj", "a.cpp"],
  "file": "a.cpp"
}]

可以看到没有为测试用例也就是b.cpp生成配置信息

期待的结果

需要根据add_tests中的配置为测试用例生成compile commands

工程配置

// a.cpp
int main() {}
// b.cpp
int main() {}
-- xmake.lua
target("test")
    add_files("a.cpp")
    add_tests("test", {files = "b.cpp", remove_files = "a.cpp"})

附加信息和错误日志

xmake project -k compile_commands --lsp=clangd -vD
configure
{
    arch = x64
    toolchain = clang
    buildir = build
    ndk_stdcxx = true
    kind = static
    ccache = true
    plat = windows
    mode = release
    host = windows
}
create ok!
@24bit-xjkp 24bit-xjkp added the bug label Feb 20, 2024
@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Title: xmake cannot generate compile commands for test

@24bit-xjkp
Copy link
Contributor Author

这个问题在xmake v2.9.4+HEAD.e85b001f1中依然存在,应该也为测试用例生成compile_commands。

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


This problem still exists in xmake v2.9.4+HEAD.e85b001f1, which should also generate compile_commands for test cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants