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: Paolo Bonzini
Subject: Re: [PATCH v6 01/19] configure, meson: override C compiler for cmake
Date: Sun, 20 Feb 2022 09:27:00 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0

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()

Thanks,

Paolo



reply via email to

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