[build system]: Fixed common requirement for Linux

This commit is contained in:
Jakob Hasse
2021-08-11 15:22:50 +08:00
parent 8750034c19
commit 7029f0537e
12 changed files with 26 additions and 30 deletions

View File

@@ -2,4 +2,5 @@ cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
set(COMPONENTS main)
list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/freertos/")
project(test_rom_host)

View File

@@ -1,2 +1,3 @@
CONFIG_IDF_TARGET="linux"
CONFIG_COMPILER_CXX_EXCEPTIONS=y
CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER=n

View File

@@ -1,12 +1,10 @@
idf_build_get_property(target IDF_TARGET)
set(srcs "log.c")
set(priv_requires "")
set(requires "")
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.
list(APPEND srcs "log_linux.c")
list(APPEND requires esp_rom)
else()
list(APPEND srcs "log_buffers.c")
list(APPEND priv_requires soc)
@@ -15,7 +13,6 @@ endif()
idf_component_register(SRCS ${srcs}
INCLUDE_DIRS "include"
LDFRAGMENTS linker.lf
REQUIRES ${requires}
PRIV_REQUIRES ${priv_requires})
if(NOT ${target} STREQUAL "linux")

View File

@@ -2,4 +2,5 @@ cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
set(COMPONENTS main)
list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/freertos/")
project(test_log_host)

View File

@@ -5,3 +5,4 @@ CONFIG_LOG_DEFAULT_LEVEL_VERBOSE=y
CONFIG_LOG_DEFAULT_LEVEL=5
CONFIG_LOG_MAXIMUM_LEVEL=5
CONFIG_LOG_MAXIMUM_EQUALS_DEFAULT=y
CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER=n

View File

@@ -15,12 +15,6 @@ set(srcs "src/nvs_api.cpp"
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")
idf_component_register(SRCS "${srcs}"

View File

@@ -3,6 +3,8 @@ cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
set(COMPONENTS main)
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)
project(host_nvs_page_test)

View File

@@ -30,17 +30,14 @@ if(${spi_flash_mock})
"${MOCK_GEN_DIR}/Mockesp_spi_flash.c"
"${MOCK_GEN_DIR}/Mockesp_flash.c")
set(requires "cmock")
if(${target} STREQUAL "linux")
list(APPEND include_dirs
"${CMAKE_CURRENT_SOURCE_DIR}/../spi_flash/sim/stubs/soc/include")
list(APPEND requires "esp_common")
endif()
idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "${include_dirs}"
REQUIRES "${requires}")
REQUIRES "cmock")
add_custom_command(
OUTPUT ruby_found SYMBOLIC

View File

@@ -1,3 +1,5 @@
idf_build_get_property(target IDF_TARGET)
set(srcs
"unity/src/unity.c")
@@ -20,9 +22,7 @@ if(CONFIG_UNITY_ENABLE_FIXTURE)
list(APPEND includes "unity/extras/fixture/src")
endif()
if(${IDF_TARGET} STREQUAL "linux")
list(APPEND requires "esp_common")
else()
if(NOT "${target}" STREQUAL "linux")
list(APPEND srcs "unity_port_esp32.c")
endif()
@@ -30,7 +30,7 @@ idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS ${includes}
REQUIRES ${requires})
if(NOT ${IDF_TARGET} STREQUAL "linux")
if(NOT "${target}" STREQUAL "linux")
target_compile_definitions(${COMPONENT_LIB} PUBLIC
-DUNITY_INCLUDE_CONFIG_H
)