qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Pierrick Bouvier <pierrick.bouvier@linaro.org>, qemu-devel@nongnu.org
Cc: "Richard Henderson" <richard.henderson@linaro.org>,
	berrange@redhat.com, "Philippe Mathieu-Daudé" <philmd@linaro.org>,
	thuth@redhat.com, "Peter Maydell" <peter.maydell@linaro.org>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>
Subject: Re: [PATCH 1/6] meson: build target libraries with common dependencies
Date: Sat, 17 May 2025 17:00:47 +0200	[thread overview]
Message-ID: <e270f781-b328-4aba-bfe6-b61516f7b286@redhat.com> (raw)
In-Reply-To: <20250516052708.930928-2-pierrick.bouvier@linaro.org>

On 5/16/25 07:27, Pierrick Bouvier wrote:
> @@ -4131,12 +4137,17 @@ common_all = static_library('common',
>   hw_common_arch_libs = {}
>   target_common_arch_libs = {}
>   target_common_system_arch_libs = {}
> -foreach target : target_dirs
> +foreach target_base_arch, config_base_arch : config_base_arch_mak
>     config_target = config_target_mak[target]
> -  target_base_arch = config_target['TARGET_BASE_ARCH']

Each target_base_arch is now processed only once.  Therefore, all the 
"if target_base_arch not in ..." tests can be removed.

>     target_inc = [include_directories('target' / target_base_arch)]
>     inc = [common_user_inc + target_inc]

>           sources: src.all_sources() + genh,
>           include_directories: inc,
>           c_args: target_system_c_args,
> -        dependencies: src.all_dependencies())
> +        dependencies: src.all_dependencies() + common_deps)
>         hw_common_arch_libs += {target_base_arch: lib}
>       endif
>     endif

...

> @@ -4179,7 +4190,7 @@ foreach target : target_dirs
>           sources: src.all_sources() + genh,
>           include_directories: inc,
>           c_args: target_system_c_args,
> -        dependencies: src.all_dependencies())
> +        dependencies: src.all_dependencies() + common_deps)
>         target_common_system_arch_libs += {target_base_arch: lib}
>       endif
>     endif

There is no need for two separate libraries, since hw_* and 
target_system_* use the same flags.  You can do something like

   system_src = []
   if target_base_arch in hw_common_arch
     system_src += hw_common_arch[target_base_arch].all_sources()
     system_deps += hw_common_arch[target_base_arch].all_dependencies()
   endif
   if target_base_arch in target_common_system_arch
     system_src += target_common_system_arch[target_base_arch].all_sources()
     system_deps += 
target_common_system_arch[target_base_arch].all_dependencies()
   endif
   if system_src.length() > 0
     ...
   endif

to build the two arrays of sources and dependencies.

If you reduce the libraries from 3 to 2, you could call them 'common_' + 
target_base_arch and 'system_' + target_base_arch.  That's more similar 
to the existing libcommon and libsystem.

Paolo



  parent reply	other threads:[~2025-05-17 15:02 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-16  5:27 [PATCH 0/6] single-binary: build target common libraries with dependencies Pierrick Bouvier
2025-05-16  5:27 ` [PATCH 1/6] meson: build target libraries with common dependencies Pierrick Bouvier
2025-05-16 11:42   ` Philippe Mathieu-Daudé
2025-05-16 14:34     ` Pierrick Bouvier
2025-05-17 15:00   ` Paolo Bonzini [this message]
2025-05-17 19:37     ` Pierrick Bouvier
2025-05-16  5:27 ` [PATCH 2/6] hw/arm: remove explicit dependencies listed Pierrick Bouvier
2025-05-16  5:27 ` [PATCH 3/6] target/arm: " Pierrick Bouvier
2025-05-16  5:27 ` [PATCH 4/6] meson: apply target config for picking files from lib{system, user} Pierrick Bouvier
2025-05-16  5:27 ` [PATCH 5/6] meson: merge lib{system, user}_ss with {system, user}_ss Pierrick Bouvier
2025-05-17 15:04   ` Paolo Bonzini
2025-05-17 19:34     ` Pierrick Bouvier
2025-05-16  5:27 ` [PATCH 6/6] meson: remove lib{system, user}_ss aliases Pierrick Bouvier
2025-05-16  5:40 ` [PATCH 0/6] single-binary: build target common libraries with dependencies Pierrick Bouvier
2025-05-16  7:24 ` Thomas Huth
2025-05-21 22:38 ` Pierrick Bouvier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e270f781-b328-4aba-bfe6-b61516f7b286@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=berrange@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=pierrick.bouvier@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).