All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] cmake: allow the generator to be changed
@ 2018-01-18 12:38 Ross Burton
  2018-01-18 12:38 ` [PATCH 2/2] cmake: use Ninja by default Ross Burton
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Ross Burton @ 2018-01-18 12:38 UTC (permalink / raw)
  To: openembedded-core

Add OECMAKE_GENERATOR variable to control which generator is used by CMake,
defaulting to the upstream default of Unix Makefiles for now.  The other
supported option is Ninja, which is faster than Make for large projects (for
example, using Ninja takes three minutes off webkitgtk:do_compile for me).

Signed-off-by: Ross Burton <ross.burton@intel.com>
---
 meta/classes/cmake.bbclass | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
index 55698e60e53..74a952142ff 100644
--- a/meta/classes/cmake.bbclass
+++ b/meta/classes/cmake.bbclass
@@ -7,6 +7,23 @@ B = "${WORKDIR}/build"
 # We need to unset CCACHE otherwise cmake gets too confused
 CCACHE = ""
 
+# What CMake generator to use.
+# The supported options are "Unix Makefiles" or "Ninja".
+OECMAKE_GENERATOR ?= "Unix Makefiles"
+
+python() {
+    generator = d.getVar("OECMAKE_GENERATOR")
+    if generator == "Unix Makefiles":
+        args = "-G 'Unix Makefiles' -DCMAKE_MAKE_PROGRAM=" + d.getVar("MAKE")
+        d.setVar("OECMAKE_GENERATOR_ARGS", args)
+        d.setVarFlag("do_compile", "progress", "percent")
+    elif generator == "Ninja":
+        d.appendVar("DEPENDS", " ninja-native")
+        d.setVar("OECMAKE_GENERATOR_ARGS", "-G Ninja -DCMAKE_MAKE_PROGRAM=ninja")
+        d.setVarFlag("do_compile", "progress", "outof:^\[(\d+)/(\d+)\]\s+")
+    else:
+        bb.fatal("Unknown CMake Generator %s" % generator)
+}
 # C/C++ Compiler (without cpu arch/tune arguments)
 OECMAKE_C_COMPILER ?= "`echo ${CC} | sed 's/^\([^ ]*\).*/\1/'`"
 OECMAKE_CXX_COMPILER ?= "`echo ${CXX} | sed 's/^\([^ ]*\).*/\1/'`"
@@ -121,9 +138,9 @@ cmake_do_configure() {
 	fi
 
 	cmake \
+	  ${OECMAKE_GENERATOR_ARGS} \
 	  $oecmake_sitefile \
 	  ${OECMAKE_SOURCEPATH} \
-	  -DCMAKE_MAKE_PROGRAM=${MAKE} \
 	  -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \
 	  -DCMAKE_INSTALL_BINDIR:PATH=${@os.path.relpath(d.getVar('bindir'), d.getVar('prefix'))} \
 	  -DCMAKE_INSTALL_SBINDIR:PATH=${@os.path.relpath(d.getVar('sbindir'), d.getVar('prefix'))} \
@@ -142,7 +159,6 @@ cmake_do_configure() {
 	  -Wno-dev
 }
 
-do_compile[progress] = "percent"
 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}
-- 
2.11.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] cmake: use Ninja by default
  2018-01-18 12:38 [PATCH 1/2] cmake: allow the generator to be changed Ross Burton
@ 2018-01-18 12:38 ` Ross Burton
  2018-01-18 13:04   ` Otavio Salvador
                     ` (2 more replies)
  2018-01-18 13:02 ` ✗ patchtest: failure for "cmake: allow the generator to ..." and 1 more Patchwork
  2018-01-18 13:04 ` [PATCH 1/2] cmake: allow the generator to be changed Otavio Salvador
  2 siblings, 3 replies; 8+ messages in thread
From: Ross Burton @ 2018-01-18 12:38 UTC (permalink / raw)
  To: openembedded-core

This changes the cmake class to use Ninja instead of Make by default.

If a recipe is broken with Ninja then the recipe can set OECMAKE_GENERATOR="Unix
Makefiles" to change back to Make.

Signed-off-by: Ross Burton <ross.burton@intel.com>
---
 meta/classes/cmake.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
index 74a952142ff..d60dad8d66b 100644
--- a/meta/classes/cmake.bbclass
+++ b/meta/classes/cmake.bbclass
@@ -9,7 +9,7 @@ CCACHE = ""
 
 # What CMake generator to use.
 # The supported options are "Unix Makefiles" or "Ninja".
-OECMAKE_GENERATOR ?= "Unix Makefiles"
+OECMAKE_GENERATOR ?= "Ninja"
 
 python() {
     generator = d.getVar("OECMAKE_GENERATOR")
-- 
2.11.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* ✗ patchtest: failure for "cmake: allow the generator to ..." and 1 more
  2018-01-18 12:38 [PATCH 1/2] cmake: allow the generator to be changed Ross Burton
  2018-01-18 12:38 ` [PATCH 2/2] cmake: use Ninja by default Ross Burton
@ 2018-01-18 13:02 ` Patchwork
  2018-01-18 13:04 ` [PATCH 1/2] cmake: allow the generator to be changed Otavio Salvador
  2 siblings, 0 replies; 8+ messages in thread
From: Patchwork @ 2018-01-18 13:02 UTC (permalink / raw)
  To: Ross Burton; +Cc: openembedded-core

== Series Details ==

Series: "cmake: allow the generator to ..." and 1 more
Revision: 1
URL   : https://patchwork.openembedded.org/series/10601/
State : failure

== Summary ==


Thank you for submitting this patch series to OpenEmbedded Core. This is
an automated response. Several tests have been executed on the proposed
series by patchtest resulting in the following failures:



* Issue             Series does not apply on top of target branch [test_series_merge_on_head] 
  Suggested fix    Rebase your series on top of targeted branch
  Targeted branch  master (currently at 6b87ad5b08)



If you believe any of these test results are incorrect, please reply to the
mailing list (openembedded-core@lists.openembedded.org) raising your concerns.
Otherwise we would appreciate you correcting the issues and submitting a new
version of the patchset if applicable. Please ensure you add/increment the
version number when sending the new version (i.e. [PATCH] -> [PATCH v2] ->
[PATCH v3] -> ...).

---
Guidelines:     https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] cmake: allow the generator to be changed
  2018-01-18 12:38 [PATCH 1/2] cmake: allow the generator to be changed Ross Burton
  2018-01-18 12:38 ` [PATCH 2/2] cmake: use Ninja by default Ross Burton
  2018-01-18 13:02 ` ✗ patchtest: failure for "cmake: allow the generator to ..." and 1 more Patchwork
@ 2018-01-18 13:04 ` Otavio Salvador
  2 siblings, 0 replies; 8+ messages in thread
From: Otavio Salvador @ 2018-01-18 13:04 UTC (permalink / raw)
  To: Ross Burton; +Cc: Patches and discussions about the oe-core layer

On Thu, Jan 18, 2018 at 10:38 AM, Ross Burton <ross.burton@intel.com> wrote:
> Add OECMAKE_GENERATOR variable to control which generator is used by CMake,
> defaulting to the upstream default of Unix Makefiles for now.  The other
> supported option is Ninja, which is faster than Make for large projects (for
> example, using Ninja takes three minutes off webkitgtk:do_compile for me).
>
> Signed-off-by: Ross Burton <ross.burton@intel.com>

Acked-by: Otavio Salvador <otavio@ossystems.com.br>


-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] cmake: use Ninja by default
  2018-01-18 12:38 ` [PATCH 2/2] cmake: use Ninja by default Ross Burton
@ 2018-01-18 13:04   ` Otavio Salvador
  2018-01-18 15:02   ` Böszörményi Zoltán
  2018-01-19 23:33   ` Alejandro Enedino Hernandez Samaniego
  2 siblings, 0 replies; 8+ messages in thread
From: Otavio Salvador @ 2018-01-18 13:04 UTC (permalink / raw)
  To: Ross Burton; +Cc: Patches and discussions about the oe-core layer

On Thu, Jan 18, 2018 at 10:38 AM, Ross Burton <ross.burton@intel.com> wrote:
> This changes the cmake class to use Ninja instead of Make by default.
>
> If a recipe is broken with Ninja then the recipe can set OECMAKE_GENERATOR="Unix
> Makefiles" to change back to Make.
>
> Signed-off-by: Ross Burton <ross.burton@intel.com>

Acked-by: Otavio Salvador <otavio@ossystems.com.br>



-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] cmake: use Ninja by default
  2018-01-18 12:38 ` [PATCH 2/2] cmake: use Ninja by default Ross Burton
  2018-01-18 13:04   ` Otavio Salvador
@ 2018-01-18 15:02   ` Böszörményi Zoltán
  2018-01-18 16:02     ` Burton, Ross
  2018-01-19 23:33   ` Alejandro Enedino Hernandez Samaniego
  2 siblings, 1 reply; 8+ messages in thread
From: Böszörményi Zoltán @ 2018-01-18 15:02 UTC (permalink / raw)
  To: Ross Burton, openembedded-core

2018-01-18 13:38 keltezéssel, Ross Burton írta:
> This changes the cmake class to use Ninja instead of Make by default.

Can we still use "oe_runmake [-C subdir] target" with Ninja or
is it considered a broken build and forced to use the "Unix Makefiles" generator?
I have a working mariadb 10.2.12 recipe and the native build is trimmed down
to the absolute necessary pieces:

oe_runmake import_executables
oe_runmake -C libmariadb

Best regards,
Zoltán Böszörményi

> If a recipe is broken with Ninja then the recipe can set OECMAKE_GENERATOR="Unix
> Makefiles" to change back to Make.
> 
> Signed-off-by: Ross Burton <ross.burton@intel.com>
> ---
>   meta/classes/cmake.bbclass | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
> index 74a952142ff..d60dad8d66b 100644
> --- a/meta/classes/cmake.bbclass
> +++ b/meta/classes/cmake.bbclass
> @@ -9,7 +9,7 @@ CCACHE = ""
>   
>   # What CMake generator to use.
>   # The supported options are "Unix Makefiles" or "Ninja".
> -OECMAKE_GENERATOR ?= "Unix Makefiles"
> +OECMAKE_GENERATOR ?= "Ninja"
>   
>   python() {
>       generator = d.getVar("OECMAKE_GENERATOR")
> 



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] cmake: use Ninja by default
  2018-01-18 15:02   ` Böszörményi Zoltán
@ 2018-01-18 16:02     ` Burton, Ross
  0 siblings, 0 replies; 8+ messages in thread
From: Burton, Ross @ 2018-01-18 16:02 UTC (permalink / raw)
  To: Böszörményi Zoltán; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 930 bytes --]

On 18 January 2018 at 15:02, Böszörményi Zoltán <zboszor@pr.hu> wrote:

> 2018-01-18 13:38 keltezéssel, Ross Burton írta:
>
>> This changes the cmake class to use Ninja instead of Make by default.
>>
>
> Can we still use "oe_runmake [-C subdir] target" with Ninja or
> is it considered a broken build and forced to use the "Unix Makefiles"
> generator?
> I have a working mariadb 10.2.12 recipe and the native build is trimmed
> down
> to the absolute necessary pieces:
>
> oe_runmake import_executables
> oe_runmake -C libmariadb
>

Because you're doing -C I suspect you'll need to force it to use makefiles
explicitly, but you can tell cmake what targets to build and the target
names are universal so if you can find a way of doing that without -C then
you can tell cmake to build the specific targets (OECMAKE_TARGET_COMPILE
and _INSTALL)  and then the choice of generator doesn't matter.

Ross

[-- Attachment #2: Type: text/html, Size: 1433 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] cmake: use Ninja by default
  2018-01-18 12:38 ` [PATCH 2/2] cmake: use Ninja by default Ross Burton
  2018-01-18 13:04   ` Otavio Salvador
  2018-01-18 15:02   ` Böszörményi Zoltán
@ 2018-01-19 23:33   ` Alejandro Enedino Hernandez Samaniego
  2 siblings, 0 replies; 8+ messages in thread
From: Alejandro Enedino Hernandez Samaniego @ 2018-01-19 23:33 UTC (permalink / raw)
  To: openembedded-core


On 01/18/2018 04:38 AM, Ross Burton wrote:
> This changes the cmake class to use Ninja instead of Make by default.
>
> If a recipe is broken with Ninja then the recipe can set OECMAKE_GENERATOR="Unix
> Makefiles" to change back to Make.
>
> Signed-off-by: Ross Burton <ross.burton@intel.com>
> ---
>   meta/classes/cmake.bbclass | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
> index 74a952142ff..d60dad8d66b 100644
> --- a/meta/classes/cmake.bbclass
> +++ b/meta/classes/cmake.bbclass
> @@ -9,7 +9,7 @@ CCACHE = ""
>   
>   # What CMake generator to use.
>   # The supported options are "Unix Makefiles" or "Ninja".
> -OECMAKE_GENERATOR ?= "Unix Makefiles"
> +OECMAKE_GENERATOR ?= "Ninja"
>   
>   python() {
>       generator = d.getVar("OECMAKE_GENERATOR")

Awesome, testing it now!

Alejandro

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-01-20  0:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-18 12:38 [PATCH 1/2] cmake: allow the generator to be changed Ross Burton
2018-01-18 12:38 ` [PATCH 2/2] cmake: use Ninja by default Ross Burton
2018-01-18 13:04   ` Otavio Salvador
2018-01-18 15:02   ` Böszörményi Zoltán
2018-01-18 16:02     ` Burton, Ross
2018-01-19 23:33   ` Alejandro Enedino Hernandez Samaniego
2018-01-18 13:02 ` ✗ patchtest: failure for "cmake: allow the generator to ..." and 1 more Patchwork
2018-01-18 13:04 ` [PATCH 1/2] cmake: allow the generator to be changed Otavio Salvador

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.