From: Cody P Schafer <dev@codyps.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH v2 2/2] cmake.bbclass: use `cmake --build` to build & install
Date: Thu, 4 May 2017 13:50:42 -0400 [thread overview]
Message-ID: <20170504175042.3164-2-dev@codyps.com> (raw)
In-Reply-To: <20170504175042.3164-1-dev@codyps.com>
Rather than presuming `make` is the generator, use cmake's generic
`cmake --build` feature (which knows to call the appropriate generator).
Both DESTDIR and VERBOSE still behave as intended when used as
environment variables instead of make variable-arguments.
As cmake-based builds don't do any configuration with `make`
invocations, we only pass `PARALLEL_MAKE{,INST}` (via a
EXTRA_OECMAKE_BUILD variable) to the underlying build tool. Make &
ninja support the same `-j N` option (and a few others), so this does
happen to work for both.
This makes it more straight forward for others to select other cmake
generators (many folks have been reaching for `ninja` lately).
CC: Andre McCurdy <armccurdy@gmail.com>
Signed-off-by: Cody P Schafer <dev@codyps.com>
---
meta/classes/cmake.bbclass | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
index 8b5f18d8e0..ac2c1519b0 100644
--- a/meta/classes/cmake.bbclass
+++ b/meta/classes/cmake.bbclass
@@ -31,6 +31,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} "
+
# CMake expects target architectures in the format of uname(2),
# which do not always match TARGET_ARCH, so all the necessary
# conversions should happen here.
@@ -135,11 +138,13 @@ cmake_do_configure() {
do_compile[progress] = "percent"
cmake_do_compile() {
- base_do_compile VERBOSE=1
+ bbnote VERBOSE=1 cmake --build '${B}' -- ${EXTRA_OECMAKE_BUILD}
+ VERBOSE=1 cmake --build '${B}' -- ${EXTRA_OECMAKE_BUILD}
}
cmake_do_install() {
- oe_runmake 'DESTDIR=${D}' install
+ bbnote DESTDIR='${D}' cmake --build '${B}' --target install -- ${EXTRA_OECMAKE_BUILD}
+ DESTDIR='${D}' cmake --build '${B}' --target install -- ${EXTRA_OECMAKE_BUILD}
}
EXPORT_FUNCTIONS do_configure do_compile do_install do_generate_toolchain_file
--
2.12.2
prev parent reply other threads:[~2017-05-04 17:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-04 17:50 [PATCH v2 1/2] cmake.bbclass: remove unneded cd ${B} Cody P Schafer
2017-05-04 17:50 ` Cody P Schafer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170504175042.3164-2-dev@codyps.com \
--to=dev@codyps.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox