mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
Merge pull request #2861 from jgoppert/cmake-param
Fixed parameter generation dependencies.
This commit is contained in:
commit
80760cf162
@ -701,17 +701,38 @@ function(px4_create_git_hash_header)
|
||||
endfunction()
|
||||
|
||||
#=============================================================================
|
||||
# parameter file generation
|
||||
#
|
||||
# px4_generate_parameters
|
||||
#
|
||||
# Generates a source file with all parameters.
|
||||
#
|
||||
# Usage:
|
||||
# px4_generate_parameters(OUT <list-source-files>)
|
||||
#
|
||||
# Output:
|
||||
# OUT : the generate source files
|
||||
#
|
||||
# Example:
|
||||
# px4_generate_parameters(OUT parameters.c)
|
||||
#
|
||||
function(px4_generate_parameters)
|
||||
execute_process(
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/px_process_params.py -s ${CMAKE_SOURCE_DIR}/src --board ${BOARD} --xml
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/px_generate_params.py ${CMAKE_BINARY_DIR}/parameters.xml
|
||||
px4_parse_function_args(
|
||||
NAME px4_generate_parameters
|
||||
ONE_VALUE OUT
|
||||
REQUIRED OUT
|
||||
ARGN ${ARGN})
|
||||
set(generated_files
|
||||
${CMAKE_CURRENT_BINARY_DIR}/px4_parameters.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/px4_parameters.c)
|
||||
set_source_files_properties(${generated_files}
|
||||
PROPERTIES GENERATED TRUE)
|
||||
add_custom_command(OUTPUT ${generated_files}
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/px_process_params.py
|
||||
-s ${CMAKE_SOURCE_DIR}/src --board CONFIG_ARCH_${BOARD} --xml
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/px_generate_params.py
|
||||
parameters.xml
|
||||
)
|
||||
set(${OUT} ${generated_files} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
|
||||
# vim: set noet fenc=utf-8 ff=unix nowrap:
|
||||
|
||||
@ -97,6 +97,7 @@ set(config_module_list
|
||||
#
|
||||
# Library modules
|
||||
#
|
||||
modules/param
|
||||
modules/systemlib
|
||||
modules/systemlib/mixer
|
||||
modules/controllib
|
||||
|
||||
@ -69,6 +69,7 @@ set(config_module_list
|
||||
#
|
||||
# Library modules
|
||||
#
|
||||
modules/param
|
||||
modules/systemlib
|
||||
modules/systemlib/mixer
|
||||
modules/controllib
|
||||
|
||||
@ -22,6 +22,7 @@ set(config_module_list
|
||||
modules/mc_pos_control
|
||||
modules/mc_att_control
|
||||
|
||||
modules/param
|
||||
modules/systemlib
|
||||
modules/systemlib/mixer
|
||||
modules/uORB
|
||||
|
||||
@ -17,6 +17,7 @@ set(config_module_list
|
||||
|
||||
modules/mavlink
|
||||
|
||||
modules/param
|
||||
modules/systemlib
|
||||
modules/uORB
|
||||
modules/sensors
|
||||
|
||||
@ -15,6 +15,7 @@ set(config_module_list
|
||||
|
||||
modules/mavlink
|
||||
|
||||
modules/param
|
||||
modules/systemlib
|
||||
modules/uORB
|
||||
modules/dataman
|
||||
|
||||
@ -23,6 +23,7 @@ set(config_module_list
|
||||
systemcmds/reboot
|
||||
systemcmds/topic_listener
|
||||
modules/uORB
|
||||
modules/param
|
||||
modules/systemlib
|
||||
modules/systemlib/mixer
|
||||
modules/sensors
|
||||
|
||||
@ -13,6 +13,7 @@ set(config_module_list
|
||||
#
|
||||
# Library modules
|
||||
#
|
||||
modules/param
|
||||
modules/systemlib
|
||||
modules/uORB
|
||||
|
||||
|
||||
@ -33,6 +33,7 @@ set(config_module_list
|
||||
#
|
||||
# Library modules
|
||||
#
|
||||
modules/param
|
||||
modules/systemlib
|
||||
modules/systemlib/mixer
|
||||
modules/uORB
|
||||
|
||||
@ -13,6 +13,7 @@ set(config_module_list
|
||||
#
|
||||
# Library modules
|
||||
#
|
||||
modules/param
|
||||
modules/systemlib
|
||||
modules/uORB
|
||||
|
||||
|
||||
@ -55,6 +55,7 @@ set(config_module_list
|
||||
#
|
||||
# Library modules
|
||||
#
|
||||
modules/param
|
||||
modules/systemlib
|
||||
modules/systemlib/mixer
|
||||
modules/uORB
|
||||
|
||||
@ -13,6 +13,7 @@ set(config_module_list
|
||||
#
|
||||
# Library modules
|
||||
#
|
||||
modules/param
|
||||
modules/systemlib
|
||||
modules/systemlib/mixer
|
||||
modules/uORB
|
||||
|
||||
@ -36,6 +36,7 @@ set(config_module_list
|
||||
#
|
||||
# Library modules
|
||||
#
|
||||
modules/param
|
||||
modules/systemlib
|
||||
modules/systemlib/mixer
|
||||
modules/uORB
|
||||
|
||||
@ -8,10 +8,10 @@ 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 ${CMAKE_BINARY_DIR}/px4_parameters.c romfs.o)
|
||||
add_executable(firmware_nuttx
|
||||
builtin_commands.c
|
||||
romfs.o)
|
||||
set(nuttx_export_dir ${CMAKE_BINARY_DIR}/${BOARD}/NuttX/nuttx-export)
|
||||
set(main_link_flags
|
||||
"-T${nuttx_export_dir}/build/ld.script"
|
||||
|
||||
@ -5,11 +5,8 @@ px4_posix_generate_builtin_commands(
|
||||
OUT apps.h
|
||||
MODULE_LIST ${module_libraries})
|
||||
|
||||
px4_generate_parameters()
|
||||
|
||||
add_executable(mainapp
|
||||
${CMAKE_SOURCE_DIR}/src/platforms/posix/main.cpp
|
||||
${CMAKE_BINARY_DIR}/px4_parameters.c
|
||||
apps.h
|
||||
)
|
||||
|
||||
|
||||
@ -14,18 +14,14 @@ 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
|
||||
${CMAKE_SOURCE_DIR}/src/platforms/qurt/dspal/dspal_stub.c
|
||||
${CMAKE_BINARY_DIR}/px4_parameters.c
|
||||
${CMAKE_BINARY_DIR}/apps.h)
|
||||
else("${QURT_ENABLE_STUBS}" STREQUAL "1")
|
||||
add_library(mainapp
|
||||
${CMAKE_SOURCE_DIR}/src/platforms/qurt/dspal/dspal_stub.c
|
||||
${CMAKE_BINARY_DIR}/px4_parameters.c
|
||||
${CMAKE_BINARY_DIR}/apps.h)
|
||||
endif()
|
||||
|
||||
|
||||
50
src/modules/param/CMakeLists.txt
Normal file
50
src/modules/param/CMakeLists.txt
Normal file
@ -0,0 +1,50 @@
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2015 PX4 Development Team. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name PX4 nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
px4_generate_parameters(OUT param_files)
|
||||
|
||||
set(srcs
|
||||
${param_files}
|
||||
)
|
||||
|
||||
px4_add_module(
|
||||
MODULE modules__param
|
||||
COMPILE_FLAGS
|
||||
-Os
|
||||
SRCS ${srcs}
|
||||
DEPENDS
|
||||
platforms__common
|
||||
)
|
||||
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
|
||||
@ -31,6 +31,9 @@
|
||||
#
|
||||
############################################################################
|
||||
|
||||
# for generated files
|
||||
include_directories(${CMAKE_BINARY_DIR}/src/modules/param)
|
||||
|
||||
set(SRCS
|
||||
perf_counter.c
|
||||
param/param.c
|
||||
@ -76,5 +79,6 @@ px4_add_module(
|
||||
SRCS ${SRCS}
|
||||
DEPENDS
|
||||
platforms__common
|
||||
modules__param
|
||||
)
|
||||
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user