From cdd44c93f02bb8cc2fa773e13c8ce36e3da23921 Mon Sep 17 00:00:00 2001 From: Daniel McGregor Date: Thu, 23 Jan 2020 15:44:42 -0600 Subject: cmake: prefer CMAKE_BUILD_PARALLEL_LEVEL cmake 3.12 introduced this environment variable. Prefer it to passing PARALLEL_MAKE and PARALLEL_MAKEINST on the cmake command line, because it gets passed to second stage cmake invocations while command-line arguments do not (for example, multi-stage clang builds) Signed-off-by: Daniel McGregor Signed-off-by: Richard Purdie --- meta/classes/cmake.bbclass | 5 +++-- meta/lib/oe/utils.py | 11 +++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass index a046daa6ea..d91cf20130 100644 --- a/meta/classes/cmake.bbclass +++ b/meta/classes/cmake.bbclass @@ -63,8 +63,9 @@ OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM_class-native = "BOTH" EXTRA_OECMAKE_append = " ${PACKAGECONFIG_CONFARGS}" -EXTRA_OECMAKE_BUILD_prepend_task-compile = "${PARALLEL_MAKE} " -EXTRA_OECMAKE_BUILD_prepend_task-install = "${PARALLEL_MAKEINST} " +export CMAKE_BUILD_PARALLEL_LEVEL +CMAKE_BUILD_PARALLEL_LEVEL_task-compile = "${@oe.utils.parallel_make(d, False)}" +CMAKE_BUILD_PARALLEL_LEVEL_task-install = "${@oe.utils.parallel_make(d, True)}" OECMAKE_TARGET_COMPILE ?= "all" OECMAKE_TARGET_INSTALL ?= "install" diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py index 652b2be145..e350b05ddf 100644 --- a/meta/lib/oe/utils.py +++ b/meta/lib/oe/utils.py @@ -169,7 +169,7 @@ def any_distro_features(d, features, truevalue="1", falsevalue=""): """ return bb.utils.contains_any("DISTRO_FEATURES", features, truevalue, falsevalue, d) -def parallel_make(d): +def parallel_make(d, makeinst=False): """ Return the integer value for the number of parallel threads to use when building, scraped out of PARALLEL_MAKE. If no parallelization option is @@ -177,7 +177,10 @@ def parallel_make(d): e.g. if PARALLEL_MAKE = "-j 10", this will return 10 as an integer. """ - pm = (d.getVar('PARALLEL_MAKE') or '').split() + if makeinst: + pm = (d.getVar('PARALLEL_MAKEINST') or '').split() + else: + pm = (d.getVar('PARALLEL_MAKE') or '').split() # look for '-j' and throw other options (e.g. '-l') away while pm: opt = pm.pop(0) @@ -192,7 +195,7 @@ def parallel_make(d): return None -def parallel_make_argument(d, fmt, limit=None): +def parallel_make_argument(d, fmt, limit=None, makeinst=False): """ Helper utility to construct a parallel make argument from the number of parallel threads specified in PARALLEL_MAKE. @@ -205,7 +208,7 @@ def parallel_make_argument(d, fmt, limit=None): e.g. if PARALLEL_MAKE = "-j 10", parallel_make_argument(d, "-n %d") will return "-n 10" """ - v = parallel_make(d) + v = parallel_make(d, makeinst) if v: if limit: v = min(limit, v) -- cgit 1.2.3-korg