Merge pull request #2837 from mcharleb/cmake-2-param-fixes

cmake: Updated makefile to show the available build configs
This commit is contained in:
Lorenz Meier 2015-09-12 01:21:55 +02:00
commit 7c3de9bc2c
4 changed files with 18 additions and 65 deletions

View File

@ -31,70 +31,18 @@
# #
############################################################################ ############################################################################
# Help CONFIGS:=$(shell ls cmake/configs | sed -e "s~.*/~~" | sed -e "s~\..*~~")
# --------------------------------------------------------------------
# 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.
# Parsing $(CONFIGS):
# -------------------------------------------------------------------- @mkdir -p Build/$@
# assume 1st argument passed is the main target, the @cd Build/$@ && cmake ../.. -DCONFIG=$@
# rest are arguments to pass to the makefile generated @cd Build/$@ && make
# by cmake in the subdirectory
ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
# Functions clean-all:
# -------------------------------------------------------------------- @rm -rf Build/*
# 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
help:
# ADD CONFIGS HERE @echo
# -------------------------------------------------------------------- @echo "Type 'make ' and hit the tab key twice to see a list of the available"
# Do not put any spaces between function arguments. @echo "build configurations."
@echo
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

View File

@ -483,7 +483,6 @@ function(px4_add_common_flags)
-Werror=reorder -Werror=reorder
-Werror=uninitialized -Werror=uninitialized
-Werror=init-self -Werror=init-self
-Wno-unused-const-variable
#-Wcast-qual - generates spurious noreturn attribute warnings, #-Wcast-qual - generates spurious noreturn attribute warnings,
# try again later # try again later
#-Wconversion - would be nice, but too many "risky-but-safe" #-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") if (NOT ${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
list(APPEND warnings list(APPEND warnings
-Wno-unused-const-variable
-Werror=unused-but-set-variable -Werror=unused-but-set-variable
-Wformat=1 -Wformat=1
#-Wlogical-op # very verbose due to eigen #-Wlogical-op # very verbose due to eigen
@ -574,6 +574,7 @@ function(px4_add_common_flags)
set(added_include_dirs set(added_include_dirs
src src
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/src ${CMAKE_BINARY_DIR}/src
src/modules src/modules
src/include src/include

View File

@ -8,6 +8,8 @@ px4_nuttx_generate_builtin_commands(
px4_nuttx_generate_romfs(OUT romfs.o px4_nuttx_generate_romfs(OUT romfs.o
ROOT ROMFS/px4fmu_common) ROOT ROMFS/px4fmu_common)
px4_generate_parameters()
# add executable # add executable
add_executable(firmware_nuttx builtin_commands.c romfs.o) add_executable(firmware_nuttx builtin_commands.c romfs.o)
set(nuttx_export_dir ${CMAKE_BINARY_DIR}/${BOARD}/NuttX/nuttx-export) set(nuttx_export_dir ${CMAKE_BINARY_DIR}/${BOARD}/NuttX/nuttx-export)

View File

@ -14,6 +14,8 @@ px4_qurt_generate_builtin_commands(
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
px4_generate_parameters()
# Enable build without HexagonSDK to check link dependencies # Enable build without HexagonSDK to check link dependencies
if ("${QURT_ENABLE_STUBS}" STREQUAL "1") if ("${QURT_ENABLE_STUBS}" STREQUAL "1")
add_executable(mainapp add_executable(mainapp