From 9297b07a97ebca266657a2043f250e9fe3868f12 Mon Sep 17 00:00:00 2001 From: morris Date: Wed, 6 Mar 2019 12:18:38 +0800 Subject: [PATCH] cmake: add spaces2list for COMPONENT_SRCS According to ESP-IDF Cmake build system document, COMPONENT_SRCS should support using spaces to sperate source files. Closes https://github.com/espressif/esp-idf/issues/3130 --- tools/ci/test_build_system_cmake.sh | 12 ++++++++++-- tools/cmake/components.cmake | 3 ++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/tools/ci/test_build_system_cmake.sh b/tools/ci/test_build_system_cmake.sh index f63aae7f9..ee3c2ca4b 100755 --- a/tools/ci/test_build_system_cmake.sh +++ b/tools/ci/test_build_system_cmake.sh @@ -107,19 +107,27 @@ function run_tests() idf.py build || failure "Failed to rebuild with changed app version" assert_rebuilt ${APP_BINS} assert_not_rebuilt ${BOOTLOADER_BINS} esp-idf/esp32/libesp32.a - + print_status "Re-building does not change app.bin" take_build_snapshot idf.py build assert_not_rebuilt ${APP_BINS} ${BOOTLOADER_BINS} esp-idf/esp32/libesp32.a rm -f ${TESTDIR}/template/version.txt - + print_status "Get the version of app from git describe. Project is not inside IDF and do not have a tag only a hash commit." idf.py build >> log.log || failure "Failed to build" version="Project version: " version+=$(git describe --always --tags --dirty) grep "${version}" log.log || failure "Project version should have a hash commit" + print_status "Can set COMPONENT_SRCS with spaces" + clean_build_dir + touch main/main2.c + sed -i 's/^set(COMPONENT_SRCS.*/set(COMPONENT_SRCS "main.c main2.c")/' main/CMakeLists.txt + idf.py build || failure "Set COMPONENT_SRCS with spaces build failed" + git checkout -- main/CMakeLists.txt + rm main/main2.c + print_status "Moving BUILD_DIR_BASE out of tree" clean_build_dir OUTOFTREE_BUILD=${TESTDIR}/alt_build diff --git a/tools/cmake/components.cmake b/tools/cmake/components.cmake index 82d0fbcaa..4abc5990a 100644 --- a/tools/cmake/components.cmake +++ b/tools/cmake/components.cmake @@ -17,6 +17,7 @@ endfunction() function(register_component) get_filename_component(component_dir ${CMAKE_CURRENT_LIST_FILE} DIRECTORY) + spaces2list(COMPONENT_SRCS) spaces2list(COMPONENT_SRCDIRS) spaces2list(COMPONENT_ADD_INCLUDEDIRS) spaces2list(COMPONENT_SRCEXCLUDE) @@ -175,4 +176,4 @@ endfunction() function(component_get_target var component) get_property(prefix GLOBAL PROPERTY __IDF_COMPONENTS_PREFIX) set(${var} ${prefix}_${component} PARENT_SCOPE) -endfunction() \ No newline at end of file +endfunction()