All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] meson: Adjust for clang compiler
@ 2018-01-27  7:06 Khem Raj
  2018-01-29 17:21 ` Burton, Ross
  0 siblings, 1 reply; 4+ messages in thread
From: Khem Raj @ 2018-01-27  7:06 UTC (permalink / raw)
  To: openembedded-core

Remove hardcoding c/c++ compiler to be gcc alone, its
possible to use clang as replacement for cross compilers
from meta-clang, therefore set clang/clang++ if
TOOLCHAIN = "clang"

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/classes/meson.bbclass | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/meta/classes/meson.bbclass b/meta/classes/meson.bbclass
index 91ac652651..cd3497a802 100644
--- a/meta/classes/meson.bbclass
+++ b/meta/classes/meson.bbclass
@@ -40,6 +40,11 @@ EXTRA_OEMESON += "${PACKAGECONFIG_CONFARGS}"
 MESON_CROSS_FILE = ""
 MESON_CROSS_FILE_class-target = "--cross-file ${WORKDIR}/meson.cross"
 
+CCOMPILER ?= "gcc"
+CXXCOMPILER ?= "g++"
+CCOMPILER_toolchain-clang = "clang"
+CXXCOMPILER_toolchain-clang = "clang++"
+
 def meson_array(var, d):
     return "', '".join(d.getVar(var).split()).join(("'", "'"))
 
@@ -49,8 +54,8 @@ do_write_config() {
     # This needs to be Py to split the args into single-element lists
     cat >${WORKDIR}/meson.cross <<EOF
 [binaries]
-c = '${HOST_PREFIX}gcc'
-cpp = '${HOST_PREFIX}g++'
+c = '${HOST_PREFIX}${CCOMPILER}'
+cpp = '${HOST_PREFIX}${CXXCOMPILER}'
 ar = '${HOST_PREFIX}ar'
 ld = '${HOST_PREFIX}ld'
 strip = '${HOST_PREFIX}strip'
-- 
2.16.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] meson: Adjust for clang compiler
  2018-01-27  7:06 [PATCH] meson: Adjust for clang compiler Khem Raj
@ 2018-01-29 17:21 ` Burton, Ross
  2018-01-29 17:44   ` Khem Raj
  0 siblings, 1 reply; 4+ messages in thread
From: Burton, Ross @ 2018-01-29 17:21 UTC (permalink / raw)
  To: Khem Raj; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 985 bytes --]

On 27 January 2018 at 07:06, Khem Raj <raj.khem@gmail.com> wrote:

> Remove hardcoding c/c++ compiler to be gcc alone, its
> possible to use clang as replacement for cross compilers
> from meta-clang, therefore set clang/clang++ if
> TOOLCHAIN = "clang"
>
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
>  meta/classes/meson.bbclass | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/meta/classes/meson.bbclass b/meta/classes/meson.bbclass
> index 91ac652651..cd3497a802 100644
> --- a/meta/classes/meson.bbclass
> +++ b/meta/classes/meson.bbclass
> @@ -40,6 +40,11 @@ EXTRA_OEMESON += "${PACKAGECONFIG_CONFARGS}"
>  MESON_CROSS_FILE = ""
>  MESON_CROSS_FILE_class-target = "--cross-file ${WORKDIR}/meson.cross"
>
> +CCOMPILER ?= "gcc"
> +CXXCOMPILER ?= "g++"
> +CCOMPILER_toolchain-clang = "clang"
> +CXXCOMPILER_toolchain-clang = "clang++"
> +
>

Can we do this in bitbake.conf instead of repeating ourselves?

Ross

[-- Attachment #2: Type: text/html, Size: 1490 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] meson: Adjust for clang compiler
  2018-01-29 17:21 ` Burton, Ross
@ 2018-01-29 17:44   ` Khem Raj
  2018-01-29 23:07     ` Richard Purdie
  0 siblings, 1 reply; 4+ messages in thread
From: Khem Raj @ 2018-01-29 17:44 UTC (permalink / raw)
  To: Burton, Ross; +Cc: OE-core

On Mon, Jan 29, 2018 at 9:21 AM, Burton, Ross <ross.burton@intel.com> wrote:
> On 27 January 2018 at 07:06, Khem Raj <raj.khem@gmail.com> wrote:
>>
>> Remove hardcoding c/c++ compiler to be gcc alone, its
>> possible to use clang as replacement for cross compilers
>> from meta-clang, therefore set clang/clang++ if
>> TOOLCHAIN = "clang"
>>
>> Signed-off-by: Khem Raj <raj.khem@gmail.com>
>> ---
>>  meta/classes/meson.bbclass | 9 +++++++--
>>  1 file changed, 7 insertions(+), 2 deletions(-)
>>
>> diff --git a/meta/classes/meson.bbclass b/meta/classes/meson.bbclass
>> index 91ac652651..cd3497a802 100644
>> --- a/meta/classes/meson.bbclass
>> +++ b/meta/classes/meson.bbclass
>> @@ -40,6 +40,11 @@ EXTRA_OEMESON += "${PACKAGECONFIG_CONFARGS}"
>>  MESON_CROSS_FILE = ""
>>  MESON_CROSS_FILE_class-target = "--cross-file ${WORKDIR}/meson.cross"
>>
>> +CCOMPILER ?= "gcc"
>> +CXXCOMPILER ?= "g++"
>> +CCOMPILER_toolchain-clang = "clang"
>> +CXXCOMPILER_toolchain-clang = "clang++"
>> +
>
>
> Can we do this in bitbake.conf instead of repeating ourselves?

having it in meson bbclass keeps it to meson based recipes,
bitbake.conf is a bit too generic.

>
> Ross


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] meson: Adjust for clang compiler
  2018-01-29 17:44   ` Khem Raj
@ 2018-01-29 23:07     ` Richard Purdie
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Purdie @ 2018-01-29 23:07 UTC (permalink / raw)
  To: Khem Raj, Burton, Ross; +Cc: OE-core

On Mon, 2018-01-29 at 09:44 -0800, Khem Raj wrote:
> On Mon, Jan 29, 2018 at 9:21 AM, Burton, Ross <ross.burton@intel.com>
> wrote:
> > 
> > On 27 January 2018 at 07:06, Khem Raj <raj.khem@gmail.com> wrote:
> > > 
> > > 
> > > Remove hardcoding c/c++ compiler to be gcc alone, its
> > > possible to use clang as replacement for cross compilers
> > > from meta-clang, therefore set clang/clang++ if
> > > TOOLCHAIN = "clang"
> > > 
> > > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > > ---
> > >  meta/classes/meson.bbclass | 9 +++++++--
> > >  1 file changed, 7 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/meta/classes/meson.bbclass
> > > b/meta/classes/meson.bbclass
> > > index 91ac652651..cd3497a802 100644
> > > --- a/meta/classes/meson.bbclass
> > > +++ b/meta/classes/meson.bbclass
> > > @@ -40,6 +40,11 @@ EXTRA_OEMESON += "${PACKAGECONFIG_CONFARGS}"
> > >  MESON_CROSS_FILE = ""
> > >  MESON_CROSS_FILE_class-target = "--cross-file
> > > ${WORKDIR}/meson.cross"
> > > 
> > > +CCOMPILER ?= "gcc"
> > > +CXXCOMPILER ?= "g++"
> > > +CCOMPILER_toolchain-clang = "clang"
> > > +CXXCOMPILER_toolchain-clang = "clang++"
> > > +
> > 
> > Can we do this in bitbake.conf instead of repeating ourselves?
> having it in meson bbclass keeps it to meson based recipes,
> bitbake.conf is a bit too generic.

Yes, I do worry a bit about namespace pollution from bitbake.conf
already...

Cheers,

Richard




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-01-29 23:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-27  7:06 [PATCH] meson: Adjust for clang compiler Khem Raj
2018-01-29 17:21 ` Burton, Ross
2018-01-29 17:44   ` Khem Raj
2018-01-29 23:07     ` Richard Purdie

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.