All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roman Bolshakov <roman@roolebo.dev>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	"Thomas Huth" <thuth@redhat.com>,
	"Daniel P . Berrangé" <berrange@redhat.com>,
	"Christian Schoenebeck" <qemu_oss@crudebyte.com>,
	qemu-devel@nongnu.org, "Cameron Esfahani" <dirty@apple.com>,
	"Roman Bolshakov" <r.bolshakov@yadro.com>,
	"Alexander Graf" <agraf@csgraf.de>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Akihiko Odaki" <akihiko.odaki@gmail.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Wainer dos Santos Moschetta" <wainersm@redhat.com>
Subject: Re: [RFC PATCH v3 1/7] configure: Allow passing extra Objective C compiler flags
Date: Tue, 11 Jan 2022 20:16:45 +0300	[thread overview]
Message-ID: <Yd27fVx1iHyvA9ng@roolebo.dev> (raw)
In-Reply-To: <20220110131001.614319-2-f4bug@amsat.org>

On Mon, Jan 10, 2022 at 02:09:55PM +0100, Philippe Mathieu-Daudé wrote:
> We can pass C/CPP/LD flags via CFLAGS/CXXFLAGS/LDFLAGS environment
> variables, or via configure --extra-cflags / --extra-cxxflags /
> --extra-ldflags options. Provide similar behavior for Objective C:
> use existing flags from $OBJCFLAGS, or passed via --extra-objcflags.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  configure   | 8 ++++++++
>  meson.build | 5 +++++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/configure b/configure
> index 0c57a063c66..adb42d8beb1 100755
> --- a/configure
> +++ b/configure
> @@ -288,6 +288,7 @@ done
>  
>  EXTRA_CFLAGS=""
>  EXTRA_CXXFLAGS=""
> +EXTRA_OBJCFLAGS=""
>  EXTRA_LDFLAGS=""
>  
>  xen_ctrl_version="$default_feature"
> @@ -400,9 +401,12 @@ for opt do
>    --extra-cflags=*)
>      EXTRA_CFLAGS="$EXTRA_CFLAGS $optarg"
>      EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS $optarg"
> +    EXTRA_OBJCFLAGS="$EXTRA_OBJCFLAGS $optarg"
>      ;;
>    --extra-cxxflags=*) EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS $optarg"
>    ;;
> +  --extra-objcflags=*) EXTRA_OBJCFLAGS="$EXTRA_OBJCFLAGS $optarg"
> +  ;;
>    --extra-ldflags=*) EXTRA_LDFLAGS="$EXTRA_LDFLAGS $optarg"
>    ;;
>    --enable-debug-info) debug_info="yes"
> @@ -781,6 +785,8 @@ for opt do
>    ;;
>    --extra-cxxflags=*)
>    ;;
> +  --extra-objcflags=*)
> +  ;;
>    --extra-ldflags=*)
>    ;;
>    --enable-debug-info)
> @@ -1318,6 +1324,7 @@ Advanced options (experts only):
>    --objcc=OBJCC            use Objective-C compiler OBJCC [$objcc]
>    --extra-cflags=CFLAGS    append extra C compiler flags CFLAGS
>    --extra-cxxflags=CXXFLAGS append extra C++ compiler flags CXXFLAGS
> +  --extra-objcflags=OBJCFLAGS append extra Objective C compiler flags OBJCFLAGS
>    --extra-ldflags=LDFLAGS  append extra linker flags LDFLAGS
>    --cross-cc-ARCH=CC       use compiler when building ARCH guest test cases
>    --cross-cc-flags-ARCH=   use compiler flags when building ARCH guest tests
> @@ -3843,6 +3850,7 @@ if test "$skip_meson" = no; then
>    echo "[built-in options]" >> $cross
>    echo "c_args = [$(meson_quote $CFLAGS $EXTRA_CFLAGS)]" >> $cross
>    echo "cpp_args = [$(meson_quote $CXXFLAGS $EXTRA_CXXFLAGS)]" >> $cross
> +  test -n "$objcc" && echo "objc_args = [$(meson_quote $OBJCFLAGS $EXTRA_OBJCFLAGS)]" >> $cross
>    echo "c_link_args = [$(meson_quote $CFLAGS $LDFLAGS $EXTRA_CFLAGS $EXTRA_LDFLAGS)]" >> $cross
>    echo "cpp_link_args = [$(meson_quote $CXXFLAGS $LDFLAGS $EXTRA_CXXFLAGS $EXTRA_LDFLAGS)]" >> $cross
>    echo "[binaries]" >> $cross
> diff --git a/meson.build b/meson.build
> index 0e52f54b100..a21305d62c1 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -3286,6 +3286,11 @@
>                                                 + ['-O' + get_option('optimization')]
>                                                 + (get_option('debug') ? ['-g'] : []))}
>  endif
> +if targetos == 'darwin'
> +  summary_info += {'OBJCFLAGS':       ' '.join(get_option('objc_args')
> +                                               + ['-O' + get_option('optimization')]
> +                                               + (get_option('debug') ? ['-g'] : []))}

Hi Philippe,

You need to add something like below to actually use the flags in build:

add_global_arguments(config_host['QEMU_OBJCFLAGS'].split(),
                     native: false, language: 'objc')

Regards,
Roman

> +endif
>  link_args = get_option(link_language + '_link_args')
>  if link_args.length() > 0
>    summary_info += {'LDFLAGS':         ' '.join(link_args)}
> -- 
> 2.33.1


  reply	other threads:[~2022-01-11 17:34 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-10 13:09 [RFC PATCH v3 0/7] host: Support macOS 12 Philippe Mathieu-Daudé
2022-01-10 13:09 ` [RFC PATCH v3 1/7] configure: Allow passing extra Objective C compiler flags Philippe Mathieu-Daudé
2022-01-11 17:16   ` Roman Bolshakov [this message]
2022-01-12 13:46     ` Philippe Mathieu-Daudé
2022-01-12 14:09       ` Philippe Mathieu-Daudé
2022-01-12 14:47         ` Philippe Mathieu-Daudé
2022-01-10 13:09 ` [RFC PATCH v3 2/7] ui/cocoa: Remove allowedFileTypes restriction in SavePanel Philippe Mathieu-Daudé
2022-01-10 19:43   ` Roman Bolshakov
2022-01-10 13:09 ` [RFC PATCH v3 3/7] hvf: Make hvf_get_segments() / hvf_put_segments() local Philippe Mathieu-Daudé
2022-01-11 16:09   ` Roman Bolshakov
2022-01-10 13:09 ` [RFC PATCH v3 4/7] hvf: Remove deprecated hv_vcpu_flush() calls Philippe Mathieu-Daudé
2022-01-11 17:51   ` Roman Bolshakov
2022-01-10 13:09 ` [RFC PATCH v3 5/7] audio/coreaudio: Remove a deprecation warning on macOS 12 Philippe Mathieu-Daudé
2022-01-10 13:20   ` Philippe Mathieu-Daudé
2022-01-10 13:43     ` Christian Schoenebeck
2022-01-11 18:36   ` Roman Bolshakov
2022-01-12  6:57   ` Roman Bolshakov
2022-01-10 13:10 ` [RFC PATCH v3 6/7] block/file-posix: " Philippe Mathieu-Daudé
2022-01-10 18:28   ` Akihiko Odaki
2022-01-10 13:10 ` [RFC PATCH v3 7/7] gitlab-ci: Support macOS 12 via cirrus-run Philippe Mathieu-Daudé
2022-01-13  7:39   ` Thomas Huth
2022-01-13 11:41     ` Philippe Mathieu-Daudé
2022-01-18  9:34       ` Thomas Huth
2022-01-10 18:06 ` [RFC PATCH v3 0/7] host: Support macOS 12 Roman Bolshakov

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=Yd27fVx1iHyvA9ng@roolebo.dev \
    --to=roman@roolebo.dev \
    --cc=agraf@csgraf.de \
    --cc=akihiko.odaki@gmail.com \
    --cc=alex.bennee@linaro.org \
    --cc=berrange@redhat.com \
    --cc=dirty@apple.com \
    --cc=f4bug@amsat.org \
    --cc=kraxel@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu_oss@crudebyte.com \
    --cc=r.bolshakov@yadro.com \
    --cc=thuth@redhat.com \
    --cc=wainersm@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.