mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-02 04:04:31 +02:00
Merge branch 'bugfix/common_components_linux' into 'master'
[build system]: Fixed common requirement for Linux target Closes IDF-3638 See merge request espressif/esp-idf!14743
This commit is contained in:
@@ -2,4 +2,5 @@ cmake_minimum_required(VERSION 3.5)
|
|||||||
|
|
||||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||||
set(COMPONENTS main)
|
set(COMPONENTS main)
|
||||||
|
list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/freertos/")
|
||||||
project(test_rom_host)
|
project(test_rom_host)
|
||||||
|
@@ -1,2 +1,3 @@
|
|||||||
CONFIG_IDF_TARGET="linux"
|
CONFIG_IDF_TARGET="linux"
|
||||||
CONFIG_COMPILER_CXX_EXCEPTIONS=y
|
CONFIG_COMPILER_CXX_EXCEPTIONS=y
|
||||||
|
CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER=n
|
||||||
|
@@ -1,12 +1,10 @@
|
|||||||
idf_build_get_property(target IDF_TARGET)
|
idf_build_get_property(target IDF_TARGET)
|
||||||
set(srcs "log.c")
|
set(srcs "log.c")
|
||||||
set(priv_requires "")
|
set(priv_requires "")
|
||||||
set(requires "")
|
|
||||||
if(${target} STREQUAL "linux")
|
if(${target} STREQUAL "linux")
|
||||||
# We leave log buffers out for now on Linux since it's rarely used. Excplicitely add esp_rom to Linux target
|
# We leave log buffers out for now on Linux since it's rarely used. Explicitely add esp_rom to Linux target
|
||||||
# since we don't have the common components there yet.
|
# since we don't have the common components there yet.
|
||||||
list(APPEND srcs "log_linux.c")
|
list(APPEND srcs "log_linux.c")
|
||||||
list(APPEND requires esp_rom)
|
|
||||||
else()
|
else()
|
||||||
list(APPEND srcs "log_buffers.c")
|
list(APPEND srcs "log_buffers.c")
|
||||||
list(APPEND priv_requires soc)
|
list(APPEND priv_requires soc)
|
||||||
@@ -15,7 +13,6 @@ endif()
|
|||||||
idf_component_register(SRCS ${srcs}
|
idf_component_register(SRCS ${srcs}
|
||||||
INCLUDE_DIRS "include"
|
INCLUDE_DIRS "include"
|
||||||
LDFRAGMENTS linker.lf
|
LDFRAGMENTS linker.lf
|
||||||
REQUIRES ${requires}
|
|
||||||
PRIV_REQUIRES ${priv_requires})
|
PRIV_REQUIRES ${priv_requires})
|
||||||
|
|
||||||
if(NOT ${target} STREQUAL "linux")
|
if(NOT ${target} STREQUAL "linux")
|
||||||
|
@@ -2,4 +2,5 @@ cmake_minimum_required(VERSION 3.5)
|
|||||||
|
|
||||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||||
set(COMPONENTS main)
|
set(COMPONENTS main)
|
||||||
|
list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/freertos/")
|
||||||
project(test_log_host)
|
project(test_log_host)
|
||||||
|
@@ -5,3 +5,4 @@ CONFIG_LOG_DEFAULT_LEVEL_VERBOSE=y
|
|||||||
CONFIG_LOG_DEFAULT_LEVEL=5
|
CONFIG_LOG_DEFAULT_LEVEL=5
|
||||||
CONFIG_LOG_MAXIMUM_LEVEL=5
|
CONFIG_LOG_MAXIMUM_LEVEL=5
|
||||||
CONFIG_LOG_MAXIMUM_EQUALS_DEFAULT=y
|
CONFIG_LOG_MAXIMUM_EQUALS_DEFAULT=y
|
||||||
|
CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER=n
|
||||||
|
@@ -15,12 +15,6 @@ set(srcs "src/nvs_api.cpp"
|
|||||||
|
|
||||||
set(public_req "spi_flash")
|
set(public_req "spi_flash")
|
||||||
|
|
||||||
# Current linux-based builds don't have common components.
|
|
||||||
# Add the necessary ones manually:
|
|
||||||
if(${target} STREQUAL "linux")
|
|
||||||
list(APPEND public_req "esp_rom" "esp_common" "log")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(include_dirs "include")
|
set(include_dirs "include")
|
||||||
|
|
||||||
idf_component_register(SRCS "${srcs}"
|
idf_component_register(SRCS "${srcs}"
|
||||||
|
@@ -3,6 +3,8 @@ cmake_minimum_required(VERSION 3.5)
|
|||||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||||
set(COMPONENTS main)
|
set(COMPONENTS main)
|
||||||
idf_component_set_property(spi_flash USE_MOCK 1)
|
idf_component_set_property(spi_flash USE_MOCK 1)
|
||||||
|
list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/driver/")
|
||||||
|
list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/freertos/")
|
||||||
idf_build_set_property(COMPILE_DEFINITIONS "-DNO_DEBUG_STORAGE" APPEND)
|
idf_build_set_property(COMPILE_DEFINITIONS "-DNO_DEBUG_STORAGE" APPEND)
|
||||||
project(host_nvs_page_test)
|
project(host_nvs_page_test)
|
||||||
|
|
||||||
|
@@ -30,17 +30,14 @@ if(${spi_flash_mock})
|
|||||||
"${MOCK_GEN_DIR}/Mockesp_spi_flash.c"
|
"${MOCK_GEN_DIR}/Mockesp_spi_flash.c"
|
||||||
"${MOCK_GEN_DIR}/Mockesp_flash.c")
|
"${MOCK_GEN_DIR}/Mockesp_flash.c")
|
||||||
|
|
||||||
set(requires "cmock")
|
|
||||||
|
|
||||||
if(${target} STREQUAL "linux")
|
if(${target} STREQUAL "linux")
|
||||||
list(APPEND include_dirs
|
list(APPEND include_dirs
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/../spi_flash/sim/stubs/soc/include")
|
"${CMAKE_CURRENT_SOURCE_DIR}/../spi_flash/sim/stubs/soc/include")
|
||||||
list(APPEND requires "esp_common")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
idf_component_register(SRCS "${srcs}"
|
idf_component_register(SRCS "${srcs}"
|
||||||
INCLUDE_DIRS "${include_dirs}"
|
INCLUDE_DIRS "${include_dirs}"
|
||||||
REQUIRES "${requires}")
|
REQUIRES "cmock")
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ruby_found SYMBOLIC
|
OUTPUT ruby_found SYMBOLIC
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
idf_build_get_property(target IDF_TARGET)
|
||||||
|
|
||||||
set(srcs
|
set(srcs
|
||||||
"unity/src/unity.c")
|
"unity/src/unity.c")
|
||||||
|
|
||||||
@@ -20,9 +22,7 @@ if(CONFIG_UNITY_ENABLE_FIXTURE)
|
|||||||
list(APPEND includes "unity/extras/fixture/src")
|
list(APPEND includes "unity/extras/fixture/src")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(${IDF_TARGET} STREQUAL "linux")
|
if(NOT "${target}" STREQUAL "linux")
|
||||||
list(APPEND requires "esp_common")
|
|
||||||
else()
|
|
||||||
list(APPEND srcs "unity_port_esp32.c")
|
list(APPEND srcs "unity_port_esp32.c")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ idf_component_register(SRCS "${srcs}"
|
|||||||
INCLUDE_DIRS ${includes}
|
INCLUDE_DIRS ${includes}
|
||||||
REQUIRES ${requires})
|
REQUIRES ${requires})
|
||||||
|
|
||||||
if(NOT ${IDF_TARGET} STREQUAL "linux")
|
if(NOT "${target}" STREQUAL "linux")
|
||||||
target_compile_definitions(${COMPONENT_LIB} PUBLIC
|
target_compile_definitions(${COMPONENT_LIB} PUBLIC
|
||||||
-DUNITY_INCLUDE_CONFIG_H
|
-DUNITY_INCLUDE_CONFIG_H
|
||||||
)
|
)
|
||||||
|
@@ -10,4 +10,4 @@ idf_component_register(SRCS "gpio_cxx_test.cpp"
|
|||||||
"${cpp_component}/include"
|
"${cpp_component}/include"
|
||||||
"${cpp_component}/test" # FIXME for unity_cxx.hpp, make it generally available instead
|
"${cpp_component}/test" # FIXME for unity_cxx.hpp, make it generally available instead
|
||||||
$ENV{IDF_PATH}/tools/catch
|
$ENV{IDF_PATH}/tools/catch
|
||||||
REQUIRES driver cmock esp_common)
|
REQUIRES driver cmock)
|
||||||
|
@@ -126,6 +126,9 @@ endfunction()
|
|||||||
# properties used for the processing phase of the build.
|
# properties used for the processing phase of the build.
|
||||||
#
|
#
|
||||||
function(__build_init idf_path)
|
function(__build_init idf_path)
|
||||||
|
|
||||||
|
set(target ${IDF_TARGET})
|
||||||
|
|
||||||
# Create the build target, to which the ESP-IDF build properties, dependencies are attached to.
|
# Create the build target, to which the ESP-IDF build properties, dependencies are attached to.
|
||||||
# Must be global so as to be accessible from any subdirectory in custom projects.
|
# Must be global so as to be accessible from any subdirectory in custom projects.
|
||||||
add_library(__idf_build_target STATIC IMPORTED GLOBAL)
|
add_library(__idf_build_target STATIC IMPORTED GLOBAL)
|
||||||
@@ -155,9 +158,10 @@ function(__build_init idf_path)
|
|||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
if("${target}" STREQUAL "linux")
|
||||||
idf_build_get_property(target IDF_TARGET)
|
set(requires_common freertos log esp_rom esp_common)
|
||||||
if(NOT target STREQUAL "linux")
|
idf_build_set_property(__COMPONENT_REQUIRES_COMMON "${requires_common}")
|
||||||
|
else()
|
||||||
# Set components required by all other components in the build
|
# Set components required by all other components in the build
|
||||||
#
|
#
|
||||||
# - lwip is here so that #include <sys/socket.h> works without any special provisions
|
# - lwip is here so that #include <sys/socket.h> works without any special provisions
|
||||||
@@ -411,10 +415,8 @@ macro(idf_build_process target)
|
|||||||
|
|
||||||
idf_build_get_property(target IDF_TARGET)
|
idf_build_get_property(target IDF_TARGET)
|
||||||
|
|
||||||
if(NOT target STREQUAL "linux")
|
if(NOT "${target}" STREQUAL "linux")
|
||||||
idf_build_set_property(__COMPONENT_REQUIRES_COMMON ${target} APPEND)
|
idf_build_set_property(__COMPONENT_REQUIRES_COMMON ${target} APPEND)
|
||||||
else()
|
|
||||||
idf_build_set_property(__COMPONENT_REQUIRES_COMMON "")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Call for component manager to download dependencies for all components
|
# Call for component manager to download dependencies for all components
|
||||||
|
@@ -1,6 +1,11 @@
|
|||||||
# Designed to be included from an IDF app's CMakeLists.txt file
|
# Designed to be included from an IDF app's CMakeLists.txt file
|
||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.5)
|
||||||
|
|
||||||
|
include(${CMAKE_CURRENT_LIST_DIR}/targets.cmake)
|
||||||
|
# Initialize build target for this build using the environment variable or
|
||||||
|
# value passed externally.
|
||||||
|
__target_init()
|
||||||
|
|
||||||
# The mere inclusion of this CMake file sets up some interal build properties.
|
# The mere inclusion of this CMake file sets up some interal build properties.
|
||||||
# These properties can be modified in between this inclusion the the idf_build_process
|
# These properties can be modified in between this inclusion the the idf_build_process
|
||||||
# call.
|
# call.
|
||||||
@@ -33,10 +38,6 @@ else()
|
|||||||
idf_build_set_property(EXTRA_CMAKE_ARGS "")
|
idf_build_set_property(EXTRA_CMAKE_ARGS "")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Initialize build target for this build using the environment variable or
|
|
||||||
# value passed externally.
|
|
||||||
__target_init()
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Get the project version from either a version file or the Git revision. This is passed
|
# Get the project version from either a version file or the Git revision. This is passed
|
||||||
# to the idf_build_process call. Dependencies are also set here for when the version file
|
# to the idf_build_process call. Dependencies are also set here for when the version file
|
||||||
@@ -172,7 +173,6 @@ function(__project_init components_var test_components_var)
|
|||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
|
||||||
# Add component directories to the build, given the component filters, exclusions
|
# Add component directories to the build, given the component filters, exclusions
|
||||||
# extra directories, etc. passed from the root CMakeLists.txt.
|
# extra directories, etc. passed from the root CMakeLists.txt.
|
||||||
if(COMPONENT_DIRS)
|
if(COMPONENT_DIRS)
|
||||||
|
Reference in New Issue
Block a user