qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v6 01/19] configure, meson: override C compiler for cmake


From: Jag Raman
Subject: Re: [PATCH v6 01/19] configure, meson: override C compiler for cmake
Date: Tue, 22 Feb 2022 19:05:52 +0000


> On Feb 20, 2022, at 3:27 AM, Paolo Bonzini <pbonzini@redhat.com> wrote:
> 
> On 2/18/22 15:49, Jag Raman wrote:
>> Concerning the generated files, I see the following in 
>> CMakeMesonToolchainFile.cmake:
>> Without patch: set(CMAKE_C_COMPILER "/opt/rh/devtoolset-9/root/usr/bin/cc" 
>> "-m64" "-mcx16”)
>> With patch: set(CMAKE_C_COMPILER "cc" "-m64" "-mcx16")
> 
> I don't understand why it works at all with the latter, but the right solution
> could be
> 
> set(CMAKE_C_COMPILER "/opt/rh/devtoolset-9/root/usr/bin/cc")
> set(CMAKE_C_COMPILER_ARG1 "-m64")
> set(CMAKE_C_COMPILER_ARG2 "-mcx16")
> 
> Perhaps you can try the following patch to meson (patch it in qemu's build
> directory and make sure to use --meson=internal):
> 
> diff --git a/mesonbuild/cmake/toolchain.py b/mesonbuild/cmake/toolchain.py
> index 316f57cb5..9756864ee 100644
> --- a/mesonbuild/cmake/toolchain.py
> +++ b/mesonbuild/cmake/toolchain.py
> @@ -191,11 +191,14 @@ class CMakeToolchain:
>                 continue
>              if len(exe_list) >= 2 and not self.is_cmdline_option(comp_obj, 
> exe_list[1]):
> -                defaults[prefix + 'COMPILER_LAUNCHER'] = 
> [make_abs(exe_list[0])]
> +                defaults[f'{prefix}COMPILER_LAUNCHER'] = 
> [make_abs(exe_list[0])]
>                 exe_list = exe_list[1:]
>              exe_list[0] = make_abs(exe_list[0])
> -            defaults[prefix + 'COMPILER'] = exe_list
> +            defaults[f'{prefix}COMPILER'] = [exe_list[0]]
> +            for i in range(1, len(exe_list)):
> +                defaults[f'{prefix}COMPILER_ARG{i}'] = [exe_list[i]]
> +
>             if comp_obj.get_id() == 'clang-cl':
>                 defaults['CMAKE_LINKER'] = comp_obj.get_linker_exelist()

This fix works at my end.

Thank you!
--
Jag

> 
> 
> Thanks,
> 
> Paolo


reply via email to

[Prev in Thread] Current Thread [Next in Thread]