All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cmake: Use compiler launcher variable when ccache is enabled
@ 2019-05-28 18:50 Philippe Normand
  2019-05-28 19:22 ` Andre McCurdy
  0 siblings, 1 reply; 5+ messages in thread
From: Philippe Normand @ 2019-05-28 18:50 UTC (permalink / raw)
  To: openembedded-core

Setting the CMAKE_C{,XX}_COMPILER_LAUNCHER variables is the recomended way to
deal with ccache in CMake. It allows build scripts to optionally opt-out of
CMake, which is especially useful when the pre-processed GCC output is required.

Signed-off-by: Philippe Normand <philn@igalia.com>
---
 meta/classes/cmake.bbclass | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
index d3f0d70847..a5cffedbc6 100644
--- a/meta/classes/cmake.bbclass
+++ b/meta/classes/cmake.bbclass
@@ -26,14 +26,16 @@ python() {
     if not d.getVar('OECMAKE_C_COMPILER'):
         cc_list = d.getVar('CC').split()
         if cc_list[0] == 'ccache':
-            d.setVar('OECMAKE_C_COMPILER', '%s %s' % (cc_list[0], cc_list[1]))
+            d.setVar('OECMAKE_C_COMPILER_LAUNCHER', cc_list[0])
+            d.setVar('OECMAKE_C_COMPILER', cc_list[1])
         else:
             d.setVar('OECMAKE_C_COMPILER', cc_list[0])
 
     if not d.getVar('OECMAKE_CXX_COMPILER'):
         cxx_list = d.getVar('CXX').split()
         if cxx_list[0] == 'ccache':
-            d.setVar('OECMAKE_CXX_COMPILER', '%s %s' % (cxx_list[0], cxx_list[1]))
+            d.setVar('OECMAKE_CXX_COMPILER_LAUNCHER', cxx_list[0])
+            d.setVar('OECMAKE_CXX_COMPILER', cxx_list[1])
         else:
             d.setVar('OECMAKE_CXX_COMPILER', cxx_list[0])
 }
@@ -49,6 +51,9 @@ OECMAKE_CXX_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS} ${LD
 CXXFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}"
 CFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}"
 
+OECMAKE_C_COMPILER_LAUNCHER ?= ""
+OECMAKE_CXX_COMPILER_LAUNCHER ?= ""
+
 OECMAKE_RPATH ?= ""
 OECMAKE_PERLNATIVE_DIR ??= ""
 OECMAKE_EXTRA_ROOT_PATH ?= ""
@@ -86,6 +91,8 @@ set( CMAKE_SYSTEM_NAME `echo ${TARGET_OS} | sed -e 's/^./\u&/' -e 's/^\(Linux\).
 set( CMAKE_SYSTEM_PROCESSOR ${@map_target_arch_to_uname_arch(d.getVar('TARGET_ARCH'))} )
 set( CMAKE_C_COMPILER ${OECMAKE_C_COMPILER} )
 set( CMAKE_CXX_COMPILER ${OECMAKE_CXX_COMPILER} )
+set( CMAKE_C_COMPILER_LAUNCHER ${OECMAKE_C_COMPILER_LAUNCHER} )
+set( CMAKE_CXX_COMPILER_LAUNCHER ${OECMAKE_CXX_COMPILER_LAUNCHER} )
 set( CMAKE_ASM_COMPILER ${OECMAKE_C_COMPILER} )
 set( CMAKE_AR ${OECMAKE_AR} CACHE FILEPATH "Archiver" )
 set( CMAKE_C_FLAGS "${OECMAKE_C_FLAGS}" CACHE STRING "CFLAGS" )
-- 
2.20.1




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

* Re: [PATCH] cmake: Use compiler launcher variable when ccache is enabled
  2019-05-28 18:50 [PATCH] cmake: Use compiler launcher variable when ccache is enabled Philippe Normand
@ 2019-05-28 19:22 ` Andre McCurdy
  2019-05-28 19:42   ` Philippe Normand
  2019-05-29  8:40   ` [PATCH v2] " Philippe Normand
  0 siblings, 2 replies; 5+ messages in thread
From: Andre McCurdy @ 2019-05-28 19:22 UTC (permalink / raw)
  To: Philippe Normand; +Cc: OE Core mailing list

On Tue, May 28, 2019 at 12:13 PM Philippe Normand <philn@igalia.com> wrote:
>
> Setting the CMAKE_C{,XX}_COMPILER_LAUNCHER variables is the recomended way to
> deal with ccache in CMake. It allows build scripts to optionally opt-out of
> CMake, which is especially useful when the pre-processed GCC output is required.

Opt out of CMake? Or ccache ?

>
> Signed-off-by: Philippe Normand <philn@igalia.com>
> ---
>  meta/classes/cmake.bbclass | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
> index d3f0d70847..a5cffedbc6 100644
> --- a/meta/classes/cmake.bbclass
> +++ b/meta/classes/cmake.bbclass
> @@ -26,14 +26,16 @@ python() {
>      if not d.getVar('OECMAKE_C_COMPILER'):
>          cc_list = d.getVar('CC').split()
>          if cc_list[0] == 'ccache':
> -            d.setVar('OECMAKE_C_COMPILER', '%s %s' % (cc_list[0], cc_list[1]))
> +            d.setVar('OECMAKE_C_COMPILER_LAUNCHER', cc_list[0])
> +            d.setVar('OECMAKE_C_COMPILER', cc_list[1])
>          else:
>              d.setVar('OECMAKE_C_COMPILER', cc_list[0])
>
>      if not d.getVar('OECMAKE_CXX_COMPILER'):
>          cxx_list = d.getVar('CXX').split()
>          if cxx_list[0] == 'ccache':
> -            d.setVar('OECMAKE_CXX_COMPILER', '%s %s' % (cxx_list[0], cxx_list[1]))
> +            d.setVar('OECMAKE_CXX_COMPILER_LAUNCHER', cxx_list[0])
> +            d.setVar('OECMAKE_CXX_COMPILER', cxx_list[1])
>          else:
>              d.setVar('OECMAKE_CXX_COMPILER', cxx_list[0])
>  }
> @@ -49,6 +51,9 @@ OECMAKE_CXX_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS} ${LD
>  CXXFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}"
>  CFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}"
>
> +OECMAKE_C_COMPILER_LAUNCHER ?= ""
> +OECMAKE_CXX_COMPILER_LAUNCHER ?= ""
> +
>  OECMAKE_RPATH ?= ""
>  OECMAKE_PERLNATIVE_DIR ??= ""
>  OECMAKE_EXTRA_ROOT_PATH ?= ""
> @@ -86,6 +91,8 @@ set( CMAKE_SYSTEM_NAME `echo ${TARGET_OS} | sed -e 's/^./\u&/' -e 's/^\(Linux\).
>  set( CMAKE_SYSTEM_PROCESSOR ${@map_target_arch_to_uname_arch(d.getVar('TARGET_ARCH'))} )
>  set( CMAKE_C_COMPILER ${OECMAKE_C_COMPILER} )
>  set( CMAKE_CXX_COMPILER ${OECMAKE_CXX_COMPILER} )
> +set( CMAKE_C_COMPILER_LAUNCHER ${OECMAKE_C_COMPILER_LAUNCHER} )
> +set( CMAKE_CXX_COMPILER_LAUNCHER ${OECMAKE_CXX_COMPILER_LAUNCHER} )
>  set( CMAKE_ASM_COMPILER ${OECMAKE_C_COMPILER} )
>  set( CMAKE_AR ${OECMAKE_AR} CACHE FILEPATH "Archiver" )
>  set( CMAKE_C_FLAGS "${OECMAKE_C_FLAGS}" CACHE STRING "CFLAGS" )
> --
> 2.20.1
>
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core


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

* Re: [PATCH] cmake: Use compiler launcher variable when ccache is enabled
  2019-05-28 19:22 ` Andre McCurdy
@ 2019-05-28 19:42   ` Philippe Normand
  2019-05-29  8:40   ` [PATCH v2] " Philippe Normand
  1 sibling, 0 replies; 5+ messages in thread
From: Philippe Normand @ 2019-05-28 19:42 UTC (permalink / raw)
  To: Andre McCurdy; +Cc: OE Core mailing list

On 2019-05-28 20:22, Andre McCurdy wrote:
> On Tue, May 28, 2019 at 12:13 PM Philippe Normand <philn@igalia.com> wrote:
>>
>> Setting the CMAKE_C{,XX}_COMPILER_LAUNCHER variables is the recomended way to
>> deal with ccache in CMake. It allows build scripts to optionally opt-out of
>> CMake, which is especially useful when the pre-processed GCC output is required.
> 
> Opt out of CMake? Or ccache ?
> 

The latter. Sorry about this typo, I'll send an amended patch :)

Philippe

>>
>> Signed-off-by: Philippe Normand <philn@igalia.com>
>> ---
>>  meta/classes/cmake.bbclass | 11 +++++++++--
>>  1 file changed, 9 insertions(+), 2 deletions(-)
>>
>> diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
>> index d3f0d70847..a5cffedbc6 100644
>> --- a/meta/classes/cmake.bbclass
>> +++ b/meta/classes/cmake.bbclass
>> @@ -26,14 +26,16 @@ python() {
>>      if not d.getVar('OECMAKE_C_COMPILER'):
>>          cc_list = d.getVar('CC').split()
>>          if cc_list[0] == 'ccache':
>> -            d.setVar('OECMAKE_C_COMPILER', '%s %s' % (cc_list[0], cc_list[1]))
>> +            d.setVar('OECMAKE_C_COMPILER_LAUNCHER', cc_list[0])
>> +            d.setVar('OECMAKE_C_COMPILER', cc_list[1])
>>          else:
>>              d.setVar('OECMAKE_C_COMPILER', cc_list[0])
>>
>>      if not d.getVar('OECMAKE_CXX_COMPILER'):
>>          cxx_list = d.getVar('CXX').split()
>>          if cxx_list[0] == 'ccache':
>> -            d.setVar('OECMAKE_CXX_COMPILER', '%s %s' % (cxx_list[0], cxx_list[1]))
>> +            d.setVar('OECMAKE_CXX_COMPILER_LAUNCHER', cxx_list[0])
>> +            d.setVar('OECMAKE_CXX_COMPILER', cxx_list[1])
>>          else:
>>              d.setVar('OECMAKE_CXX_COMPILER', cxx_list[0])
>>  }
>> @@ -49,6 +51,9 @@ OECMAKE_CXX_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS} ${LD
>>  CXXFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}"
>>  CFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}"
>>
>> +OECMAKE_C_COMPILER_LAUNCHER ?= ""
>> +OECMAKE_CXX_COMPILER_LAUNCHER ?= ""
>> +
>>  OECMAKE_RPATH ?= ""
>>  OECMAKE_PERLNATIVE_DIR ??= ""
>>  OECMAKE_EXTRA_ROOT_PATH ?= ""
>> @@ -86,6 +91,8 @@ set( CMAKE_SYSTEM_NAME `echo ${TARGET_OS} | sed -e 's/^./\u&/' -e 's/^\(Linux\).
>>  set( CMAKE_SYSTEM_PROCESSOR ${@map_target_arch_to_uname_arch(d.getVar('TARGET_ARCH'))} )
>>  set( CMAKE_C_COMPILER ${OECMAKE_C_COMPILER} )
>>  set( CMAKE_CXX_COMPILER ${OECMAKE_CXX_COMPILER} )
>> +set( CMAKE_C_COMPILER_LAUNCHER ${OECMAKE_C_COMPILER_LAUNCHER} )
>> +set( CMAKE_CXX_COMPILER_LAUNCHER ${OECMAKE_CXX_COMPILER_LAUNCHER} )
>>  set( CMAKE_ASM_COMPILER ${OECMAKE_C_COMPILER} )
>>  set( CMAKE_AR ${OECMAKE_AR} CACHE FILEPATH "Archiver" )
>>  set( CMAKE_C_FLAGS "${OECMAKE_C_FLAGS}" CACHE STRING "CFLAGS" )
>> --
>> 2.20.1
>>
>>
>> --
>> _______________________________________________
>> Openembedded-core mailing list
>> Openembedded-core@lists.openembedded.org
>> http://lists.openembedded.org/mailman/listinfo/openembedded-core


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

* Re: [PATCH v2] cmake: Use compiler launcher variable when ccache is enabled
  2019-05-28 19:22 ` Andre McCurdy
  2019-05-28 19:42   ` Philippe Normand
@ 2019-05-29  8:40   ` Philippe Normand
  2019-05-31  8:58     ` Philippe Normand
  1 sibling, 1 reply; 5+ messages in thread
From: Philippe Normand @ 2019-05-29  8:40 UTC (permalink / raw)
  To: OE Core mailing list

Setting the CMAKE_C{,XX}_COMPILER_LAUNCHER variables is the recomended way to
deal with ccache in CMake. It allows build scripts to optionally opt-out of
ccache, which is especially useful when the pre-processed GCC output is required.

Signed-off-by: Philippe Normand <philn@igalia.com>
---
 meta/classes/cmake.bbclass | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
index d3f0d70847..a5cffedbc6 100644
--- a/meta/classes/cmake.bbclass
+++ b/meta/classes/cmake.bbclass
@@ -26,14 +26,16 @@ python() {
     if not d.getVar('OECMAKE_C_COMPILER'):
         cc_list = d.getVar('CC').split()
         if cc_list[0] == 'ccache':
-            d.setVar('OECMAKE_C_COMPILER', '%s %s' % (cc_list[0], cc_list[1]))
+            d.setVar('OECMAKE_C_COMPILER_LAUNCHER', cc_list[0])
+            d.setVar('OECMAKE_C_COMPILER', cc_list[1])
         else:
             d.setVar('OECMAKE_C_COMPILER', cc_list[0])
 
     if not d.getVar('OECMAKE_CXX_COMPILER'):
         cxx_list = d.getVar('CXX').split()
         if cxx_list[0] == 'ccache':
-            d.setVar('OECMAKE_CXX_COMPILER', '%s %s' % (cxx_list[0], cxx_list[1]))
+            d.setVar('OECMAKE_CXX_COMPILER_LAUNCHER', cxx_list[0])
+            d.setVar('OECMAKE_CXX_COMPILER', cxx_list[1])
         else:
             d.setVar('OECMAKE_CXX_COMPILER', cxx_list[0])
 }
@@ -49,6 +51,9 @@ OECMAKE_CXX_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS} ${LD
 CXXFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}"
 CFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}"
 
+OECMAKE_C_COMPILER_LAUNCHER ?= ""
+OECMAKE_CXX_COMPILER_LAUNCHER ?= ""
+
 OECMAKE_RPATH ?= ""
 OECMAKE_PERLNATIVE_DIR ??= ""
 OECMAKE_EXTRA_ROOT_PATH ?= ""
@@ -86,6 +91,8 @@ set( CMAKE_SYSTEM_NAME `echo ${TARGET_OS} | sed -e 's/^./\u&/' -e 's/^\(Linux\).
 set( CMAKE_SYSTEM_PROCESSOR ${@map_target_arch_to_uname_arch(d.getVar('TARGET_ARCH'))} )
 set( CMAKE_C_COMPILER ${OECMAKE_C_COMPILER} )
 set( CMAKE_CXX_COMPILER ${OECMAKE_CXX_COMPILER} )
+set( CMAKE_C_COMPILER_LAUNCHER ${OECMAKE_C_COMPILER_LAUNCHER} )
+set( CMAKE_CXX_COMPILER_LAUNCHER ${OECMAKE_CXX_COMPILER_LAUNCHER} )
 set( CMAKE_ASM_COMPILER ${OECMAKE_C_COMPILER} )
 set( CMAKE_AR ${OECMAKE_AR} CACHE FILEPATH "Archiver" )
 set( CMAKE_C_FLAGS "${OECMAKE_C_FLAGS}" CACHE STRING "CFLAGS" )
-- 
2.20.1




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

* Re: [PATCH v2] cmake: Use compiler launcher variable when ccache is enabled
  2019-05-29  8:40   ` [PATCH v2] " Philippe Normand
@ 2019-05-31  8:58     ` Philippe Normand
  0 siblings, 0 replies; 5+ messages in thread
From: Philippe Normand @ 2019-05-31  8:58 UTC (permalink / raw)
  To: openembedded-core

Please let me know if there's anything left to address with this patch
:)

Philippe



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

end of thread, other threads:[~2019-05-31  8:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-28 18:50 [PATCH] cmake: Use compiler launcher variable when ccache is enabled Philippe Normand
2019-05-28 19:22 ` Andre McCurdy
2019-05-28 19:42   ` Philippe Normand
2019-05-29  8:40   ` [PATCH v2] " Philippe Normand
2019-05-31  8:58     ` Philippe Normand

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.