diff options
author | Nathan Rossi <nathan@nathanrossi.com> | 2020-08-08 12:08:43 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-08-10 18:14:59 +0100 |
commit | 9e2c0e57df29122272e28834148ca7956c396e3e (patch) | |
tree | a0a7f8fe8e8b1b6e1bef979067c0c80a14d0e464 | |
parent | e4f6ea6811c59a7c1cdfcd55d861dc8c6d20874b (diff) | |
download | poky-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.bbclass | 36 |
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 | } |
42 | OECMAKE_AR ?= "${AR}" | 25 | OECMAKE_AR ?= "${AR}" |
43 | 26 | ||
@@ -51,8 +34,23 @@ OECMAKE_CXX_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS} ${LD | |||
51 | CXXFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}" | 34 | CXXFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}" |
52 | CFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}" | 35 | CFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}" |
53 | 36 | ||
54 | OECMAKE_C_COMPILER_LAUNCHER ?= "" | 37 | def oecmake_map_compiler(compiler, d): |
55 | OECMAKE_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) | ||
44 | OECMAKE_C_COMPILER ?= "${@oecmake_map_compiler('CC', d)[0]}" | ||
45 | OECMAKE_C_COMPILER_LAUNCHER ?= "${@oecmake_map_compiler('CC', d)[1]}" | ||
46 | OECMAKE_CXX_COMPILER ?= "${@oecmake_map_compiler('CXX', d)[0]}" | ||
47 | OECMAKE_CXX_COMPILER_LAUNCHER ?= "${@oecmake_map_compiler('CXX', d)[1]}" | ||
48 | |||
49 | # clear compiler vars for allarch to avoid sig hash difference | ||
50 | OECMAKE_C_COMPILER_allarch = "" | ||
51 | OECMAKE_C_COMPILER_LAUNCHER_allarch = "" | ||
52 | OECMAKE_CXX_COMPILER_allarch = "" | ||
53 | OECMAKE_CXX_COMPILER_LAUNCHER_allarch = "" | ||
56 | 54 | ||
57 | OECMAKE_RPATH ?= "" | 55 | OECMAKE_RPATH ?= "" |
58 | OECMAKE_PERLNATIVE_DIR ??= "" | 56 | OECMAKE_PERLNATIVE_DIR ??= "" |