Skip to content
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

Feature/set meson b_vscrt with clang-cl #14664

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions conan/tools/meson/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,12 @@ def __init__(self, conanfile, backend=None):
cppstd = self._conanfile.settings.get_safe("compiler.cppstd")
self._cpp_std = to_cppstd_flag(compiler, compiler_version, cppstd)

if compiler == "msvc":
self._b_vscrt = None
if compiler in ("msvc", "clang"):
vscrt = msvc_runtime_flag(self._conanfile)
self._b_vscrt = str(vscrt).lower()
else:
self._b_vscrt = None
if vscrt:
self._b_vscrt = str(vscrt).lower()

#: Dict-like object that defines Meson``properties`` with ``key=value`` format
self.properties = {}
#: Dict-like object that defines Meson ``project options`` with ``key=value`` format
Expand Down
40 changes: 40 additions & 0 deletions conans/test/integration/toolchains/meson/test_mesontoolchain.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import platform
import textwrap

import pytest

from conan.tools.meson import MesonToolchain
from conans.test.utils.tools import TestClient

Expand Down Expand Up @@ -165,3 +168,40 @@ def generate(self):
content = t.load(MesonToolchain.native_filename)
assert "wrap_mode " not in content
assert "nofallback" not in content


@pytest.mark.skipif(platform.system() != "Windows", reason="requires Win")
# @pytest.mark.tool("visual_studio", "17")
# @pytest.mark.tool("clang", "16")
@pytest.mark.parametrize("build_type,runtime,vscrt", [
("Debug", "dynamic", "mdd"),
("Debug", "static", "mtd"),
("Release", "dynamic", "md"),
("Release", "static", "mt")
])
def test_clang_cl_vscrt(build_type, runtime, vscrt):
profile = textwrap.dedent(f"""
[settings]
os=Windows
arch=x86_64
build_type={build_type}
compiler=clang
compiler.runtime={runtime}
compiler.runtime_type={build_type}
compiler.runtime_version=v143
compiler.version=16

[conf]
tools.cmake.cmaketoolchain:generator=Visual Studio 17

[buildenv]
CC=clang-cl
CXX=clang-cl
""")
t = TestClient()
t.save({"conanfile.txt": "[generators]\nMesonToolchain",
"profile": profile})

t.run("install . -pr:h=profile -pr:b=profile")
content = t.load(MesonToolchain.native_filename)
assert f"b_vscrt = '{vscrt}'" in content