forked from Archive/PX4-Autopilot
Merge pull request #2837 from mcharleb/cmake-2-param-fixes
cmake: Updated makefile to show the available build configs
This commit is contained in:
commit
7c3de9bc2c
76
Makefile
76
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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue