Merge pull request #42 from mcharleb/cmake-mc

Cmake mc
This commit is contained in:
James Goppert 2015-09-10 22:30:42 -04:00
commit 3104a974a9
13 changed files with 134 additions and 17 deletions

0
Build/.keep Normal file
View File

View File

@ -109,13 +109,63 @@ set(verion_patch 2)
set(version "${version_major}.${version_minor}.${version_patch}")
set(package-contact "px4users@googlegroups.com")
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
#=============================================================================
# cmake modules
#
if (NOT NESTED_CMAKE_CALL)
message(STATUS "IN TOP")
if (EXISTS ${CMAKE_SOURCE_DIR}/cmake/configs/config_${CONFIG}.cmake)
# Get the toolchain information
include(configs/config_${CONFIG})
else()
message(FATAL_ERROR "build config not found: config_${CONFIG}.cmake")
endif()
if (NOT "${USE_TOOLCHAIN}" STREQUAL "")
set(TOOLCHAIN -DCMAKE_TOOLCHAIN_FILE=${CMAKE_SOURCE_DIR}/cmake/toolchains/${USE_TOOLCHAIN}.cmake)
endif()
string(REPLACE "_" ";" TARGET_PARAMS ${CONFIG})
list(GET TARGET_PARAMS 0 OS)
list(GET TARGET_PARAMS 1 BOARD)
list(GET TARGET_PARAMS 2 LABEL)
message(STATUS "CONFIG ${OS} ${BOARD} ${LABEL}")
if ("${LABEL}" STREQUAL "upload")
set(LABEL "simple")
set(DOUPLOAD "1")
endif()
if ("${LABEL}" STREQUAL "test")
set(LABEL "simple")
set(DOTEST "1")
endif()
execute_process( COMMAND ${CMAKE_COMMAND} -E make_directory ${CONFIG} )
set(NESTED_CMAKE_CALL 1)
message(STATUS "Before")
execute_process(WORKING_DIRECTORY ${CONFIG}
COMMAND ${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR} -DNESTED_CMAKE_CALL=TRUE ${TOOLCHAIN} -DOS=${OS} -DBOARD=${BOARD} -DLABEL=${LABEL}
)
execute_process( WORKING_DIRECTORY ${CONFIG}
COMMAND make -s
)
message(STATUS "${CMAKE_COMMAND} VERBOSE=1 ${CMAKE_SOURCE_DIR} ${TOOLCHAIN} -DOS=${OS} -DBOARD=${BOARD} -DLABEL=${LABEL}")
if ("${DOUPLOAD}" STREQUAL "1")
execute_process( WORKING_DIRECTORY ${CONFIG}
COMMAND make upload)
endif()
if ("${DOTEST}" STREQUAL "1")
execute_process( WORKING_DIRECTORY ${CONFIG}
COMMAND make test)
endif()
return()
endif(NOT NESTED_CMAKE_CALL)
#=============================================================================
# cmake modules
#
# set module path
message("OS = ${OS}")
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
# prefer board implementation module over os implmementation module
set(config_module "configs/config_${OS}_${BOARD}_${LABEL}")

View File

@ -2,7 +2,12 @@ include(nuttx/px4_impl_nuttx)
message(WARNING "this is a work in progress and doesn't build yet")
function(px4_set_config_modules out_module_list)
function(px4_get_config)
px4_parse_function_args(
NAME px4_set_config_modules
ONE_VALUE OUT_MODULES OUT_FW_OPTS OUT_EXTRA_CMDS
ARGN ${ARGN})
set(config_module_list
platforms/nuttx

View File

@ -1,6 +1,11 @@
include(posix/px4_impl_posix-arm)
function(px4_set_config_modules out_module_list)
function(px4_get_config)
px4_parse_function_args(
NAME px4_set_config_modules
ONE_VALUE OUT_MODULES OUT_FW_OPTS OUT_EXTRA_CMDS
ARGN ${ARGN})
set(config_module_list
drivers/device

View File

@ -1,6 +1,11 @@
include(posix/px4_impl_posix-arm)
function(px4_set_config_modules out_module_list)
function(px4_get_config)
px4_parse_function_args(
NAME px4_set_config_modules
ONE_VALUE OUT_MODULES OUT_FW_OPTS OUT_EXTRA_CMDS
ARGN ${ARGN})
set(config_module_list
drivers/device

View File

@ -1,6 +1,11 @@
include(posix/px4_impl_posix-arm)
function(px4_set_config_modules out_module_list)
function(px4_get_config)
px4_parse_function_args(
NAME px4_set_config_modules
ONE_VALUE OUT_MODULES OUT_FW_OPTS OUT_EXTRA_CMDS
ARGN ${ARGN})
set(config_module_list
drivers/device

View File

@ -1,6 +1,11 @@
include(posix/px4_impl_posix-arm)
function(px4_set_config_modules out_module_list)
function(px4_get_config)
px4_parse_function_args(
NAME px4_set_config_modules
ONE_VALUE OUT_MODULES OUT_FW_OPTS OUT_EXTRA_CMDS
ARGN ${ARGN})
set(config_module_list
drivers/device

View File

@ -1,6 +1,12 @@
include(qurt/px4_impl_qurt)
function(px4_set_config_modules out_module_list)
function(px4_get_config)
px4_parse_function_args(
NAME px4_set_config_modules
ONE_VALUE OUT_MODULES
REQUIRED OUT_MODULES
ARGN ${ARGN})
set(config_module_list
drivers/device
@ -26,5 +32,8 @@ function(px4_set_config_modules out_module_list)
)
set(${out_module_list} ${config_module_list} PARENT_SCOPE)
# output
set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE)
endfunction()

View File

@ -1,6 +1,14 @@
include(qurt/px4_impl_qurt)
function(px4_set_config_modules out_module_list)
set(USE_TOOLCHAIN Toolchain-hexagon)
function(px4_get_config)
px4_parse_function_args(
NAME px4_set_config_modules
ONE_VALUE OUT_MODULES
REQUIRED OUT_MODULES
ARGN ${ARGN})
set(config_module_list
drivers/device
@ -60,7 +68,8 @@ function(px4_set_config_modules out_module_list)
#
modules/muorb/adsp
)
set(${out_module_list} ${config_module_list} PARENT_SCOPE)
set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE)
endfunction()

View File

@ -1,6 +1,12 @@
include(qurt/px4_impl_qurt)
function(px4_set_config_modules out_module_list)
function(px4_get_config)
px4_parse_function_args(
NAME px4_set_config_modules
ONE_VALUE OUT_MODULES
REQUIRED
ARGN ${ARGN})
set(config_module_list
drivers/device
@ -38,7 +44,7 @@ function(px4_set_config_modules out_module_list)
#
modules/muorb/adsp
)
set(${out_module_list} ${config_module_list} PARENT_SCOPE)
set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE)
endfunction()

View File

@ -19,7 +19,13 @@ set(target_libraries
rc_receiver
)
function(px4_set_config_modules out_module_list)
function(px4_get_config)
px4_parse_function_args(
NAME px4_set_config_modules
ONE_VALUE OUT_MODULES
REQUIRED OUT_MODULES
ARGN ${ARGN})
set(config_module_list
#
@ -81,6 +87,6 @@ function(px4_set_config_modules out_module_list)
#
modules/muorb/adsp
)
set(${out_module_list} ${config_module_list} PARENT_SCOPE)
set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE)
endfunction()

View File

@ -1,6 +1,12 @@
include(qurt/px4_impl_qurt)
function(px4_set_config_modules out_module_list)
function(px4_get_config)
px4_parse_function_args(
NAME px4_set_config_modules
ONE_VALUE OUT_MODULES
REQUIRED OUT_MODULES
ARGN ${ARGN})
set(config_module_list
drivers/device
@ -35,7 +41,7 @@ function(px4_set_config_modules out_module_list)
platforms/qurt/tests/hrt_test
platforms/qurt/tests/wqueue
)
set(${out_module_list} ${config_module_list} PARENT_SCOPE)
set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE)
endfunction()

View File

@ -3,7 +3,13 @@ include(qurt/px4_impl_qurt)
# Run a full link with build stubs to make sure qurt target isn't broken
set(QURT_ENABLE_STUBS 1)
function(px4_set_config_modules out_module_list)
function(px4_get_config)
px4_parse_function_args(
NAME px4_set_config_modules
ONE_VALUE OUT_MODULES
REQUIRED OUT_MODULES
ARGN ${ARGN})
set(config_module_list
drivers/device
@ -63,7 +69,7 @@ function(px4_set_config_modules out_module_list)
#
modules/muorb/adsp
)
set(${out_module_list} ${config_module_list} PARENT_SCOPE)
set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE)
endfunction()