Re: [OE-core] [PATCH] cmake: Use compiler launcher variable when ccache is enabled

2019-05-28 Thread Philippe Normand
On 2019-05-28 20:22, Andre McCurdy wrote:
> On Tue, May 28, 2019 at 12:13 PM Philippe Normand  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 
>> ---
>>  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
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] cmake: Use compiler launcher variable when ccache is enabled

2019-05-28 Thread Andre McCurdy
On Tue, May 28, 2019 at 12:13 PM Philippe Normand  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 
> ---
>  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
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core