Skip to content
Snippets Groups Projects
Commit 74a61a36 authored by Daniel Agar's avatar Daniel Agar
Browse files

cmake allow Ninja generator

parent f13daa73
No related branches found
No related tags found
No related merge requests found
......@@ -59,12 +59,24 @@ all: px4fmu-v2_default
ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
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
# --------------------------------------------------------------------
# describe how to build a cmake config
define cmake-build
+mkdir -p $(PWD)/build_$@ && cd $(PWD)/build_$@ && cmake .. -G"Unix Makefiles" -DCONFIG=$(1)
+make -j$(j) -C $(PWD)/build_$@ --no-print-directory $(ARGS)
+@if [ ! -e $(PWD)/build_$@/CMakeCache.txt ]; then mkdir -p $(PWD)/build_$@ && cd $(PWD)/build_$@ && cmake .. -G$(PX4_CMAKE_GENERATOR) -DCONFIG=$(1); fi
+$(PX4_MAKE) -C $(PWD)/build_$@ $(PX4_MAKE_ARGS) $(ARGS)
endef
# create empty targets to avoid msgs for targets passed to cmake
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment