Closed TOMO-CAT closed 4 months ago
Bot detected the issue body's language is not English, translate it automatically.
Title: How to easily remove some built-in compilation parameters
For example, in coverage or debug mode, xmake will bring many compilation parameters. For example, nvcc will bring {"-G", "-g", "-lineinfo"}
, but for some special reasons Requirements, for example, we remove the -G parameter and write in the global scope of xmake.lua in the root directory:
if is_mode("coverage") then
remove_cuflags("-G")
end
This is the most convenient, but it doesn't actually work.
Even if I want to remove cuflags in after_load it doesn't work because when target:get("cuflags") is printed, -G is not among them.
Provide a solution to remove the built-in compilation parameters of xmake.
No response
No response
不写add_rules("mode.debug"),自己判断is_mode("debug")加相关flag试试?
Bot detected the issue body's language is not English, translate it automatically.
Instead of writing add_rules("mode.debug"), try judging is_mode("debug") and adding relevant flags yourself?
不写add_rules("mode.debug"),自己判断is_mode("debug")加相关flag试试?
那相当于整个 mode.coverage 都得自己重新写,可以试试,但感觉比较麻烦,为了去掉一个参数将内置的一些 rule 整个重写了,还有一些 rule 更复杂比如 protobuf.cpp,不太好重写
Bot detected the issue body's language is not English, translate it automatically.
Instead of writing add_rules("mode.debug"), try judging is_mode("debug") and adding relevant flags yourself?
That's equivalent to having to rewrite the entire mode.coverage yourself. You can try it, but it seems troublesome. In order to remove a parameter, some built-in rules have been completely rewritten. There are also some rules that are more complicated, such as protobuf.cpp, which is not good. rewrite
set_symbols("none") 或者自定义 debug mode
"
好的
Bot detected the issue body's language is not English, translate it automatically.
set_symbols("none") or customize debug mode
Bot detected the issue body's language is not English, translate it automatically.
"
OK
你在什么场景下需要该功能?
举个例子,在 coverage 或者 debug 模式下,xmake 会自带很多编译参数,比如 nvcc 中会带上
{"-G", "-g", "-lineinfo"}
, 但是出于某些特殊需求,比如我们去掉里面的 -G 参数,在根目录的xmake.lua 全局作用域中写:这样是最便捷的,但是实际上无法生效。
即使我想在 after_load 中删掉 cuflags 也无法生效,因为打印 target:get("cuflags") 时 -G 并不在其中。
描述可能的解决方案
提供一种解决方法去掉 xmake 内部自带的编译参数。
描述你认为的候选方案
No response
其他信息
No response