diff options
| author | harry <harry> | 2025-06-02 11:35:05 +0800 |
|---|---|---|
| committer | harry <harry> | 2025-06-02 11:35:05 +0800 |
| commit | eb618682cb9c9782285b2b552259473bd472e60a (patch) | |
| tree | 679660fe0de4a4cff776cdea9872fa3866931fc4 | |
| parent | f55d0e641559051675692bf70831598adf8bd069 (diff) | |
pass configuration via command line of conan
| -rw-r--r-- | xmake/modules/package/manager/conan/configurations.lua | 20 | ||||
| -rw-r--r-- | xmake/modules/package/manager/conan/v2/install_package.lua | 24 |
2 files changed, 23 insertions, 21 deletions
diff --git a/xmake/modules/package/manager/conan/configurations.lua b/xmake/modules/package/manager/conan/configurations.lua index 8742ecb6e..fcc9b9c01 100644 --- a/xmake/modules/package/manager/conan/configurations.lua +++ b/xmake/modules/package/manager/conan/configurations.lua @@ -22,15 +22,17 @@ function main() return { - build = {description = "Use it to choose if you want to build from sources.", default = "missing", values = {"all", "never", "missing", "outdated"}}, - remote = {description = "Set the conan remote server."}, - options = {description = "Set the options values, e.g. shared=True"}, - settings = {description = "Set the host settings for conan."}, - settings_host = {description = "Set the host settings for conan."}, - settings_build = {description = "Set the build settings for conan."}, - imports = {description = "Set the imports for conan 1.x, it has been deprecated in conan 2.x."}, - build_requires = {description = "Set the build requires for conan."}, - conf = {description = "Set the conan configuration, e.g. tools.microsoft.bash:subsystem=msys2"} + build = {description = "Use it to choose if you want to build from sources.", default = "missing", values = {"all", "never", "missing", "outdated"}}, + remote = {description = "Set the conan remote server."}, + options = {description = "Set the options values, e.g. shared=True"}, + settings = {description = "Set the host settings for conan."}, + settings_host = {description = "Set the host settings for conan."}, + settings_build = {description = "Set the build settings for conan."}, + imports = {description = "Set the imports for conan 1.x, it has been deprecated in conan 2.x."}, + build_requires = {description = "Set the build requires for conan."}, + configurations = {description = "Set the host configurations for conan, e.g. tools.microsoft.bash:subsystem=msys2"}, + configurations_host = {description = "Set the host configurations for conan, e.g. tools.microsoft.bash:subsystem=msys2"}, + configurations_build = {description = "Set the build configurations for conan, e.g. tools.microsoft.bash:subsystem=msys2"}, } end diff --git a/xmake/modules/package/manager/conan/v2/install_package.lua b/xmake/modules/package/manager/conan/v2/install_package.lua index 2d8bcfc86..b424ee06f 100644 --- a/xmake/modules/package/manager/conan/v2/install_package.lua +++ b/xmake/modules/package/manager/conan/v2/install_package.lua @@ -248,18 +248,6 @@ function _conan_generate_compiler_profile(profile, configs, opt) end end - if configs.conf then - if not conf then - conf = {} - end - for _, pair in ipairs(configs.conf) do - local key, value = pair:match("([^=]+)=([^=]+)") - if key and value then - conf[key] = value - end - end - end - if conf then profile:print("") profile:print("[conf]") @@ -345,6 +333,18 @@ function main(conan, name, opt) table.insert(argv, setting) end + -- set custom host configurations + for _, conf in ipairs(configs.configurations or configs.configurations_host) do + table.insert(argv, "-c") + table.insert(argv, conf) + end + + -- set custom build configurations + for _, conf in ipairs(configs.configurations_build) do + table.insert(argv, "-c:b") + table.insert(argv, conf) + end + -- set remote if configs.remote then table.insert(argv, "-r") |
