Skip to contentSkip to conversation

pkg-cmake: add option to select the Ninja generator

PATCH Superseded Thomas Devoogdt 2 participants 17 messages May 16, 2023 – Oct 7, 2023

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/4 pkg-cmake: add option to select the Ninja generator

From: Thomas Devoogdt <[email protected]>

Cmake supports multiple generators. Ninja is a small build system with a focus on speed. It is mainly used with the meson build system, but also cmake has very good support for it. This adds optional support for the Ninja build system.

Usage:
<package>_CMAKE_NINJA = YES

E.g. Commit 16e5c92ff5fd2b44a1126bd7d7538c68ce838213 can now be replaced by:
WEBKITGTK_CMAKE_NINJA = YES

Packages that are selecting Ninja (or overtime another generator), should also use the _BUILD_{ENV,OPTS} variables iso the _MAKE variables.

No _INSTALL{,_STAGING,_TARGET}_OPTS used so far, so reuse as cmake install opts:

    $ grep '_INSTALL_OPTS' $(grep -rl "cmake-package" package/*/*.mk)
    $ grep '_INSTALL_STAGING_OPTS' $(grep -rl "cmake-package" package/*/*.mk)
    $ grep '_INSTALL_TARGET_OPTS' $(grep -rl "cmake-package" package/*/*.mk)

The _MAKE_{ENV,OPTS} are copied to _BUILD_{ENV,OPTS}, involved packages:

    $ grep '_MAKE_ENV =' $(grep -rl "cmake-package" package/*/*.mk)
    package/netopeer2/netopeer2.mk:NETOPEER2_MAKE_ENV = \
    package/racehound/racehound.mk:RACEHOUND_MAKE_ENV = $(LINUX_MAKE_FLAGS)

    $ grep '_MAKE_OPTS =' $(grep -rl "cmake-package" package/*/*.mk)

    package/mariadb/mariadb.mk:HOST_MARIADB_MAKE_OPTS = import_executables
    package/zeek/zeek.mk:HOST_ZEEK_MAKE_OPTS = binpac bifcl

Only "musepack" seems to overwrite MAKE to enforce -j1, so replace it:

    $ grep '_MAKE =' $(grep -rl "cmake-package" package/*/*.mk)
    package/musepack/musepack.mk:MUSEPACK_MAKE = $(MAKE1)

---
v2:
- made generator use more generic, other generators can now easily be added if required
v3:
- add _GENERATOR_PROGRAM
- add _GENERATOR_PARALLEL for make
- dropped BUILD_OPTS
- fix gdal.mk
v4:
- restored _MAKE_ENV/_MAKE_OPTS for the Unix Makefiles case
- always set -j$(PARALLEL_JOBS)
v5:
- reword commit slightly

---
 package/musepack/musepack.mk |  2 +-
 package/pkg-cmake.mk         | 35 +++++++++++++++++++++++------------
 2 files changed, 24 insertions(+), 13 deletions(-)
package/musepack/musepack.mk +1 -1
index fc66c684a5..d4dd08df36 100644
@@ -9,7 +9,7 @@ MUSEPACK_SITE = http://files.musepack.net/source
 MUSEPACK_SOURCE = musepack_src_$(MUSEPACK_VERSION).tar.gz
 MUSEPACK_DEPENDENCIES = libcuefile libreplaygain
 MUSEPACK_INSTALL_STAGING = YES
-MUSEPACK_MAKE = $(MAKE1)
+MUSEPACK_BUILD_OPTS = -j1
 MUSEPACK_LICENSE = BSD-3-Clause (*mpcdec), LGPL-2.1+ (*mpcenc)
 MUSEPACK_LICENSE_FILES = libmpcdec/COPYING libmpcenc/quant.c
 
package/pkg-cmake.mk +23 -12
index 8c375779cb..36ab88d3a1 100644
@@ -51,11 +51,6 @@ endif
 
 define inner-cmake-package
 
-$(2)_MAKE			?= $$(MAKE)
-$(2)_INSTALL_OPTS		?= install
-$(2)_INSTALL_STAGING_OPTS	?= DESTDIR=$$(STAGING_DIR) install/fast
-$(2)_INSTALL_TARGET_OPTS	?= DESTDIR=$$(TARGET_DIR) install/fast
-
 $(3)_SUPPORTS_IN_SOURCE_BUILD ?= YES
 
 
@@ -65,6 +60,20 @@ else
 $(2)_BUILDDIR			= $$($(2)_SRCDIR)/buildroot-build
 endif
 
+ifeq ($$($(3)_CMAKE_NINJA),YES)
+$(2)_DEPENDENCIES	+= host-ninja
+$(2)_GENERATOR		= "Ninja"
+$(2)_GENERATOR_PROGRAM	= $(HOST_DIR)/bin/ninja
+else
+$(2)_GENERATOR		= "Unix Makefiles"
+$(2)_GENERATOR_PROGRAM	= $(firstword $(BR2_MAKE))
+
+# Generator specific code (make) should be avoided,
+# but for now, copy them to the new variables.
+$(2)_BUILD_ENV		?= $$($(2)_MAKE_ENV)
+$(2)_BUILD_OPTS		?= -- $$($(2)_MAKE_OPTS)
+endif
+
 #
 # Configure step. Only define it if not already defined by the package
 # .mk file. And take care of the differences between host and target
@@ -88,7 +97,8 @@ define $(2)_CONFIGURE_CMDS
 	rm -f CMakeCache.txt && \
 	PATH=$$(BR_PATH) \
 	$$($$(PKG)_CONF_ENV) $$(BR2_CMAKE) $$($$(PKG)_SRCDIR) \
-		-G"Unix Makefiles" \
+		-G$$($$(PKG)_GENERATOR) \
+		-DCMAKE_MAKE_PROGRAM="$$($$(PKG)_GENERATOR_PROGRAM)" \
 		-DCMAKE_TOOLCHAIN_FILE="$$(HOST_DIR)/share/buildroot/toolchainfile.cmake" \
 		-DCMAKE_INSTALL_PREFIX="/usr" \
 		-DCMAKE_INSTALL_RUNSTATEDIR="/run" \
@@ -119,7 +129,8 @@ define $(2)_CONFIGURE_CMDS
 	PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 \
 	PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 \
 	$$($$(PKG)_CONF_ENV) $$(BR2_CMAKE) $$($$(PKG)_SRCDIR) \
-		-G"Unix Makefiles" \
+		-G$$($$(PKG)_GENERATOR) \
+		-DCMAKE_MAKE_PROGRAM="$$($$(PKG)_GENERATOR_PROGRAM)" \
 		-DCMAKE_INSTALL_SO_NO_EXE=0 \
 		-DCMAKE_FIND_ROOT_PATH="$$(HOST_DIR)" \
 		-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM="BOTH" \
@@ -166,11 +177,11 @@ $(2)_DEPENDENCIES += $(BR2_CMAKE_HOST_DEPENDENCY)
 ifndef $(2)_BUILD_CMDS
 ifeq ($(4),target)
 define $(2)_BUILD_CMDS
-	$$(TARGET_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_MAKE_OPTS) -C $$($$(PKG)_BUILDDIR)
+	$$(TARGET_MAKE_ENV) $$($$(PKG)_BUILD_ENV) $$(BR2_CMAKE) --build $$($$(PKG)_BUILDDIR) -j$(PARALLEL_JOBS) $$($$(PKG)_BUILD_OPTS)
 endef
 else
 define $(2)_BUILD_CMDS
-	$$(HOST_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_MAKE_OPTS) -C $$($$(PKG)_BUILDDIR)
+	$$(HOST_MAKE_ENV) $$($$(PKG)_BUILD_ENV) $$(BR2_CMAKE) --build $$($$(PKG)_BUILDDIR) -j$(PARALLEL_JOBS) $$($$(PKG)_BUILD_OPTS)
 endef
 endif
 endif
@@ -181,7 +192,7 @@ endif
 #
 ifndef $(2)_INSTALL_CMDS
 define $(2)_INSTALL_CMDS
-	$$(HOST_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_MAKE_OPTS) $$($$(PKG)_INSTALL_OPTS) -C $$($$(PKG)_BUILDDIR)
+	$$(HOST_MAKE_ENV) $$($$(PKG)_BUILD_ENV) $$(BR2_CMAKE) --install $$($$(PKG)_BUILDDIR) $$($$(PKG)_INSTALL_OPTS)
 endef
 endif
 
@@ -191,7 +202,7 @@ endif
 #
 ifndef $(2)_INSTALL_STAGING_CMDS
 define $(2)_INSTALL_STAGING_CMDS
-	$$(TARGET_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_MAKE_OPTS) $$($$(PKG)_INSTALL_STAGING_OPTS) -C $$($$(PKG)_BUILDDIR)
+	$$(TARGET_MAKE_ENV) $$($$(PKG)_BUILD_ENV) DESTDIR=$$(STAGING_DIR) $$(BR2_CMAKE) --install $$($$(PKG)_BUILDDIR) $$($$(PKG)_INSTALL_STAGING_OPTS)
 endef
 endif
 
@@ -201,7 +212,7 @@ endif
 #
 ifndef $(2)_INSTALL_TARGET_CMDS
 define $(2)_INSTALL_TARGET_CMDS
-	$$(TARGET_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_MAKE_OPTS) $$($$(PKG)_INSTALL_TARGET_OPTS) -C $$($$(PKG)_BUILDDIR)
+	$$(TARGET_MAKE_ENV) $$($$(PKG)_BUILD_ENV) DESTDIR=$$(TARGET_DIR) $$(BR2_CMAKE) --install $$($$(PKG)_BUILDDIR) $$($$(PKG)_INSTALL_TARGET_OPTS)
 endef
 endif
 
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH v5 2/4 package/webkitgtk: use the CMAKE_NINJA flag

From: Thomas Devoogdt <[email protected]>

Replaces:

commit 16e5c92ff5fd2b44a1126bd7d7538c68ce838213

Author: Peter Korsgaard <[email protected]>
Date:   Thu Feb 9 18:07:05 2023 +0100

package/webkitgtk: Build with ninja

Webkitgtk needs cmake >= 3.20 when building with the make backend since webkitgtk 3.8.0.

Cmake 3.20 is above our minimal version in support/dependencies/check-host-cmake.mk, so this breaks builds on hosts with cmake >= 3.18 < 3.20 - So use the ninja backend instead.

https://github.com/WebKit/WebKit/commit/6cd89696b5d406c1a3d9a7a9bbb18fda9284fa1f

---
v5: no change

---
 package/webkitgtk/webkitgtk.mk | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)
package/webkitgtk/webkitgtk.mk +1 -19
index dd17b46e67..5184c69dbf 100644
@@ -13,6 +13,7 @@ WEBKITGTK_LICENSE_FILES = \
 	Source/WebCore/LICENSE-APPLE \
 	Source/WebCore/LICENSE-LGPL-2.1
 WEBKITGTK_CPE_ID_VENDOR = webkitgtk
+WEBKITGTK_CMAKE_NINJA = YES
 WEBKITGTK_DEPENDENCIES = host-ruby host-python3 host-gperf \
 	enchant harfbuzz icu jpeg libgcrypt libgtk3 libsecret libsoup \
 	libtasn1 libxml2 libxslt openjpeg sqlite webp woff2
@@ -139,23 +140,4 @@ ifeq ($(BR2_ARM_CPU_ARMV5)$(BR2_ARM_CPU_ARMV6)$(BR2_MIPS_CPU_MIPS32R6)$(BR2_MIPS
 WEBKITGTK_CONF_OPTS += -DENABLE_JIT=OFF -DENABLE_C_LOOP=ON -DENABLE_SAMPLING_PROFILER=OFF
 endif
 
-# webkitgtk needs cmake >= 3.20 when not building with ninja, which is
-# above our minimal version in
-# support/dependencies/check-host-cmake.mk, so use the ninja backend:
-# https://github.com/WebKit/WebKit/commit/6cd89696b5d406c1a3d9a7a9bbb18fda9284fa1f
-WEBKITGTK_CONF_OPTS += -GNinja
-WEBKITGTK_DEPENDENCIES += host-ninja
-
-define WEBKITGTK_BUILD_CMDS
-	$(TARGET_MAKE_ENV) $(BR2_CMAKE) --build $(WEBKITGTK_BUILDDIR)
-endef
-
-define WEBKITGTK_INSTALL_STAGING_CMDS
-	$(TARGET_MAKE_ENV) DESTDIR=$(STAGING_DIR) $(BR2_CMAKE) --install $(WEBKITGTK_BUILDDIR)
-endef
-
-define WEBKITGTK_INSTALL_TARGET_CMDS
-	$(TARGET_MAKE_ENV) DESTDIR=$(TARGET_DIR) $(BR2_CMAKE) --install $(WEBKITGTK_BUILDDIR)
-endef
-
 $(eval $(cmake-package))
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

PATCH v5 3/4 package/wpewebkit: use the CMAKE_NINJA flag

In reply to Thomas Devoogdt

From: Thomas Devoogdt <[email protected]>

Replaces:

commit 78d499409f71d8a22b0632c8ebc06f67ee6ae6dd

Author: Peter Korsgaard <[email protected]>
Date:   Thu Feb 9 18:07:06 2023 +0100

package/wpewebkit: Build with ninja

Wpewebkit needs cmake >= 3.20 when building with the make backend since wpewebkit 3.8.0.

Cmake 3.20 is above our minimal version in support/dependencies/check-host-cmake.mk, so this breaks builds on hosts with cmake >= 3.18 < 3.20 - So use the ninja backend instead.

https://github.com/WebKit/WebKit/commit/6cd89696b5d406c1a3d9a7a9bbb18fda9284fa1f

---
v5: no change

---
 package/wpewebkit/wpewebkit.mk | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)
package/wpewebkit/wpewebkit.mk +1 -19
index 7b8ac67d92..27745570bc 100644
@@ -14,6 +14,7 @@ WPEWEBKIT_LICENSE_FILES = \
 	Source/WebCore/LICENSE-LGPL-2.1
 WPEWEBKIT_CPE_ID_VENDOR = wpewebkit
 WPEWEBKIT_CPE_ID_PRODUCT = wpe_webkit
+WPEWEBKIT_CMAKE_NINJA = YES
 WPEWEBKIT_DEPENDENCIES = host-gperf host-python3 host-ruby \
 	harfbuzz cairo icu jpeg libepoxy libgcrypt libgles libsoup libtasn1 \
 	libpng libxslt openjpeg wayland-protocols webp wpebackend-fdo
@@ -103,23 +104,4 @@ ifeq ($(BR2_ARM_CPU_ARMV5)$(BR2_ARM_CPU_ARMV6)$(BR2_MIPS_CPU_MIPS32R6)$(BR2_MIPS
 WPEWEBKIT_CONF_OPTS += -DENABLE_JIT=OFF -DENABLE_C_LOOP=ON -DENABLE_SAMPLING_PROFILER=OFF
 endif
 
-# wpewebkit needs cmake >= 3.20 when building with the make backend, which is
-# above our minimal version in
-# support/dependencies/check-host-cmake.mk, so use the ninja backend:
-# https://github.com/WebKit/WebKit/commit/6cd89696b5d406c1a3d9a7a9bbb18fda9284fa1f
-WPEWEBKIT_CONF_OPTS += -GNinja
-WPEWEBKIT_DEPENDENCIES += host-ninja
-
-define WPEWEBKIT_BUILD_CMDS
-	$(TARGET_MAKE_ENV) $(BR2_CMAKE) --build $(WPEWEBKIT_BUILDDIR)
-endef
-
-define WPEWEBKIT_INSTALL_STAGING_CMDS
-	$(TARGET_MAKE_ENV) DESTDIR=$(STAGING_DIR) $(BR2_CMAKE) --install $(WPEWEBKIT_BUILDDIR)
-endef
-
-define WPEWEBKIT_INSTALL_TARGET_CMDS
-	$(TARGET_MAKE_ENV) DESTDIR=$(TARGET_DIR) $(BR2_CMAKE) --install $(WPEWEBKIT_BUILDDIR)
-endef
-
 $(eval $(cmake-package))
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw

PATCH v5 4/4 pkg-cmake: make ninja the default for all packages

In reply to Thomas Devoogdt

From: Thomas Devoogdt <[email protected]>

Use ninja as the default generator.
A fun fact is that we of course have to disable ninja when building ninja.

---
v5: add this optional commit

---
 package/ninja/ninja.mk | 1 +
 package/pkg-cmake.mk   | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
package/ninja/ninja.mk +1 -0
index b7bc1a4f1c..85dd2e05aa 100644
@@ -9,6 +9,7 @@ NINJA_VERSION = $(NINJA_VERSION_MAJOR).g95dee.kitware.jobserver-1
 NINJA_SITE = $(call github,Kitware,ninja,v$(NINJA_VERSION))
 NINJA_LICENSE = Apache-2.0
 NINJA_LICENSE_FILES = COPYING
+NINJA_CMAKE_NINJA = NO
 
 define HOST_NINJA_INSTALL_CMDS
 	$(INSTALL) -m 0755 -D $(@D)/ninja $(HOST_DIR)/bin/ninja
package/pkg-cmake.mk +1 -1
index 36ab88d3a1..dab87c81f4 100644
@@ -52,7 +52,7 @@ endif
 define inner-cmake-package
 
 $(3)_SUPPORTS_IN_SOURCE_BUILD ?= YES
-
+$(3)_CMAKE_NINJA ?= YES
 
 ifeq ($$($(3)_SUPPORTS_IN_SOURCE_BUILD),YES)
 $(2)_BUILDDIR			= $$($(2)_SRCDIR)
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#4 lore raw

PATCH v6 1/4 pkg-cmake: add option to select the Ninja generator

In reply to Thomas Devoogdt

From: Thomas Devoogdt <[email protected]>

Cmake supports multiple generators. Ninja is a small build system with a focus on speed. It is mainly used with the meson build system, but also cmake has very good support for it. This adds optional support for the Ninja build system.

Usage:
<package>_CMAKE_NINJA = YES

E.g. Commit 16e5c92ff5fd2b44a1126bd7d7538c68ce838213 can now be replaced by:
WEBKITGTK_CMAKE_NINJA = YES

Packages that are selecting Ninja (or overtime another generator), should also use the _BUILD_{ENV,OPTS} variables iso the _MAKE variables.

No _INSTALL{,_STAGING,_TARGET}_OPTS used so far, so reuse as cmake install opts:

    $ grep '_INSTALL_OPTS' $(grep -rl "cmake-package" package/*/*.mk)
    $ grep '_INSTALL_STAGING_OPTS' $(grep -rl "cmake-package" package/*/*.mk)
    $ grep '_INSTALL_TARGET_OPTS' $(grep -rl "cmake-package" package/*/*.mk)

The _MAKE_{ENV,OPTS} are copied to _BUILD_{ENV,OPTS}, involved packages:

    $ grep '_MAKE_ENV =' $(grep -rl "cmake-package" package/*/*.mk)
    package/netopeer2/netopeer2.mk:NETOPEER2_MAKE_ENV = \
    package/racehound/racehound.mk:RACEHOUND_MAKE_ENV = $(LINUX_MAKE_FLAGS)

    $ grep '_MAKE_OPTS =' $(grep -rl "cmake-package" package/*/*.mk)

    package/mariadb/mariadb.mk:HOST_MARIADB_MAKE_OPTS = import_executables
    package/zeek/zeek.mk:HOST_ZEEK_MAKE_OPTS = binpac bifcl

Only "musepack" seems to overwrite MAKE to enforce -j1, so replace it:

    $ grep '_MAKE =' $(grep -rl "cmake-package" package/*/*.mk)
    package/musepack/musepack.mk:MUSEPACK_MAKE = $(MAKE1)

---
v2:
- made generator use more generic, other generators can now easily be added if required
v3:
- add _GENERATOR_PROGRAM
- add _GENERATOR_PARALLEL for make
- dropped BUILD_OPTS
- fix gdal.mk
v4:
- restored _MAKE_ENV/_MAKE_OPTS for the Unix Makefiles case
- always set -j$(PARALLEL_JOBS)
v5:
- reword commit slightly
v6:
- rebase

---
 package/musepack/musepack.mk |  2 +-
 package/pkg-cmake.mk         | 35 +++++++++++++++++++++++------------
 2 files changed, 24 insertions(+), 13 deletions(-)
package/musepack/musepack.mk +1 -1
index fc66c684a5..d4dd08df36 100644
@@ -9,7 +9,7 @@ MUSEPACK_SITE = http://files.musepack.net/source
 MUSEPACK_SOURCE = musepack_src_$(MUSEPACK_VERSION).tar.gz
 MUSEPACK_DEPENDENCIES = libcuefile libreplaygain
 MUSEPACK_INSTALL_STAGING = YES
-MUSEPACK_MAKE = $(MAKE1)
+MUSEPACK_BUILD_OPTS = -j1
 MUSEPACK_LICENSE = BSD-3-Clause (*mpcdec), LGPL-2.1+ (*mpcenc)
 MUSEPACK_LICENSE_FILES = libmpcdec/COPYING libmpcenc/quant.c
 
package/pkg-cmake.mk +23 -12
index 8c375779cb..36ab88d3a1 100644
@@ -51,11 +51,6 @@ endif
 
 define inner-cmake-package
 
-$(2)_MAKE			?= $$(MAKE)
-$(2)_INSTALL_OPTS		?= install
-$(2)_INSTALL_STAGING_OPTS	?= DESTDIR=$$(STAGING_DIR) install/fast
-$(2)_INSTALL_TARGET_OPTS	?= DESTDIR=$$(TARGET_DIR) install/fast
-
 $(3)_SUPPORTS_IN_SOURCE_BUILD ?= YES
 
 
@@ -65,6 +60,20 @@ else
 $(2)_BUILDDIR			= $$($(2)_SRCDIR)/buildroot-build
 endif
 
+ifeq ($$($(3)_CMAKE_NINJA),YES)
+$(2)_DEPENDENCIES	+= host-ninja
+$(2)_GENERATOR		= "Ninja"
+$(2)_GENERATOR_PROGRAM	= $(HOST_DIR)/bin/ninja
+else
+$(2)_GENERATOR		= "Unix Makefiles"
+$(2)_GENERATOR_PROGRAM	= $(firstword $(BR2_MAKE))
+
+# Generator specific code (make) should be avoided,
+# but for now, copy them to the new variables.
+$(2)_BUILD_ENV		?= $$($(2)_MAKE_ENV)
+$(2)_BUILD_OPTS		?= -- $$($(2)_MAKE_OPTS)
+endif
+
 #
 # Configure step. Only define it if not already defined by the package
 # .mk file. And take care of the differences between host and target
@@ -88,7 +97,8 @@ define $(2)_CONFIGURE_CMDS
 	rm -f CMakeCache.txt && \
 	PATH=$$(BR_PATH) \
 	$$($$(PKG)_CONF_ENV) $$(BR2_CMAKE) $$($$(PKG)_SRCDIR) \
-		-G"Unix Makefiles" \
+		-G$$($$(PKG)_GENERATOR) \
+		-DCMAKE_MAKE_PROGRAM="$$($$(PKG)_GENERATOR_PROGRAM)" \
 		-DCMAKE_TOOLCHAIN_FILE="$$(HOST_DIR)/share/buildroot/toolchainfile.cmake" \
 		-DCMAKE_INSTALL_PREFIX="/usr" \
 		-DCMAKE_INSTALL_RUNSTATEDIR="/run" \
@@ -119,7 +129,8 @@ define $(2)_CONFIGURE_CMDS
 	PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 \
 	PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 \
 	$$($$(PKG)_CONF_ENV) $$(BR2_CMAKE) $$($$(PKG)_SRCDIR) \
-		-G"Unix Makefiles" \
+		-G$$($$(PKG)_GENERATOR) \
+		-DCMAKE_MAKE_PROGRAM="$$($$(PKG)_GENERATOR_PROGRAM)" \
 		-DCMAKE_INSTALL_SO_NO_EXE=0 \
 		-DCMAKE_FIND_ROOT_PATH="$$(HOST_DIR)" \
 		-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM="BOTH" \
@@ -166,11 +177,11 @@ $(2)_DEPENDENCIES += $(BR2_CMAKE_HOST_DEPENDENCY)
 ifndef $(2)_BUILD_CMDS
 ifeq ($(4),target)
 define $(2)_BUILD_CMDS
-	$$(TARGET_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_MAKE_OPTS) -C $$($$(PKG)_BUILDDIR)
+	$$(TARGET_MAKE_ENV) $$($$(PKG)_BUILD_ENV) $$(BR2_CMAKE) --build $$($$(PKG)_BUILDDIR) -j$(PARALLEL_JOBS) $$($$(PKG)_BUILD_OPTS)
 endef
 else
 define $(2)_BUILD_CMDS
-	$$(HOST_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_MAKE_OPTS) -C $$($$(PKG)_BUILDDIR)
+	$$(HOST_MAKE_ENV) $$($$(PKG)_BUILD_ENV) $$(BR2_CMAKE) --build $$($$(PKG)_BUILDDIR) -j$(PARALLEL_JOBS) $$($$(PKG)_BUILD_OPTS)
 endef
 endif
 endif
@@ -181,7 +192,7 @@ endif
 #
 ifndef $(2)_INSTALL_CMDS
 define $(2)_INSTALL_CMDS
-	$$(HOST_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_MAKE_OPTS) $$($$(PKG)_INSTALL_OPTS) -C $$($$(PKG)_BUILDDIR)
+	$$(HOST_MAKE_ENV) $$($$(PKG)_BUILD_ENV) $$(BR2_CMAKE) --install $$($$(PKG)_BUILDDIR) $$($$(PKG)_INSTALL_OPTS)
 endef
 endif
 
@@ -191,7 +202,7 @@ endif
 #
 ifndef $(2)_INSTALL_STAGING_CMDS
 define $(2)_INSTALL_STAGING_CMDS
-	$$(TARGET_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_MAKE_OPTS) $$($$(PKG)_INSTALL_STAGING_OPTS) -C $$($$(PKG)_BUILDDIR)
+	$$(TARGET_MAKE_ENV) $$($$(PKG)_BUILD_ENV) DESTDIR=$$(STAGING_DIR) $$(BR2_CMAKE) --install $$($$(PKG)_BUILDDIR) $$($$(PKG)_INSTALL_STAGING_OPTS)
 endef
 endif
 
@@ -201,7 +212,7 @@ endif
 #
 ifndef $(2)_INSTALL_TARGET_CMDS
 define $(2)_INSTALL_TARGET_CMDS
-	$$(TARGET_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_MAKE_OPTS) $$($$(PKG)_INSTALL_TARGET_OPTS) -C $$($$(PKG)_BUILDDIR)
+	$$(TARGET_MAKE_ENV) $$($$(PKG)_BUILD_ENV) DESTDIR=$$(TARGET_DIR) $$(BR2_CMAKE) --install $$($$(PKG)_BUILDDIR) $$($$(PKG)_INSTALL_TARGET_OPTS)
 endef
 endif
 
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#5 lore raw

PATCH v6 2/4 package/webkitgtk: use the CMAKE_NINJA flag

From: Thomas Devoogdt <[email protected]>

Replaces:

commit 16e5c92ff5fd2b44a1126bd7d7538c68ce838213

Author: Peter Korsgaard <[email protected]>
Date:   Thu Feb 9 18:07:05 2023 +0100

package/webkitgtk: Build with ninja

Webkitgtk needs cmake >= 3.20 when building with the make backend since webkitgtk 3.8.0.

Cmake 3.20 is above our minimal version in support/dependencies/check-host-cmake.mk, so this breaks builds on hosts with cmake >= 3.18 < 3.20 - So use the ninja backend instead.

https://github.com/WebKit/WebKit/commit/6cd89696b5d406c1a3d9a7a9bbb18fda9284fa1f

---
v5: no change
v6: rebase

---
 package/webkitgtk/webkitgtk.mk | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)
package/webkitgtk/webkitgtk.mk +1 -19
index 56277a0a0a..aa1c11f7cd 100644
@@ -13,6 +13,7 @@ WEBKITGTK_LICENSE_FILES = \
 	Source/WebCore/LICENSE-APPLE \
 	Source/WebCore/LICENSE-LGPL-2.1
 WEBKITGTK_CPE_ID_VENDOR = webkitgtk
+WEBKITGTK_CMAKE_NINJA = YES
 WEBKITGTK_DEPENDENCIES = host-ruby host-python3 host-gperf host-unifdef \
 	enchant harfbuzz icu jpeg libgcrypt libgtk3 libsecret libsoup \
 	libtasn1 libxml2 libxslt openjpeg sqlite webp woff2
@@ -140,23 +141,4 @@ ifeq ($(BR2_ARM_CPU_ARMV5)$(BR2_ARM_CPU_ARMV6)$(BR2_MIPS_CPU_MIPS32R6)$(BR2_MIPS
 WEBKITGTK_CONF_OPTS += -DENABLE_JIT=OFF -DENABLE_C_LOOP=ON -DENABLE_SAMPLING_PROFILER=OFF
 endif
 
-# webkitgtk needs cmake >= 3.20 when not building with ninja, which is
-# above our minimal version in
-# support/dependencies/check-host-cmake.mk, so use the ninja backend:
-# https://github.com/WebKit/WebKit/commit/6cd89696b5d406c1a3d9a7a9bbb18fda9284fa1f
-WEBKITGTK_CONF_OPTS += -GNinja
-WEBKITGTK_DEPENDENCIES += host-ninja
-
-define WEBKITGTK_BUILD_CMDS
-	$(TARGET_MAKE_ENV) $(BR2_CMAKE) --build $(WEBKITGTK_BUILDDIR)
-endef
-
-define WEBKITGTK_INSTALL_STAGING_CMDS
-	$(TARGET_MAKE_ENV) DESTDIR=$(STAGING_DIR) $(BR2_CMAKE) --install $(WEBKITGTK_BUILDDIR)
-endef
-
-define WEBKITGTK_INSTALL_TARGET_CMDS
-	$(TARGET_MAKE_ENV) DESTDIR=$(TARGET_DIR) $(BR2_CMAKE) --install $(WEBKITGTK_BUILDDIR)
-endef
-
 $(eval $(cmake-package))
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#6 lore raw

Re: [Buildroot] [PATCH v6 2/4] package/webkitgtk: use the CMAKE_NINJA flag

Thomas, All,

On 2023-08-02 13:14 +0200, Thomas Devoogdt spake thusly:

Quoted 13 lines

From: Thomas Devoogdt <[email protected]>

Replaces:

commit 16e5c92ff5fd2b44a1126bd7d7538c68ce838213

Author: Peter Korsgaard <[email protected]>
Date:   Thu Feb 9 18:07:05 2023 +0100

package/webkitgtk: Build with ninja

Webkitgtk needs cmake >= 3.20 when building with the make backend since webkitgtk 3.8.0.

Quoted 7 lines

Cmake 3.20 is above our minimal version in support/dependencies/check-host-cmake.mk, so this breaks builds on hosts with cmake >= 3.18 < 3.20 - So use the ninja backend instead.

https://github.com/WebKit/WebKit/commit/6cd89696b5d406c1a3d9a7a9bbb18fda9284fa1f

It was weird to read a commit log in a commit log (it really took me a moment to realise what I was looking at), so I simplified it a bit.

Also, I changed over to the new _CMAKE_BACKEND variable.

Quoted 1 line

Applied to next, thanks.

Regards,
Yann E. MORIN.

Quoted 50 lines

---
v5: no change
v6: rebase

---
 package/webkitgtk/webkitgtk.mk | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)
package/webkitgtk/webkitgtk.mk +1 -19
index 56277a0a0a..aa1c11f7cd 100644
@@ -13,6 +13,7 @@ WEBKITGTK_LICENSE_FILES = \
 	Source/WebCore/LICENSE-APPLE \
 	Source/WebCore/LICENSE-LGPL-2.1
 WEBKITGTK_CPE_ID_VENDOR = webkitgtk
+WEBKITGTK_CMAKE_NINJA = YES
 WEBKITGTK_DEPENDENCIES = host-ruby host-python3 host-gperf host-unifdef \
 	enchant harfbuzz icu jpeg libgcrypt libgtk3 libsecret libsoup \
 	libtasn1 libxml2 libxslt openjpeg sqlite webp woff2
@@ -140,23 +141,4 @@ ifeq ($(BR2_ARM_CPU_ARMV5)$(BR2_ARM_CPU_ARMV6)$(BR2_MIPS_CPU_MIPS32R6)$(BR2_MIPS
 WEBKITGTK_CONF_OPTS += -DENABLE_JIT=OFF -DENABLE_C_LOOP=ON -DENABLE_SAMPLING_PROFILER=OFF
 endif
 
-# webkitgtk needs cmake >= 3.20 when not building with ninja, which is
-# above our minimal version in
-# support/dependencies/check-host-cmake.mk, so use the ninja backend:
-# https://github.com/WebKit/WebKit/commit/6cd89696b5d406c1a3d9a7a9bbb18fda9284fa1f
-WEBKITGTK_CONF_OPTS += -GNinja
-WEBKITGTK_DEPENDENCIES += host-ninja
-
-define WEBKITGTK_BUILD_CMDS
-	$(TARGET_MAKE_ENV) $(BR2_CMAKE) --build $(WEBKITGTK_BUILDDIR)
-endef
-
-define WEBKITGTK_INSTALL_STAGING_CMDS
-	$(TARGET_MAKE_ENV) DESTDIR=$(STAGING_DIR) $(BR2_CMAKE) --install $(WEBKITGTK_BUILDDIR)
-endef
-
-define WEBKITGTK_INSTALL_TARGET_CMDS
-	$(TARGET_MAKE_ENV) DESTDIR=$(TARGET_DIR) $(BR2_CMAKE) --install $(WEBKITGTK_BUILDDIR)
-endef
-
 $(eval $(cmake-package))
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#7 lore raw

PATCH v6 3/4 package/wpewebkit: use the CMAKE_NINJA flag

In reply to Thomas Devoogdt

From: Thomas Devoogdt <[email protected]>

Replaces:

commit 78d499409f71d8a22b0632c8ebc06f67ee6ae6dd

Author: Peter Korsgaard <[email protected]>
Date:   Thu Feb 9 18:07:06 2023 +0100

package/wpewebkit: Build with ninja

Wpewebkit needs cmake >= 3.20 when building with the make backend since wpewebkit 3.8.0.

Cmake 3.20 is above our minimal version in support/dependencies/check-host-cmake.mk, so this breaks builds on hosts with cmake >= 3.18 < 3.20 - So use the ninja backend instead.

https://github.com/WebKit/WebKit/commit/6cd89696b5d406c1a3d9a7a9bbb18fda9284fa1f

---
v5: no change
v6: rebase

---
 package/wpewebkit/wpewebkit.mk | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)
package/wpewebkit/wpewebkit.mk +1 -19
index c13a7201e6..135db02b44 100644
@@ -14,6 +14,7 @@ WPEWEBKIT_LICENSE_FILES = \
 	Source/WebCore/LICENSE-LGPL-2.1
 WPEWEBKIT_CPE_ID_VENDOR = wpewebkit
 WPEWEBKIT_CPE_ID_PRODUCT = wpe_webkit
+WPEWEBKIT_CMAKE_NINJA = YES
 WPEWEBKIT_DEPENDENCIES = host-gperf host-python3 host-ruby host-unifdef \
 	harfbuzz cairo icu jpeg libepoxy libgcrypt libgles libsoup libtasn1 \
 	libpng libxslt openjpeg wayland-protocols webp wpebackend-fdo
@@ -104,23 +105,4 @@ ifeq ($(BR2_ARM_CPU_ARMV5)$(BR2_ARM_CPU_ARMV6)$(BR2_MIPS_CPU_MIPS32R6)$(BR2_MIPS
 WPEWEBKIT_CONF_OPTS += -DENABLE_JIT=OFF -DENABLE_C_LOOP=ON -DENABLE_SAMPLING_PROFILER=OFF
 endif
 
-# wpewebkit needs cmake >= 3.20 when building with the make backend, which is
-# above our minimal version in
-# support/dependencies/check-host-cmake.mk, so use the ninja backend:
-# https://github.com/WebKit/WebKit/commit/6cd89696b5d406c1a3d9a7a9bbb18fda9284fa1f
-WPEWEBKIT_CONF_OPTS += -GNinja
-WPEWEBKIT_DEPENDENCIES += host-ninja
-
-define WPEWEBKIT_BUILD_CMDS
-	$(TARGET_MAKE_ENV) $(BR2_CMAKE) --build $(WPEWEBKIT_BUILDDIR)
-endef
-
-define WPEWEBKIT_INSTALL_STAGING_CMDS
-	$(TARGET_MAKE_ENV) DESTDIR=$(STAGING_DIR) $(BR2_CMAKE) --install $(WPEWEBKIT_BUILDDIR)
-endef
-
-define WPEWEBKIT_INSTALL_TARGET_CMDS
-	$(TARGET_MAKE_ENV) DESTDIR=$(TARGET_DIR) $(BR2_CMAKE) --install $(WPEWEBKIT_BUILDDIR)
-endef
-
 $(eval $(cmake-package))
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#8 lore raw

Re: [Buildroot] [PATCH v6 3/4] package/wpewebkit: use the CMAKE_NINJA flag

Thomas, All,

On 2023-08-02 13:14 +0200, Thomas Devoogdt spake thusly:

Quoted 13 lines

From: Thomas Devoogdt <[email protected]>

Replaces:

commit 78d499409f71d8a22b0632c8ebc06f67ee6ae6dd

Author: Peter Korsgaard <[email protected]>
Date:   Thu Feb 9 18:07:06 2023 +0100

package/wpewebkit: Build with ninja

Wpewebkit needs cmake >= 3.20 when building with the make backend since wpewebkit 3.8.0.

Quoted 7 lines

Cmake 3.20 is above our minimal version in support/dependencies/check-host-cmake.mk, so this breaks builds on hosts with cmake >= 3.18 < 3.20 - So use the ninja backend instead.

https://github.com/WebKit/WebKit/commit/6cd89696b5d406c1a3d9a7a9bbb18fda9284fa1f

Ditto the commit log and variable.

Quoted 1 line

Applied to next, thanks.

Regards,
Yann E. MORIN.

Quoted 50 lines

---
v5: no change
v6: rebase

---
 package/wpewebkit/wpewebkit.mk | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)
package/wpewebkit/wpewebkit.mk +1 -19
index c13a7201e6..135db02b44 100644
@@ -14,6 +14,7 @@ WPEWEBKIT_LICENSE_FILES = \
 	Source/WebCore/LICENSE-LGPL-2.1
 WPEWEBKIT_CPE_ID_VENDOR = wpewebkit
 WPEWEBKIT_CPE_ID_PRODUCT = wpe_webkit
+WPEWEBKIT_CMAKE_NINJA = YES
 WPEWEBKIT_DEPENDENCIES = host-gperf host-python3 host-ruby host-unifdef \
 	harfbuzz cairo icu jpeg libepoxy libgcrypt libgles libsoup libtasn1 \
 	libpng libxslt openjpeg wayland-protocols webp wpebackend-fdo
@@ -104,23 +105,4 @@ ifeq ($(BR2_ARM_CPU_ARMV5)$(BR2_ARM_CPU_ARMV6)$(BR2_MIPS_CPU_MIPS32R6)$(BR2_MIPS
 WPEWEBKIT_CONF_OPTS += -DENABLE_JIT=OFF -DENABLE_C_LOOP=ON -DENABLE_SAMPLING_PROFILER=OFF
 endif
 
-# wpewebkit needs cmake >= 3.20 when building with the make backend, which is
-# above our minimal version in
-# support/dependencies/check-host-cmake.mk, so use the ninja backend:
-# https://github.com/WebKit/WebKit/commit/6cd89696b5d406c1a3d9a7a9bbb18fda9284fa1f
-WPEWEBKIT_CONF_OPTS += -GNinja
-WPEWEBKIT_DEPENDENCIES += host-ninja
-
-define WPEWEBKIT_BUILD_CMDS
-	$(TARGET_MAKE_ENV) $(BR2_CMAKE) --build $(WPEWEBKIT_BUILDDIR)
-endef
-
-define WPEWEBKIT_INSTALL_STAGING_CMDS
-	$(TARGET_MAKE_ENV) DESTDIR=$(STAGING_DIR) $(BR2_CMAKE) --install $(WPEWEBKIT_BUILDDIR)
-endef
-
-define WPEWEBKIT_INSTALL_TARGET_CMDS
-	$(TARGET_MAKE_ENV) DESTDIR=$(TARGET_DIR) $(BR2_CMAKE) --install $(WPEWEBKIT_BUILDDIR)
-endef
-
 $(eval $(cmake-package))
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#9 lore raw

PATCH v6 4/4 pkg-cmake: make ninja the default for all packages

In reply to Thomas Devoogdt

From: Thomas Devoogdt <[email protected]>

Use ninja as the default generator.
A fun fact is that we of course have to disable ninja when building ninja.

---
v5: add this optional commit
v6: rebase

---
 package/ninja/ninja.mk | 1 +
 package/pkg-cmake.mk   | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
package/ninja/ninja.mk +1 -0
index b7bc1a4f1c..85dd2e05aa 100644
@@ -9,6 +9,7 @@ NINJA_VERSION = $(NINJA_VERSION_MAJOR).g95dee.kitware.jobserver-1
 NINJA_SITE = $(call github,Kitware,ninja,v$(NINJA_VERSION))
 NINJA_LICENSE = Apache-2.0
 NINJA_LICENSE_FILES = COPYING
+NINJA_CMAKE_NINJA = NO
 
 define HOST_NINJA_INSTALL_CMDS
 	$(INSTALL) -m 0755 -D $(@D)/ninja $(HOST_DIR)/bin/ninja
package/pkg-cmake.mk +1 -1
index 36ab88d3a1..dab87c81f4 100644
@@ -52,7 +52,7 @@ endif
 define inner-cmake-package
 
 $(3)_SUPPORTS_IN_SOURCE_BUILD ?= YES
-
+$(3)_CMAKE_NINJA ?= YES
 
 ifeq ($$($(3)_SUPPORTS_IN_SOURCE_BUILD),YES)
 $(2)_BUILDDIR			= $$($(2)_SRCDIR)
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#10 lore raw

Re: [Buildroot] [PATCH v6 4/4] pkg-cmake: make ninja the default for all packages

Thomas, All,

On 2023-08-02 13:14 +0200, Thomas Devoogdt spake thusly:

Quoted 3 lines

From: Thomas Devoogdt <[email protected]>

Use ninja as the default generator.

I have not applied that patch yet, because Thomas P. and I believed this is a bit bold, even for next.

I've started a build with a bunch of cmake-based packages, and I'll see if they break alot of not later in the evening. If there's breakage, I'll report and you'll have to investigate! ;-p

Quoted 1 line

A fun fact is that we of course have to disable ninja when building ninja.

Yes, of course! :-)

Regards,
Yann E. MORIN.

Quoted 41 lines

---
v5: add this optional commit
v6: rebase

---
 package/ninja/ninja.mk | 1 +
 package/pkg-cmake.mk   | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
package/ninja/ninja.mk +1 -0
index b7bc1a4f1c..85dd2e05aa 100644
@@ -9,6 +9,7 @@ NINJA_VERSION = $(NINJA_VERSION_MAJOR).g95dee.kitware.jobserver-1
 NINJA_SITE = $(call github,Kitware,ninja,v$(NINJA_VERSION))
 NINJA_LICENSE = Apache-2.0
 NINJA_LICENSE_FILES = COPYING
+NINJA_CMAKE_NINJA = NO
 
 define HOST_NINJA_INSTALL_CMDS
 	$(INSTALL) -m 0755 -D $(@D)/ninja $(HOST_DIR)/bin/ninja
package/pkg-cmake.mk +1 -1
index 36ab88d3a1..dab87c81f4 100644
@@ -52,7 +52,7 @@ endif
 define inner-cmake-package
 
 $(3)_SUPPORTS_IN_SOURCE_BUILD ?= YES
-
+$(3)_CMAKE_NINJA ?= YES
 
 ifeq ($$($(3)_SUPPORTS_IN_SOURCE_BUILD),YES)
 $(2)_BUILDDIR			= $$($(2)_SRCDIR)
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#11 lore raw

Re: [Buildroot] [PATCH v6 4/4] pkg-cmake: make ninja the default for all packages

Thomas, All,

On 2023-08-06 16:19 +0200, Yann E. MORIN spake thusly:

Quoted 5 lines

On 2023-08-02 13:14 +0200, Thomas Devoogdt spake thusly:

Quoted 2 lines

From: Thomas Devoogdt <[email protected]>
Use ninja as the default generator.

I have not applied that patch yet, because Thomas P. and I believed this is a bit bold, even for next.

And I will not apply it, because it does actually break some packages because of ninja.

For example, compiler-rt complains with:

    ninja: error: dependency cycle: include/sanitizer/allocator_interface.h -> include/sanitizer/allocator_interface.h

So, maybe the package is broken and needs fixing, but it (supposedly) builds OKi-ish with makefiles.

So, we need to assess how many of the cmake packages build fine with ninja. If they are the vast majority, then we annonate those that don't and change the default to use ninja. If however, the vast majority does not work with ninja, then we keep the curremnt status quo, and annotate those packages that do, like webktigtk or wpewebkit.

Also, please have a look at qt6: it is already using ninja, but like webkitgtk and wpewebkit, is was special-coded. Could you please send a follow-up patch that upgrades qt6 to use QT6_CMAKE_BACKEND?

Regards,
Yann E. MORIN.

Quoted 64 lines

I've started a build with a bunch of cmake-based packages, and I'll see if they break alot of not later in the evening. If there's breakage, I'll report and you'll have to investigate! ;-p

Quoted 1 line

A fun fact is that we of course have to disable ninja when building ninja.

Yes, of course! :-)

Regards,
Yann E. MORIN.

Quoted 41 lines

---
v5: add this optional commit
v6: rebase

---
 package/ninja/ninja.mk | 1 +
 package/pkg-cmake.mk   | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
package/ninja/ninja.mk +1 -0
index b7bc1a4f1c..85dd2e05aa 100644
@@ -9,6 +9,7 @@ NINJA_VERSION = $(NINJA_VERSION_MAJOR).g95dee.kitware.jobserver-1
 NINJA_SITE = $(call github,Kitware,ninja,v$(NINJA_VERSION))
 NINJA_LICENSE = Apache-2.0
 NINJA_LICENSE_FILES = COPYING
+NINJA_CMAKE_NINJA = NO
 
 define HOST_NINJA_INSTALL_CMDS
 	$(INSTALL) -m 0755 -D $(@D)/ninja $(HOST_DIR)/bin/ninja
package/pkg-cmake.mk +1 -1
index 36ab88d3a1..dab87c81f4 100644
@@ -52,7 +52,7 @@ endif
 define inner-cmake-package
 
 $(3)_SUPPORTS_IN_SOURCE_BUILD ?= YES
-
+$(3)_CMAKE_NINJA ?= YES
 
 ifeq ($$($(3)_SUPPORTS_IN_SOURCE_BUILD),YES)
 $(2)_BUILDDIR			= $$($(2)_SRCDIR)
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#12 lore raw
In reply to Thomas Devoogdt

Thomas, All,

On 2023-08-02 13:14 +0200, Thomas Devoogdt spake thusly:

Quoted 9 lines

From: Thomas Devoogdt <[email protected]>

Cmake supports multiple generators. Ninja is a small build system with a focus on speed. It is mainly used with the meson build system, but also cmake has very good support for it. This adds optional support for the Ninja build system.

Usage:
<package>_CMAKE_NINJA = YES

With Thomas P., we concluded that this is not a YES/NO question, but it's rather a THIS-OR-THAT-OR-THIS where we only have a this or a that, but nonetheless that's semantically different.

So I've tweaked the code to introduce FOO_CMAKE_BACKEND = (make|ninja). This way it is even more obvious how we'll be able to add other backends in the future (even if Thomas P. and I doubt we will ever have more, seeing what cmake currently has that would be meaningful for Buildroot).

Quoted 32 lines

E.g. Commit 16e5c92ff5fd2b44a1126bd7d7538c68ce838213 can now be replaced by:
WEBKITGTK_CMAKE_NINJA = YES

Packages that are selecting Ninja (or overtime another generator), should also use the _BUILD_{ENV,OPTS} variables iso the _MAKE variables.

No _INSTALL{,_STAGING,_TARGET}_OPTS used so far, so reuse as cmake install opts:

    $ grep '_INSTALL_OPTS' $(grep -rl "cmake-package" package/*/*.mk)
    $ grep '_INSTALL_STAGING_OPTS' $(grep -rl "cmake-package" package/*/*.mk)
    $ grep '_INSTALL_TARGET_OPTS' $(grep -rl "cmake-package" package/*/*.mk)

The _MAKE_{ENV,OPTS} are copied to _BUILD_{ENV,OPTS}, involved packages:

    $ grep '_MAKE_ENV =' $(grep -rl "cmake-package" package/*/*.mk)
    package/netopeer2/netopeer2.mk:NETOPEER2_MAKE_ENV = \
    package/racehound/racehound.mk:RACEHOUND_MAKE_ENV = $(LINUX_MAKE_FLAGS)

    $ grep '_MAKE_OPTS =' $(grep -rl "cmake-package" package/*/*.mk)

    package/mariadb/mariadb.mk:HOST_MARIADB_MAKE_OPTS = import_executables
    package/zeek/zeek.mk:HOST_ZEEK_MAKE_OPTS = binpac bifcl

Only "musepack" seems to overwrite MAKE to enforce -j1, so replace it:

    $ grep '_MAKE =' $(grep -rl "cmake-package" package/*/*.mk)
    package/musepack/musepack.mk:MUSEPACK_MAKE = $(MAKE1)
Quoted 8 lines

---
v2:
- made generator use more generic, other generators can now easily be added if required
v3:
- add _GENERATOR_PROGRAM
- add _GENERATOR_PARALLEL for make
- dropped BUILD_OPTS
- fix gdal.mk

It took me some time to understand what you meant here, as gdal was in fact not touched by your patch. IIUC, you really meant that, by propagating the _MAKE_OPTS to the new _BUILD_OPTS, that would fix gdal.

Good news, I actually fixed gdal to drop the remnants of a previous workaround! ;-)

Still, I kept the propagation to _BUILD_OPTS for out-of-tree packages.

Quoted 3 lines

v4:
- restored _MAKE_ENV/_MAKE_OPTS for the Unix Makefiles case
- always set -j$(PARALLEL_JOBS)

I left this as-is, but please see 1668e1da390c (packages: fix and improve support for top-level parallel make) and review the commit log to see how this is applies now...

[--SNIP--]

Quoted 17 lines
package/pkg-cmake.mk +0 -5
index 8c375779cb..36ab88d3a1 100644
@@ -51,11 +51,6 @@ endif
 
 define inner-cmake-package
 
-$(2)_MAKE			?= $$(MAKE)
-$(2)_INSTALL_OPTS		?= install
-$(2)_INSTALL_STAGING_OPTS	?= DESTDIR=$$(STAGING_DIR) install/fast
-$(2)_INSTALL_TARGET_OPTS	?= DESTDIR=$$(TARGET_DIR) install/fast
-
 $(3)_SUPPORTS_IN_SOURCE_BUILD ?= YES
 
 

package/pkg-cmake.mk else · line 63

Quoted 4 lines
package/pkg-cmake.mk +1 -0
@@ -65,6 +60,20 @@ else
 $(2)_BUILDDIR			= $$($(2)_SRCDIR)/buildroot-build
 endif
 
+ifeq ($$($(3)_CMAKE_NINJA),YES)

I've kept the 'make' generator first, for two reasons: 1. it is the historical backend, so that's nice that we keep it first in the list, and add new backends below, and 2. that keeps the list alphabetically ordered (both are weak reasons, but together they are stringer! ;-])

package/pkg-cmake.mk else · line 69

Quoted 6 lines
package/pkg-cmake.mk +6 -0
+$(2)_DEPENDENCIES	+= host-ninja
+$(2)_GENERATOR		= "Ninja"
+$(2)_GENERATOR_PROGRAM	= $(HOST_DIR)/bin/ninja
+else
+$(2)_GENERATOR		= "Unix Makefiles"
+$(2)_GENERATOR_PROGRAM	= $(firstword $(BR2_MAKE))

You did not explain why we needed to use the firstword of $(BR2_MAKE), nor why we needed to use $(BR2_MAKE) instead of $(MAKE) which is used everywhere else.

There was no reason that I could spot for BR2_MAKE, so I switched to MAKE, and I added a blurb about using firstword.

If I missed something, please send a fixup patch with appropriate explanations.

package/pkg-cmake.mk else · line 74

Quoted 4 lines
package/pkg-cmake.mk +4 -0
+# Generator specific code (make) should be avoided,
+# but for now, copy them to the new variables.
+$(2)_BUILD_ENV		?= $$($(2)_MAKE_ENV)
+$(2)_BUILD_OPTS		?= -- $$($(2)_MAKE_OPTS)

I used an if-elseif-else construct, to detect unsupported backends.

Finally, there was no documentation in the manual for those three new options, so I've added them.

Please review the new code. If I broke something, please send followup fixup patches with appropriate explanations (there's a kind of déjà-vu here...)

Applied to next, thanks.

Regards,
Yann E. MORIN.

Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#13 lore raw

Thomas, All,

On 2023-08-06 16:15 +0200, Yann E. MORIN spake thusly:

Quoted 6 lines

On 2023-08-02 13:14 +0200, Thomas Devoogdt spake thusly:

Quoted 5 lines

From: Thomas Devoogdt <[email protected]>
Cmake supports multiple generators. Ninja is a small build system with a focus on speed. It is mainly used with the meson build system, but also cmake has very good support for it. This adds optional support for the Ninja build system.

[--SNIP--]

Quoted 3 lines

Please review the new code. If I broke something, please send followup fixup patches with appropriate explanations (there's a kind of déjà-vu here...)

While reviewing another patch, I now noticed that we did lose something with the introduction of this ninja backend. that I totally missed when I applied it.

Indeed, previously, the install step was done with the install/fast rule:

    $(2)_INSTALL_STAGING_OPTS      ?= DESTDIR=$$(STAGING_DIR) install/fast
    $(2)_INSTALL_TARGET_OPTS       ?= DESTDIR=$$(TARGET_DIR) install/fast

But this got removed with your patch, with nothing to replace it.

See commit dfcc18f84b0d (pkg-cmake: Skip compilation in installation step) for the rationale of using install/fast.

Could you look into restoring this, please?

Regards,
Yann E. MORIN.

Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#14 lore raw

Hi Yann, All,

I will check what I can do. A quick search gives me this flag:
https://cmake.org/cmake/help/latest/variable/CMAKE_SKIP_INSTALL_ALL_DEPENDENCY.html
,
which is probably what we want. Otherwise I don't see much additional install options. And calling the make install/fast target directly is not very generator generic.

Kr,

Thomas

Op ma 2 okt. 2023 19:33 schreef Yann E. MORIN <[email protected]>:

Quoted 47 lines

Thomas, All,

On 2023-08-06 16:15 +0200, Yann E. MORIN spake thusly:

Quoted 3 lines

On 2023-08-02 13:14 +0200, Thomas Devoogdt spake thusly:

Quoted 2 lines

From: Thomas Devoogdt <[email protected]>
Cmake supports multiple generators. Ninja is a small build system with

a

Quoted 3 lines
Quoted 3 lines

focus on speed. It is mainly used with the meson build system, but also cmake has very good support for it. This adds optional support for the Ninja build system.

[--SNIP--]

Quoted 3 lines

Please review the new code. If I broke something, please send followup fixup patches with appropriate explanations (there's a kind of déjà-vu here...)

While reviewing another patch, I now noticed that we did lose something with the introduction of this ninja backend. that I totally missed when I applied it.

Indeed, previously, the install step was done with the install/fast rule:

    $(2)_INSTALL_STAGING_OPTS      ?= DESTDIR=$$(STAGING_DIR) install/fast
    $(2)_INSTALL_TARGET_OPTS       ?= DESTDIR=$$(TARGET_DIR) install/fast

But this got removed with your patch, with nothing to replace it.

See commit dfcc18f84b0d (pkg-cmake: Skip compilation in installation step) for the rationale of using install/fast.

Could you look into restoring this, please?

Regards,
Yann E. MORIN.

--

.-----------------.--------------------.------------------.--------------------.

|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics'
conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___
     |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is
no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v
 conspiracy.  |
Quoted 3 lines

'------------------------------^-------^------------------^--------------------'

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#15 lore raw

Thomas, All,

On 2023-10-02 22:26 +0200, Thomas Devoogdt spake thusly:

Quoted 3 lines

I will check what I can do. A quick search gives me this flag:
[1]https://cmake.org/cmake/help/latest/variable/CMAKE_SKIP_INSTALL_ALL_DEPENDENCY.html , which is probably what we want. Otherwise I don't see much additional install options.

If I understood it properly, this makes 'install' behave as 'install/fast' by default, so looks like we should indeed be passing this option instead. If that does not make sense for the ninja case, then we'd set it only for the makefiles case.

Quoted 2 lines

And calling the make install/fast target
directly is not very generator generic.

If we reinstate 'install/fast' as it was previously, we'd do that only for the makefiels case, of course.

Regards,
Yann E. MORIN.

Quoted 52 lines

Kr,
Thomas
Op ma 2 okt. 2023 19:33 schreef Yann E. MORIN < [2][email protected]>:

Thomas, All,

On 2023-08-06 16:15 +0200, Yann E. MORIN spake thusly:

Quoted 6 lines

On 2023-08-02 13:14 +0200, Thomas Devoogdt spake thusly:

Quoted 5 lines

From: Thomas Devoogdt < [3][email protected]>
Cmake supports multiple generators. Ninja is a small build system with a focus on speed. It is mainly used with the meson build system, but also cmake has very good support for it. This adds optional support for the Ninja build system.

[--SNIP--]

Quoted 3 lines

Please review the new code. If I broke something, please send followup fixup patches with appropriate explanations (there's a kind of déjà-vu here...)

While reviewing another patch, I now noticed that we did lose something with the introduction of this ninja backend. that I totally missed when I applied it.

Indeed, previously, the install step was done with the install/fast rule:

      $(2)_INSTALL_STAGING_OPTS      ?= DESTDIR=$$(STAGING_DIR) install/fast
      $(2)_INSTALL_TARGET_OPTS       ?= DESTDIR=$$(TARGET_DIR) install/fast

But this got removed with your patch, with nothing to replace it.

See commit dfcc18f84b0d (pkg-cmake: Skip compilation in installation step) for the rationale of using install/fast.

Could you look into restoring this, please?

Regards,
Yann E. MORIN.

--
.-----------------.--------------------.------------------.--------------------.

  |  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
  | +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___           
     |
  | +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
  | [4]http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |

'------------------------------^-------^------------------^--------------------'

Links:
1. https://cmake.org/cmake/help/latest/variable/CMAKE_SKIP_INSTALL_ALL_DEPENDENCY.html
2. mailto:[email protected]
3. mailto:[email protected]
4. http://ymorin.is-a-geek.org/

Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#16 lore raw

Hi Yann,

I did have a further look at the install/fast thing. It seems that it is not needed after all. Here is an example:

I have a main.cpp file like this:

```c++
#include <iostream>

int main() {
    std::cout << "Hello World!";
    return 0;
}
```

And a CMakeLists.txt file like this:

```cmake
cmake_minimum_required(VERSION 3.22)

project(test)

add_executable(${PROJECT_NAME} main.cpp)

install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
```

If I run the normal 'make install', then I can indeed confirm that the target gets built:
(Only an error because I didn't use sudo to install it.)

```
$ rm -rf build/ && cmake -B build/ . && make -C build/ install
-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/thode/Documents/test/build
make: Entering directory '/home/thode/Documents/test/build'
make[1]: Entering directory '/home/thode/Documents/test/build'
make[2]: Entering directory '/home/thode/Documents/test/build'
make[2]: Leaving directory '/home/thode/Documents/test/build'
make[2]: Entering directory '/home/thode/Documents/test/build'
[ 50%] Building CXX object CMakeFiles/test.dir/main.cpp.o
[100%] Linking CXX executable test
make[2]: Leaving directory '/home/thode/Documents/test/build'
[100%] Built target test
make[1]: Leaving directory '/home/thode/Documents/test/build'
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/bin/test
CMake Error at cmake_install.cmake:52 (file):
  file INSTALL cannot copy file "/home/thode/Documents/test/build/test" to
  "/usr/local/bin/test": Permission denied.


make: *** [Makefile:100: install] Error 1
make: Leaving directory '/home/thode/Documents/test/build'
```

If I re-do the same but with 'make install/fast', then I get indeed the warning that the file isn't there:

```
$ rm -rf build/ && cmake -B build/ . && make -C build/ install/fast
-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/thode/Documents/test/build
make: Entering directory '/home/thode/Documents/test/build'
Install the project...
-- Install configuration: ""
CMake Error at cmake_install.cmake:52 (file):
  file INSTALL cannot find "/home/thode/Documents/test/build/test": No such
  file or directory.


make: *** [Makefile:106: install/fast] Error 1
make: Leaving directory '/home/thode/Documents/test/build'
```

If I now use the 'cmake --install' option, then I would first expect that it would also build the target first, but that is not the case:

```
$ rm -rf build/ && cmake -B build/ . && cmake --install build/
-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/thode/Documents/test/build
-- Install configuration: ""
CMake Error at build/cmake_install.cmake:52 (file):
  file INSTALL cannot find "/home/thode/Documents/test/build/test": No such
  file or directory.
```

So I indeed have to do the 'cmake --build' first.
(beware that I again didn't use sudo.)

```
$ rm -rf build/ && cmake -B build/ . && cmake --build build/ && cmake
--install build/
-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/thode/Documents/test/build
[ 50%] Building CXX object CMakeFiles/test.dir/main.cpp.o
[100%] Linking CXX executable test
[100%] Built target test
-- Install configuration: ""
-- Installing: /usr/local/bin/test
CMake Error at build/cmake_install.cmake:52 (file):
  file INSTALL cannot copy file "/home/thode/Documents/test/build/test" to
  "/usr/local/bin/test": Permission denied.
```

So in short, calling 'cmake --install' doesn't imply a build. For purely make, that was the case,
but when using the cmake wrapper, this doesn't hold longer.

Kr,

Thomas

Op ma 2 okt 2023 om 22:43 schreef Yann E. MORIN <[email protected]>:

Quoted 75 lines

Thomas, All,

On 2023-10-02 22:26 +0200, Thomas Devoogdt spake thusly:

Quoted 3 lines

I will check what I can do. A quick search gives me this flag:
[1]https://cmake.org/cmake/help/latest/variable/CMAKE_SKIP_INSTALL_ALL_DEPENDENCY.html , which is probably what we want. Otherwise I don't see much additional install options.

If I understood it properly, this makes 'install' behave as 'install/fast' by default, so looks like we should indeed be passing this option instead. If that does not make sense for the ninja case, then we'd set it only for the makefiles case.

Quoted 2 lines

And calling the make install/fast target
directly is not very generator generic.

If we reinstate 'install/fast' as it was previously, we'd do that only for the makefiels case, of course.

Regards,
Yann E. MORIN.

Quoted 45 lines

Kr,
Thomas
Op ma 2 okt. 2023 19:33 schreef Yann E. MORIN < [2][email protected]>:

Thomas, All,

On 2023-08-06 16:15 +0200, Yann E. MORIN spake thusly:

Quoted 6 lines

On 2023-08-02 13:14 +0200, Thomas Devoogdt spake thusly:

Quoted 5 lines

From: Thomas Devoogdt < [3][email protected]>
Cmake supports multiple generators. Ninja is a small build system with a focus on speed. It is mainly used with the meson build system, but also cmake has very good support for it. This adds optional support for the Ninja build system.

[--SNIP--]

Quoted 3 lines

Please review the new code. If I broke something, please send followup fixup patches with appropriate explanations (there's a kind of déjà-vu here...)

While reviewing another patch, I now noticed that we did lose something with the introduction of this ninja backend. that I totally missed when I applied it.

Indeed, previously, the install step was done with the install/fast rule:

      $(2)_INSTALL_STAGING_OPTS      ?= DESTDIR=$$(STAGING_DIR) install/fast
      $(2)_INSTALL_TARGET_OPTS       ?= DESTDIR=$$(TARGET_DIR) install/fast

But this got removed with your patch, with nothing to replace it.

See commit dfcc18f84b0d (pkg-cmake: Skip compilation in installation step) for the rationale of using install/fast.

Could you look into restoring this, please?

Regards,
Yann E. MORIN.

--
.-----------------.--------------------.------------------.--------------------.

  |  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
  | +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___
     |
  | +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
  | [4]http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
Quoted 7 lines

'------------------------------^-------^------------------^--------------------'

Links:
1. https://cmake.org/cmake/help/latest/variable/CMAKE_SKIP_INSTALL_ALL_DEPENDENCY.html
2. mailto:[email protected]
3. mailto:[email protected]
4. http://ymorin.is-a-geek.org/

Quoted 8 lines

--
.-----------------.--------------------.------------------.--------------------.

|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |

'------------------------------^-------^------------------^--------------------'

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot