aboutsummaryrefslogtreecommitdiffstats
path: root/include/cmake.mk
diff options
context:
space:
mode:
Diffstat (limited to 'include/cmake.mk')
-rw-r--r--include/cmake.mk34
1 files changed, 34 insertions, 0 deletions
diff --git a/include/cmake.mk b/include/cmake.mk
index 96c4d7df34..8a1c4fc4d5 100644
--- a/include/cmake.mk
+++ b/include/cmake.mk
@@ -1,5 +1,11 @@
cmake_bool = $(patsubst %,-D%:BOOL=$(if $($(1)),ON,OFF),$(2))
+ifeq ($(PKG_USE_NINJA),1)
+ PKG_BUILD_PARALLEL ?= 1
+endif
+ifeq ($(HOST_USE_NINJA),1)
+ HOST_BUILD_PARALLEL ?= 1
+endif
PKG_INSTALL:=1
ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
@@ -44,6 +50,34 @@ CMAKE_FIND_ROOT_PATH:=$(STAGING_DIR)/usr;$(TOOLCHAIN_DIR)$(if $(CONFIG_EXTERNAL_
CMAKE_HOST_FIND_ROOT_PATH:=$(STAGING_DIR)/host;$(STAGING_DIR_HOSTPKG);$(STAGING_DIR_HOST)
CMAKE_SHARED_LDFLAGS:=-Wl,-Bsymbolic-functions
+ifeq ($(HOST_USE_NINJA),1)
+ CMAKE_HOST_OPTIONS += -DCMAKE_GENERATOR="Ninja"
+
+ define Host/Compile/Default
+ +$(NINJA) -C $(HOST_BUILD_DIR) $(1)
+ endef
+
+ define Host/Install/Default
+ +DESTDIR="$(HOST_INSTALL_DIR)" $(NINJA) -C $(HOST_BUILD_DIR) install
+ endef
+
+ define Host/Uninstall/Default
+ +DESTDIR="$(HOST_INSTALL_DIR)" $(NINJA) -C $(HOST_BUILD_DIR) uninstall
+ endef
+endif
+
+ifeq ($(PKG_USE_NINJA),1)
+ CMAKE_OPTIONS += -DCMAKE_GENERATOR="Ninja"
+
+ define Build/Compile/Default
+ +$(NINJA) -C $(CMAKE_BINARY_DIR) $(1)
+ endef
+
+ define Build/Install/Default
+ +DESTDIR="$(PKG_INSTALL_DIR)" $(NINJA) -C $(CMAKE_BINARY_DIR) install
+ endef
+endif
+
define Build/Configure/Default
mkdir -p $(CMAKE_BINARY_DIR)
(cd $(CMAKE_BINARY_DIR); \