summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Rossi <nathan@nathanrossi.com>2020-08-08 12:08:43 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-08-10 18:14:59 +0100
commit9e2c0e57df29122272e28834148ca7956c396e3e (patch)
treea0a7f8fe8e8b1b6e1bef979067c0c80a14d0e464
parente4f6ea6811c59a7c1cdfcd55d861dc8c6d20874b (diff)
downloadpoky-9e2c0e57df29122272e28834148ca7956c396e3e.tar.gz
cmake.bbclass: Rework compiler program variables for allarch
CMake projects can specify the NONE project type. Projects that do this do not use any C or C++ compiler, this currently works fine with caveat that when changing the machine/arch the compiler is different causing signature hash differences. To avoid the signature hash differences clear the associated C/CXX compiler variables. In order to achieve this with overrides, simplify the existing construction of the values using a python function and variable setting and remove the anonymous variable setup. (From OE-Core rev: e0657ff13453deedbdcf7c2f8a8854f601c659bd) Signed-off-by: Nathan Rossi <nathan@nathanrossi.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/cmake.bbclass36
1 files changed, 17 insertions, 19 deletions
diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
index 8243f7ce8c..7c055e8a3d 100644
--- a/meta/classes/cmake.bbclass
+++ b/meta/classes/cmake.bbclass
@@ -21,23 +21,6 @@ python() {
21 d.setVarFlag("do_compile", "progress", r"outof:^\[(\d+)/(\d+)\]\s+") 21 d.setVarFlag("do_compile", "progress", r"outof:^\[(\d+)/(\d+)\]\s+")
22 else: 22 else:
23 bb.fatal("Unknown CMake Generator %s" % generator) 23 bb.fatal("Unknown CMake Generator %s" % generator)
24
25 # C/C++ Compiler (without cpu arch/tune arguments)
26 if not d.getVar('OECMAKE_C_COMPILER'):
27 cc_list = d.getVar('CC').split()
28 if cc_list[0] == 'ccache':
29 d.setVar('OECMAKE_C_COMPILER_LAUNCHER', cc_list[0])
30 d.setVar('OECMAKE_C_COMPILER', cc_list[1])
31 else:
32 d.setVar('OECMAKE_C_COMPILER', cc_list[0])
33
34 if not d.getVar('OECMAKE_CXX_COMPILER'):
35 cxx_list = d.getVar('CXX').split()
36 if cxx_list[0] == 'ccache':
37 d.setVar('OECMAKE_CXX_COMPILER_LAUNCHER', cxx_list[0])
38 d.setVar('OECMAKE_CXX_COMPILER', cxx_list[1])
39 else:
40 d.setVar('OECMAKE_CXX_COMPILER', cxx_list[0])
41} 24}
42OECMAKE_AR ?= "${AR}" 25OECMAKE_AR ?= "${AR}"
43 26
@@ -51,8 +34,23 @@ OECMAKE_CXX_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS} ${LD
51CXXFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}" 34CXXFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}"
52CFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}" 35CFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}"
53 36
54OECMAKE_C_COMPILER_LAUNCHER ?= "" 37def oecmake_map_compiler(compiler, d):
55OECMAKE_CXX_COMPILER_LAUNCHER ?= "" 38 args = d.getVar(compiler).split()
39 if args[0] == "ccache":
40 return args[1], args[0]
41 return args[0], ""
42
43# C/C++ Compiler (without cpu arch/tune arguments)
44OECMAKE_C_COMPILER ?= "${@oecmake_map_compiler('CC', d)[0]}"
45OECMAKE_C_COMPILER_LAUNCHER ?= "${@oecmake_map_compiler('CC', d)[1]}"
46OECMAKE_CXX_COMPILER ?= "${@oecmake_map_compiler('CXX', d)[0]}"
47OECMAKE_CXX_COMPILER_LAUNCHER ?= "${@oecmake_map_compiler('CXX', d)[1]}"
48
49# clear compiler vars for allarch to avoid sig hash difference
50OECMAKE_C_COMPILER_allarch = ""
51OECMAKE_C_COMPILER_LAUNCHER_allarch = ""
52OECMAKE_CXX_COMPILER_allarch = ""
53OECMAKE_CXX_COMPILER_LAUNCHER_allarch = ""
56 54
57OECMAKE_RPATH ?= "" 55OECMAKE_RPATH ?= ""
58OECMAKE_PERLNATIVE_DIR ??= "" 56OECMAKE_PERLNATIVE_DIR ??= ""