mirror of
https://git.yoctoproject.org/poky
synced 2026-09-14 03:49:32 +02:00
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) (From OE-Core rev: cdd44c93f02bb8cc2fa773e13c8ce36e3da23921) Signed-off-by: Daniel McGregor <daniel.mcgregor@vecima.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
e6daaf97b3
commit
a26efa2875
@@ -63,8 +63,9 @@ OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM_class-native = "BOTH"
|
|||||||
|
|
||||||
EXTRA_OECMAKE_append = " ${PACKAGECONFIG_CONFARGS}"
|
EXTRA_OECMAKE_append = " ${PACKAGECONFIG_CONFARGS}"
|
||||||
|
|
||||||
EXTRA_OECMAKE_BUILD_prepend_task-compile = "${PARALLEL_MAKE} "
|
export CMAKE_BUILD_PARALLEL_LEVEL
|
||||||
EXTRA_OECMAKE_BUILD_prepend_task-install = "${PARALLEL_MAKEINST} "
|
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_COMPILE ?= "all"
|
||||||
OECMAKE_TARGET_INSTALL ?= "install"
|
OECMAKE_TARGET_INSTALL ?= "install"
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ def any_distro_features(d, features, truevalue="1", falsevalue=""):
|
|||||||
"""
|
"""
|
||||||
return bb.utils.contains_any("DISTRO_FEATURES", features, truevalue, falsevalue, d)
|
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
|
Return the integer value for the number of parallel threads to use when
|
||||||
building, scraped out of PARALLEL_MAKE. If no parallelization option is
|
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.
|
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
|
# look for '-j' and throw other options (e.g. '-l') away
|
||||||
while pm:
|
while pm:
|
||||||
opt = pm.pop(0)
|
opt = pm.pop(0)
|
||||||
@@ -192,7 +195,7 @@ def parallel_make(d):
|
|||||||
|
|
||||||
return None
|
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
|
Helper utility to construct a parallel make argument from the number of
|
||||||
parallel threads specified in PARALLEL_MAKE.
|
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
|
e.g. if PARALLEL_MAKE = "-j 10", parallel_make_argument(d, "-n %d") will return
|
||||||
"-n 10"
|
"-n 10"
|
||||||
"""
|
"""
|
||||||
v = parallel_make(d)
|
v = parallel_make(d, makeinst)
|
||||||
if v:
|
if v:
|
||||||
if limit:
|
if limit:
|
||||||
v = min(limit, v)
|
v = min(limit, v)
|
||||||
|
|||||||
Reference in New Issue
Block a user