Skip to content

compiler_executables emulator key#19940

Open
perseoGI wants to merge 5 commits into
conan-io:develop2from
perseoGI:pgi/config/emulator
Open

compiler_executables emulator key#19940
perseoGI wants to merge 5 commits into
conan-io:develop2from
perseoGI:pgi/config/emulator

Conversation

@perseoGI
Copy link
Copy Markdown
Contributor

@perseoGI perseoGI commented May 4, 2026

Changelog: Feature: compiler_executables admit new emulator key which can control Meson exe_wrapper and CMake CMAKE_CROSSCOMPILING_EMULATOR
Docs: TODO

Close #18718
Close #19912

Related PR: #19983


  • Refer to the issue that supports this Pull Request.
  • If the issue has missing info, explain the purpose/use case/pain/need that covers this Pull Request.
  • I've read the Contributing guide.
  • I've followed the PEP8 style guides for Python code.
  • I've opened another PR in the Conan docs repo to the develop branch, documenting this one.

@perseoGI perseoGI marked this pull request as ready for review May 4, 2026 13:42
@perseoGI perseoGI requested a review from franramirez688 May 4, 2026 13:43
Comment thread conan/tools/meson/toolchain.py Outdated
self.cross_build["build"]["subsystem"] = get_apple_subsystem(sdk_build)
# Issue: https://github.com/conan-io/conan/issues/19217
self.properties["needs_exe_wrapper"] = not can_run(self._conanfile)
self.properties["needs_exe_wrapper"] = self.emulator is not None or not can_run(self._conanfile)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is outside my knowledge, will let someone else weight in on it

Copy link
Copy Markdown
Contributor

@franramirez688 franramirez688 left a comment

Choose a reason for hiding this comment

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

It's looking great! I left a couple of comments to be discussed, basically:

  • I think that we do not really need a public argument to define the wrapper, as any recipe should not define it via the generate() function.
  • I think that the only change could be this https://github.com/conan-io/conan/pull/19940/changes#r3235881460
  • Instead of self._emulator as an attribute in the toolchain, let's name it self._exe_wrapper. I think it's clearer.

#: Defines the Meson ``objcpp_args`` variable. Defaulted to ``OBJCXXFLAGS`` build environment value
self.objcpp_args = []
#: Defines the Meson ``objcpp_link_args`` variable. Defaulted to ``LDFLAGS`` build environment value
self.objcpp_link_args = []
Copy link
Copy Markdown
Contributor

@franramirez688 franramirez688 May 13, 2026

Choose a reason for hiding this comment

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

The only change to add could be something like:

        #: Defines the Meson ``objcpp_link_args`` variable. Defaulted to ``LDFLAGS`` build environment value
        self.objcpp_link_args = []
        # Let's check if any emulator was defined
        self._exe_wrapper = None
        exe_wrapper = compilers_by_conf.get("emulator")
        if native is False and is_cross_building and exe_wrapper:
            self._exe_wrapper = exe_wrapper
            self.properties["needs_exe_wrapper"] = True

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I understand, I've changed the property name.
And to avoid duplicating the if native is False and is_cross_building and exe_wrapper logic, I've moved the read of compilers_by_conf upper, so that we can maintain the needs_exe_wrapper logic wher it was

Comment thread conan/tools/meson/toolchain.py Outdated
Comment thread conan/tools/meson/toolchain.py Outdated
# Read configuration for compilers
compilers_by_conf = self._conanfile_conf.get("tools.build:compiler_executables", default={},
check_type=dict)
self.emulator = compilers_by_conf.get("emulator")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is wrong as it's only used for cross-compiling and native=False. That's why I'm proposing this https://github.com/conan-io/conan/pull/19940/changes#r3235881460

Copy link
Copy Markdown
Member

@memsharded memsharded left a comment

Choose a reason for hiding this comment

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

Does this have an equivalent for CMake? It would be good to see its application for CMake too.

@memsharded memsharded self-assigned this May 14, 2026
@perseoGI perseoGI changed the title POC: compiler_executables emulator key compiler_executables emulator key May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] conan meson toolchain sets "needs_exe_wrapper" to False, when it is actually needed [feature] define exe_wrapper for meson cross files

4 participants