diff options
| author | Daniel McGregor <daniel.mcgregor@vecima.com> | 2020-01-23 15:44:42 -0600 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-02-04 15:56:29 +0000 |
| commit | a26efa2875e99ae9abf68dffe7bd988c3fd8598a (patch) | |
| tree | f9155d40438aa73497d97f6662380e6a65af7bf1 /meta | |
| parent | e6daaf97b3aa39073caa18e0632bb3ff190bbc94 (diff) | |
| download | poky-a26efa2875e99ae9abf68dffe7bd988c3fd8598a.tar.gz | |
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>
Diffstat (limited to 'meta')
| -rw-r--r-- | meta/classes/cmake.bbclass | 5 | ||||
| -rw-r--r-- | 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" | |||
| 63 | 63 | ||
| 64 | EXTRA_OECMAKE_append = " ${PACKAGECONFIG_CONFARGS}" | 64 | EXTRA_OECMAKE_append = " ${PACKAGECONFIG_CONFARGS}" |
| 65 | 65 | ||
| 66 | EXTRA_OECMAKE_BUILD_prepend_task-compile = "${PARALLEL_MAKE} " | 66 | export CMAKE_BUILD_PARALLEL_LEVEL |
| 67 | EXTRA_OECMAKE_BUILD_prepend_task-install = "${PARALLEL_MAKEINST} " | 67 | CMAKE_BUILD_PARALLEL_LEVEL_task-compile = "${@oe.utils.parallel_make(d, False)}" |
| 68 | CMAKE_BUILD_PARALLEL_LEVEL_task-install = "${@oe.utils.parallel_make(d, True)}" | ||
| 68 | 69 | ||
| 69 | OECMAKE_TARGET_COMPILE ?= "all" | 70 | OECMAKE_TARGET_COMPILE ?= "all" |
| 70 | OECMAKE_TARGET_INSTALL ?= "install" | 71 | 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=""): | |||
| 169 | """ | 169 | """ |
| 170 | return bb.utils.contains_any("DISTRO_FEATURES", features, truevalue, falsevalue, d) | 170 | return bb.utils.contains_any("DISTRO_FEATURES", features, truevalue, falsevalue, d) |
| 171 | 171 | ||
| 172 | def parallel_make(d): | 172 | def parallel_make(d, makeinst=False): |
| 173 | """ | 173 | """ |
| 174 | Return the integer value for the number of parallel threads to use when | 174 | Return the integer value for the number of parallel threads to use when |
| 175 | building, scraped out of PARALLEL_MAKE. If no parallelization option is | 175 | building, scraped out of PARALLEL_MAKE. If no parallelization option is |
| @@ -177,7 +177,10 @@ def parallel_make(d): | |||
| 177 | 177 | ||
| 178 | e.g. if PARALLEL_MAKE = "-j 10", this will return 10 as an integer. | 178 | e.g. if PARALLEL_MAKE = "-j 10", this will return 10 as an integer. |
| 179 | """ | 179 | """ |
| 180 | pm = (d.getVar('PARALLEL_MAKE') or '').split() | 180 | if makeinst: |
| 181 | pm = (d.getVar('PARALLEL_MAKEINST') or '').split() | ||
| 182 | else: | ||
| 183 | pm = (d.getVar('PARALLEL_MAKE') or '').split() | ||
| 181 | # look for '-j' and throw other options (e.g. '-l') away | 184 | # look for '-j' and throw other options (e.g. '-l') away |
| 182 | while pm: | 185 | while pm: |
| 183 | opt = pm.pop(0) | 186 | opt = pm.pop(0) |
| @@ -192,7 +195,7 @@ def parallel_make(d): | |||
| 192 | 195 | ||
| 193 | return None | 196 | return None |
| 194 | 197 | ||
| 195 | def parallel_make_argument(d, fmt, limit=None): | 198 | def parallel_make_argument(d, fmt, limit=None, makeinst=False): |
| 196 | """ | 199 | """ |
| 197 | Helper utility to construct a parallel make argument from the number of | 200 | Helper utility to construct a parallel make argument from the number of |
| 198 | parallel threads specified in PARALLEL_MAKE. | 201 | parallel threads specified in PARALLEL_MAKE. |
| @@ -205,7 +208,7 @@ def parallel_make_argument(d, fmt, limit=None): | |||
| 205 | e.g. if PARALLEL_MAKE = "-j 10", parallel_make_argument(d, "-n %d") will return | 208 | e.g. if PARALLEL_MAKE = "-j 10", parallel_make_argument(d, "-n %d") will return |
| 206 | "-n 10" | 209 | "-n 10" |
| 207 | """ | 210 | """ |
| 208 | v = parallel_make(d) | 211 | v = parallel_make(d, makeinst) |
| 209 | if v: | 212 | if v: |
| 210 | if limit: | 213 | if limit: |
| 211 | v = min(limit, v) | 214 | v = min(limit, v) |
