From d014c8c11fb663f131d3a860ddeda17d604b2dd3 Mon Sep 17 00:00:00 2001 From: Robert Yang Date: Tue, 18 Dec 2018 10:21:36 +0800 Subject: cmake.bbclass: Make it work with ccache This can make the following recipes work with cmake: cmake libdnf libcomps librepo createrepo-c llvm dnf libsolv assimp waffle libjpeg-turbo taglib libproxy libical And the following 3 recipes don't: webkitgtk vulkan piglit Now cmake.bbclass doesn't disble ccache any more, disable it in the recipes if needed. Signed-off-by: Robert Yang --- meta/classes/cmake.bbclass | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'meta/classes/cmake.bbclass') diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass index f22d90a1d5..fa7f68c99b 100644 --- a/meta/classes/cmake.bbclass +++ b/meta/classes/cmake.bbclass @@ -4,9 +4,6 @@ OECMAKE_SOURCEPATH ??= "${S}" DEPENDS_prepend = "cmake-native " B = "${WORKDIR}/build" -# We need to unset CCACHE otherwise cmake gets too confused -CCACHE = "" - # What CMake generator to use. # The supported options are "Unix Makefiles" or "Ninja". OECMAKE_GENERATOR ?= "Ninja" @@ -23,10 +20,22 @@ python() { d.setVarFlag("do_compile", "progress", r"outof:^\[(\d+)/(\d+)\]\s+") else: bb.fatal("Unknown CMake Generator %s" % generator) + + # C/C++ Compiler (without cpu arch/tune arguments) + 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])) + 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])) + else: + d.setVar('OECMAKE_CXX_COMPILER', cxx_list[0]) } -# C/C++ Compiler (without cpu arch/tune arguments) -OECMAKE_C_COMPILER ?= "`echo ${CC} | sed 's/^\([^ ]*\).*/\1/'`" -OECMAKE_CXX_COMPILER ?= "`echo ${CXX} | sed 's/^\([^ ]*\).*/\1/'`" OECMAKE_AR ?= "${AR}" # Compiler flags -- cgit 1.2.3-korg