build: fix CMake generator for non-Ninja builds

OpenWRT by default uses the Ninja generator, but some packages disable
Ninja and use the default Unix Makefiles generator. This generator can
be overridden in the user environment with `CMAKE_GENERATOR`. This patch
explicitly sets the correct generator when `PKG_USE_NINJA:=0`.

In particular, the `mt76` package uses the Makefiles generator.

Signed-off-by: Ivan Romanov <drizt72@zoho.eu>
Link: https://github.com/openwrt/openwrt/pull/16263
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This commit is contained in:
Ivan Romanov 2024-08-26 12:45:38 +05:00 committed by Hauke Mehrtens
parent dd1bfbe971
commit 4646aa1699
1 changed files with 4 additions and 0 deletions

View File

@ -68,6 +68,8 @@ ifeq ($(HOST_USE_NINJA),1)
define Host/Uninstall/Default define Host/Uninstall/Default
+$(NINJA) -C $(HOST_CMAKE_BINARY_DIR) uninstall +$(NINJA) -C $(HOST_CMAKE_BINARY_DIR) uninstall
endef endef
else
CMAKE_HOST_OPTIONS += -DCMAKE_GENERATOR="Unix Makefiles"
endif endif
ifeq ($(PKG_USE_NINJA),1) ifeq ($(PKG_USE_NINJA),1)
@ -80,6 +82,8 @@ ifeq ($(PKG_USE_NINJA),1)
define Build/Install/Default define Build/Install/Default
+DESTDIR="$(PKG_INSTALL_DIR)" $(NINJA) -C $(CMAKE_BINARY_DIR) install +DESTDIR="$(PKG_INSTALL_DIR)" $(NINJA) -C $(CMAKE_BINARY_DIR) install
endef endef
else
CMAKE_OPTIONS += -DCMAKE_GENERATOR="Unix Makefiles"
endif endif
define Build/Configure/Default define Build/Configure/Default