设置编译目标debug无效
Xmake 版本
2.9.9
操作系统版本和架构
Debian bookworm
描述问题
先进行配置 xmake f -m debug 再使用xmake -P .命令开始编译。编译的产出是relase版本。
使用xmake 命令编译时ok的。
期待的结果
再使用xmake -P .命令开始编译。编译的产出是debug版本。
工程配置
add_rules("mode.debug", "mode.release")
local version = "7.4.0"
local libname = "lvgl7"
local function isnotempty(s)
return s ~= nil and s ~= ''
end
local function writepc(target, f)
txt = "exec_prefix=/lib\nlibdir=/lib\nincludedir=/usr/include\n\n"
txt = txt.."Name: "..target:name().."\n"
txt = txt.."Version: "..version.."\n"
txt = txt.."Description: "..target:name().."\n"
txt = txt.."Cflags: -I${includedir}/lvgl7\n"
txt = txt.."Libs: -L${libdir} -llvgl7\n"
--print("write to", pcpath, txt)
f:write(txt)
f:close()
end
local opt_build_dep = getenv("OPT_BUILD_DEP") == "1"
local function nimble_add_deps(name)
if (opt_build_dep)
then
add_deps(name)
else
add_packages(name)
end
end
if (opt_build_dep)
then
includes("../flexlayout")
includes("../Collections-C")
else
add_requires("pkgconfig::collections_c", {alias = "collections_c"})
add_requires("pkgconfig::flexlayout", {alias = "flexlayout"})
end
target(libname)
set_kind("shared")
add_includedirs(".", {public = true})
add_headerfiles("lvgl.h", {prefixdir = libname})
add_headerfiles("lv_conf.h", {prefixdir = libname})
add_headerfiles("(src/**.h)", {prefixdir = libname})
add_headerfiles("(src/*/**.h)", {prefixdir = libname})
add_files("src/lv_core/*.c", "src/lv_draw/*.c", "src/lv_font/*.c", "src/lv_hal/*.c", "src/lv_misc/*.c", "src/lv_themes/*.c", "src/lv_widgets/*.c")
add_ldflags("-lpthread")
nimble_add_deps("flexlayout")
nimble_add_deps("collections_c")
on_install(function (target)
end
pcpath = path.join(installdir, "usr/lib/pkgconfig", target:name()..".pc")
writepc(target, io.open(pcpath, "w"))
end)
附加信息和错误日志
编译产出是release版本
Bot detected the issue body's language is not English, translate it automatically.
Title: =Set the compile target debug invalid
为啥要指定 -P . ,除非你强改工程根目录,作为独立工程编译,那你上层的 debug 配置,又不会影响当前的,当前的还是 release
Bot detected the issue body's language is not English, translate it automatically.
Why do you need to specify -P .? Unless you forcefully change the project root directory, your upper debug configuration will not affect the current one, and the current one will still be release