Skip to content

Feature/profile contexts #18383

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

Open
wants to merge 5 commits into
base: develop2
Choose a base branch
from

Conversation

memsharded
Copy link
Member

Changelog: Feature: Add context variable to profile jinja2 rendering (can be "build", "host" and None).
Docs: https://github.com/conan-io/docs/pull/XXXX

Close #18375

@memsharded memsharded added this to the 2.18.0 milestone May 29, 2025
Copy link
Member

@AbrilRBS AbrilRBS left a comment

Choose a reason for hiding this comment

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

So much passing info down, but I can see that this is in fact useful

c.run("create . -s os=Windows -s arch=armv8")

# This will pick the Linux+x86 package binary
c.run("list *:* --filter-profile=base")
Copy link
Member

Choose a reason for hiding this comment

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

Nice idea to test this, I think we should make sure that users understand that the context would have 3 potential values in the docs

@kammce
Copy link
Contributor

kammce commented May 29, 2025

I tested memsharded:feature/profile_contexts on my local machine with my profile fragment looked like this:

{% if context == "host" %}

[settings]
build_type=MinSizeRel
os=baremetal
arch=cortex-m3
libc=custom

[options]
*:platform={{ platform }}

{% endif %}

{% if context == "build" %}

[options]
arm-gnu-toolchain/*:fat_lto=False

{% include "default" %}

{% endif %}

and my build command was:

VERBOSE=1 conan build demos -pr:a conan/profiles/v1/stm32f103c8 -pr arm-gcc-12.3

I was checking to see if my toolchain package would recognize the option fat_lto being False (default: True), and remove the -ffat-lto-objects from the arguments. It worked as I intended on my machine.

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.

[feature] Add a profile_type API to jinja2
4 participants