[oe-commits] [openembedded-core] 11/56: cmake: refactor compile and install for easier re-use

git at git.openembedded.org git at git.openembedded.org
Sat Mar 3 09:13:36 UTC 2018


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit bd0932a9d11534177013da7a761e1e2c70d05e50
Author: André Draszik <andre.draszik at jci.com>
AuthorDate: Fri Feb 23 14:50:13 2018 +0000

    cmake: refactor compile and install for easier re-use
    
    cmake_do_compile() and cmake_do_install() basically do the
    same, except they use a different --target, and at the
    moment this is copy/pasted code with a minor modification.
    
    Other recipes which e.g. might want to support compilation
    as part of ptest have to do the same. This is a bit
    inconvenient.
    
    By factoring out all of this into a common helper,
    cmake_runcmake_build(), this is easily re-used. An
    (imaginary) recipe can compile ptest support simply by
    using
      cmake_runcmake_build --target buildtest-TESTS
    (assuming such a build target exists).
    
    Also, this now is very similar to oe_runmake().
    
    Signed-off-by: André Draszik <andre.draszik at jci.com>
    Signed-off-by: Ross Burton <ross.burton at intel.com>
---
 meta/classes/cmake.bbclass | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
index d60dad8..fcfd5dd 100644
--- a/meta/classes/cmake.bbclass
+++ b/meta/classes/cmake.bbclass
@@ -159,14 +159,17 @@ cmake_do_configure() {
 	  -Wno-dev
 }
 
+cmake_runcmake_build() {
+	bbnote ${DESTDIR:+DESTDIR=${DESTDIR} }VERBOSE=1 cmake --build '${B}' "$@" -- ${EXTRA_OECMAKE_BUILD}
+	eval ${DESTDIR:+DESTDIR=${DESTDIR} }VERBOSE=1 cmake --build '${B}' "$@" -- ${EXTRA_OECMAKE_BUILD}
+}
+
 cmake_do_compile()  {
-	bbnote VERBOSE=1 cmake --build '${B}' --target ${OECMAKE_TARGET_COMPILE} -- ${EXTRA_OECMAKE_BUILD}
-	VERBOSE=1 cmake --build '${B}' --target ${OECMAKE_TARGET_COMPILE} -- ${EXTRA_OECMAKE_BUILD}
+	cmake_runcmake_build --target ${OECMAKE_TARGET_COMPILE}
 }
 
 cmake_do_install() {
-	bbnote DESTDIR='${D}' cmake --build '${B}' --target ${OECMAKE_TARGET_INSTALL} -- ${EXTRA_OECMAKE_BUILD}
-	DESTDIR='${D}' cmake --build '${B}' --target ${OECMAKE_TARGET_INSTALL} -- ${EXTRA_OECMAKE_BUILD}
+	DESTDIR='${D}' cmake_runcmake_build --target ${OECMAKE_TARGET_INSTALL}
 }
 
 EXPORT_FUNCTIONS do_configure do_compile do_install do_generate_toolchain_file

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list