From e4b9212e96c2297d2d7aaa1e8ee7050f95f7f922 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Fri, 11 Sep 2015 16:15:48 -0700 Subject: [PATCH] cmake: Updated makefie to show the available build configs Also fixed param support for nuttx and qurt Signed-off-by: Mark Charlebois --- Makefile | 76 +++++-------------------------- cmake/common/px4_base.cmake | 3 +- src/firmware/nuttx/CMakeLists.txt | 2 + src/firmware/qurt/CMakeLists.txt | 2 + 4 files changed, 18 insertions(+), 65 deletions(-) diff --git a/Makefile b/Makefile index 604147554c..0aadc6d5fc 100644 --- a/Makefile +++ b/Makefile @@ -31,70 +31,18 @@ # ############################################################################ -# Help -# -------------------------------------------------------------------- -# Don't be afraid of this makefile, it is just passing -# arguments to cmake to allow us to keep the wiki pages etc. -# that describe how to build the px4 firmware -# the same even when using cmake instead of make. -# -# Example usage: -# -# make px4fmu-v2_default (builds) -# make px4fmu-v2_default upload (builds and uploads) -# make px4fmu-v2_default test (builds and tests) -# -# This tells cmake to build the nuttx px4fmu-v2 default config in the -# directory build_nuttx_px4fmu-v2_default and then call make -# in that directory with the target upload. +CONFIGS:=$(shell ls cmake/configs | sed -e "s~.*/~~" | sed -e "s~\..*~~") -# Parsing -# -------------------------------------------------------------------- -# assume 1st argument passed is the main target, the -# rest are arguments to pass to the makefile generated -# by cmake in the subdirectory -ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)) +$(CONFIGS): + @mkdir -p Build/$@ + @cd Build/$@ && cmake ../.. -DCONFIG=$@ + @cd Build/$@ && make -# Functions -# -------------------------------------------------------------------- -# define a make function to describe how to build a cmake config -define cmake-build -mkdir -p $(PWD)/build_$@ && cd $(PWD)/build_$@ && cmake .. -DCONFIG=$(1) -make -C $(PWD)/build_$@ -s $(ARGS) -endef +clean-all: + @rm -rf Build/* - -# ADD CONFIGS HERE -# -------------------------------------------------------------------- -# Do not put any spaces between function arguments. - -px4fmu-v2_default: - $(call cmake-build,nuttx_px4fmu-v2_default) - -px4fmu-v2_simple: - $(call cmake-build,nuttx_px4fmu-v2_simple) - -nuttx_sim_simple: - $(call cmake-build,$@) - -posix_sitl_simple: - $(call cmake-build,$@) - -qurt_eagle_travis: - $(call cmake-build,$@) - -# Other targets -# -------------------------------------------------------------------- -# explicity set default build target -all: px4fmu-v2_default - -clean: - rm -rf build_*/ - -# targets handled by cmake -test: ; -upload: ; -package: ; -package_source: ; - -.PHONY: clean test upload package package_source +help: + @echo + @echo "Type 'make ' and hit the tab key twice to see a list of the available" + @echo "build configurations." + @echo diff --git a/cmake/common/px4_base.cmake b/cmake/common/px4_base.cmake index 17f162cb28..4b42f388cf 100644 --- a/cmake/common/px4_base.cmake +++ b/cmake/common/px4_base.cmake @@ -483,7 +483,6 @@ function(px4_add_common_flags) -Werror=reorder -Werror=uninitialized -Werror=init-self - -Wno-unused-const-variable #-Wcast-qual - generates spurious noreturn attribute warnings, # try again later #-Wconversion - would be nice, but too many "risky-but-safe" @@ -494,6 +493,7 @@ function(px4_add_common_flags) if (NOT ${CMAKE_C_COMPILER_ID} STREQUAL "Clang") list(APPEND warnings + -Wno-unused-const-variable -Werror=unused-but-set-variable -Wformat=1 #-Wlogical-op # very verbose due to eigen @@ -574,6 +574,7 @@ function(px4_add_common_flags) set(added_include_dirs src + ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/src src/modules src/include diff --git a/src/firmware/nuttx/CMakeLists.txt b/src/firmware/nuttx/CMakeLists.txt index 667bdaa822..13118146f5 100644 --- a/src/firmware/nuttx/CMakeLists.txt +++ b/src/firmware/nuttx/CMakeLists.txt @@ -8,6 +8,8 @@ px4_nuttx_generate_builtin_commands( px4_nuttx_generate_romfs(OUT romfs.o ROOT ROMFS/px4fmu_common) +px4_generate_parameters() + # add executable add_executable(firmware_nuttx builtin_commands.c romfs.o) set(nuttx_export_dir ${CMAKE_BINARY_DIR}/${BOARD}/NuttX/nuttx-export) diff --git a/src/firmware/qurt/CMakeLists.txt b/src/firmware/qurt/CMakeLists.txt index e720715ef2..8e8b3ea7f5 100644 --- a/src/firmware/qurt/CMakeLists.txt +++ b/src/firmware/qurt/CMakeLists.txt @@ -14,6 +14,8 @@ px4_qurt_generate_builtin_commands( set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") +px4_generate_parameters() + # Enable build without HexagonSDK to check link dependencies if ("${QURT_ENABLE_STUBS}" STREQUAL "1") add_executable(mainapp