Fixed parameter generation dependencies.

This commit is contained in:
James Goppert 2015-09-13 18:30:32 -04:00
parent 97802999e8
commit 19c84126a4
5 changed files with 38 additions and 18 deletions

View File

@ -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:

View File

@ -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"

View File

@ -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
)

View File

@ -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()

View File

@ -31,7 +31,13 @@
#
############################################################################
px4_generate_parameters(OUT param_files)
# for generated files
include_directories(${CMAKE_CURRENT_BINARY_DIR})
set(SRCS
${param_files}
perf_counter.c
param/param.c
conversions.c