diff options
| author | ruki <[email protected]> | 2021-06-13 11:06:33 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-06-13 11:06:33 +0800 |
| commit | 60e522f32d327a0f1dc6860e123cff40adfc0402 (patch) | |
| tree | c10d428fec1f116d3779f1a571f50ecb94a7c8f8 | |
| parent | 05a41ca82a2eadaca578618b04ad713b500dbba7 (diff) | |
improve builtin configs
| -rw-r--r-- | xmake/modules/private/action/require/impl/package.lua | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/xmake/modules/private/action/require/impl/package.lua b/xmake/modules/private/action/require/impl/package.lua index aa7a75352..d9ee2f0cf 100644 --- a/xmake/modules/private/action/require/impl/package.lua +++ b/xmake/modules/private/action/require/impl/package.lua @@ -219,15 +219,26 @@ end -- add some builtin configurations to package function _add_package_configurations(package) - package:add("configs", "debug", {builtin = true, description = "Enable debug symbols.", default = false, type = "boolean"}) - package:add("configs", "shared", {builtin = true, description = "Enable shared library.", default = false, type = "boolean"}) + -- we can define configs to override it and it's default value in package() + if package:config("debug") ~= nil then + package:add("configs", "debug", {builtin = true, description = "Enable debug symbols.", default = false, type = "boolean"}) + end + if package:config("shared") ~= nil then + package:add("configs", "shared", {builtin = true, description = "Enable shared library.", default = false, type = "boolean"}) + end + if package:config("pic") ~= nil then + package:add("configs", "pic", {builtin = true, description = "Enable the position independent code.", default = true, type = "boolean"}) + end + if package:config("vs_runtime") ~= nil then + package:add("configs", "vs_runtime", {builtin = true, description = "Set vs compiler runtime.", values = {"MT", "MTd", "MD", "MDd"}}) + end + if package:config("toolchains") ~= nil then + package:add("configs", "toolchains", {builtin = true, description = "Set package toolchains only for cross-compilation."}) + end package:add("configs", "cflags", {builtin = true, description = "Set the C compiler flags."}) package:add("configs", "cxflags", {builtin = true, description = "Set the C/C++ compiler flags."}) package:add("configs", "cxxflags", {builtin = true, description = "Set the C++ compiler flags."}) package:add("configs", "asflags", {builtin = true, description = "Set the assembler flags."}) - package:add("configs", "pic", {builtin = true, description = "Enable the position independent code.", default = true, type = "boolean"}) - package:add("configs", "vs_runtime", {builtin = true, description = "Set vs compiler runtime.", values = {"MT", "MTd", "MD", "MDd"}}) - package:add("configs", "toolchains", {builtin = true, description = "Set package toolchains only for cross-compilation."}) end -- select package version |
