cmake allow Ninja generator

This commit is contained in:
Daniel Agar 2015-10-06 14:57:55 -04:00
parent f13daa7314
commit 74a61a3610
1 changed files with 14 additions and 2 deletions

View File

@ -59,12 +59,24 @@ all: px4fmu-v2_default
ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)) ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
j ?= 4 j ?= 4
# disable ninja by default for now because it hides upload progress
#NINJA_BUILD := $(shell ninja --version 2>/dev/null)
ifdef NINJA_BUILD
PX4_CMAKE_GENERATOR ?= "Ninja"
PX4_MAKE = ninja
PX4_MAKE_ARGS =
else
PX4_CMAKE_GENERATOR ?= "Unix Makefiles"
PX4_MAKE = make
PX4_MAKE_ARGS = -j$(j) --no-print-directory
endif
# Functions # Functions
# -------------------------------------------------------------------- # --------------------------------------------------------------------
# describe how to build a cmake config # describe how to build a cmake config
define cmake-build define cmake-build
+mkdir -p $(PWD)/build_$@ && cd $(PWD)/build_$@ && cmake .. -G"Unix Makefiles" -DCONFIG=$(1) +@if [ ! -e $(PWD)/build_$@/CMakeCache.txt ]; then mkdir -p $(PWD)/build_$@ && cd $(PWD)/build_$@ && cmake .. -G$(PX4_CMAKE_GENERATOR) -DCONFIG=$(1); fi
+make -j$(j) -C $(PWD)/build_$@ --no-print-directory $(ARGS) +$(PX4_MAKE) -C $(PWD)/build_$@ $(PX4_MAKE_ARGS) $(ARGS)
endef endef
# create empty targets to avoid msgs for targets passed to cmake # create empty targets to avoid msgs for targets passed to cmake