Skip to content

add [conf] section to conan profile #6518

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

Merged
merged 3 commits into from
Jun 3, 2025
Merged

add [conf] section to conan profile #6518

merged 3 commits into from
Jun 3, 2025

Conversation

hotaery
Copy link

@hotaery hotaery commented Jun 1, 2025

for _, pair in ipairs(configs.conf) do
local key, value = pair:match("([^=]+)=([^=]+)")
if key and value then
conf[key] = value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the same settings as settings, use parameters to set, and distinguish between build and host

-- set custom host settings
for _, setting in ipairs(configs.settings or configs.settings_host) do
table.insert(argv, "-s")
table.insert(argv, setting)
end
-- set custom build settings
for _, setting in ipairs(configs.settings_build) do
table.insert(argv, "-s:b")
table.insert(argv, setting)
end

  -s, --settings SETTINGS
                        Apply the specified settings. By default, or if specifying -s:h (--settings:host), it applies to the host context. Use -s:b (--settings:build) to specify the build context,
                        or -s:a (--settings:all) to specify both contexts at once. Example: -s="compiler=gcc"
  -s:b, --settings:build SETTINGS_BUILD
  -s:h, --settings:host SETTINGS_HOST
  -s:a, --settings:all SETTINGS_ALL
  -c, --conf CONF       Apply the specified conf. By default, or if specifying -c:h (--conf:host), it applies to the host context. Use -c:b (--conf:build) to specify the build context, or -c:a
                        (--conf:all) to specify both contexts at once. Example: -c="tools.cmake.cmaketoolchain:generator=Xcode"
  -c:b, --conf:build CONF_BUILD
  -c:h, --conf:host CONF_HOST
  -c:a, --conf:all CONF_ALL

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the same settings as settings, use parameters to set, and distinguish between build and host

-- set custom host settings
for _, setting in ipairs(configs.settings or configs.settings_host) do
table.insert(argv, "-s")
table.insert(argv, setting)
end
-- set custom build settings
for _, setting in ipairs(configs.settings_build) do
table.insert(argv, "-s:b")
table.insert(argv, setting)
end

  -s, --settings SETTINGS
                        Apply the specified settings. By default, or if specifying -s:h (--settings:host), it applies to the host context. Use -s:b (--settings:build) to specify the build context,
                        or -s:a (--settings:all) to specify both contexts at once. Example: -s="compiler=gcc"
  -s:b, --settings:build SETTINGS_BUILD
  -s:h, --settings:host SETTINGS_HOST
  -s:a, --settings:all SETTINGS_ALL
  -c, --conf CONF       Apply the specified conf. By default, or if specifying -c:h (--conf:host), it applies to the host context. Use -c:b (--conf:build) to specify the build context, or -c:a
                        (--conf:all) to specify both contexts at once. Example: -c="tools.cmake.cmaketoolchain:generator=Xcode"
  -c:b, --conf:build CONF_BUILD
  -c:h, --conf:host CONF_HOST
  -c:a, --conf:all CONF_ALL

I am curious why write conf section to profile(build profile and host profile)

profile:print("")
profile:print("[conf]")
for k, v in pairs(conf) do
profile:print("%s=%s", k, v)
end
end

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"},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use conan name, conf

@waruqi waruqi added this to the v3.0.0 milestone Jun 3, 2025
@waruqi waruqi merged commit c09fc2c into xmake-io:dev Jun 3, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants