Skip to content

Commit

Permalink
fix MesonToolchain usages of VirtualBuildEnv
Browse files Browse the repository at this point in the history
  • Loading branch information
memsharded committed Mar 6, 2023
1 parent bc6a0eb commit 6bf641a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions conan/tools/meson/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,11 @@ def __init__(self, conanfile, backend=None):
compilers_by_conf = self._conanfile.conf.get("tools.build:compiler_executables", default={},
check_type=dict)
# Read the VirtualBuildEnv to update the variables
# FIXME: This VirtualBuildEnv instance is breaking things!!
# FIXME: It shouldn't be used here, not intended for this use case
prev_status = self._conanfile.virtualbuildenv
build_env = VirtualBuildEnv(self._conanfile).vars()
self._conanfile.virtualbuildenv = prev_status
#: Defines the Meson ``c`` variable. Defaulted to ``CC`` build environment value
self.c = compilers_by_conf.get("c") or build_env.get("CC") or default_comp
#: Defines the Meson ``cpp`` variable. Defaulted to ``CXX`` build environment value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ def generate(self):
"host_prof": cross})

t.run("install . -pr:h host_prof -pr:b build_prof")
# Checking that the global conanbuild aggregator includes conanbuildenv-xxx file
# it should have been generated by implicit VirtualBuildEnv generator
env_file = t.load("conanbuild.sh")
assert "conanbuildenv" in env_file
content = t.load(MesonToolchain.cross_filename)
assert "c_args = ['-isysroot', '/other/sdk/path', '-arch', 'myarch', '-otherminversion=10.7']" in content
assert "c_link_args = ['-isysroot', '/other/sdk/path', '-arch', 'myarch', '-otherminversion=10.7']" in content
Expand Down

0 comments on commit 6bf641a

Please sign in to comment.