Skip to content

Commit

Permalink
refactor(linux): excluded all non-Linux components from build
Browse files Browse the repository at this point in the history
* All components which won't build (yet) on Linux are excluded.
  This enables switching to Linux in an application without
  explicitly setting COMPONENTS to main in the main
  CMakeLists.txt.
* ESP Timer provides headers for Linux now
* automatically disabling LWIP in Kconfig if it is not available

doc(linux): brought section
  "Component Linux/Mock Support Overview" up to date
  • Loading branch information
0xjakob committed Oct 16, 2023
1 parent 4f3e05f commit 548022f
Show file tree
Hide file tree
Showing 51 changed files with 295 additions and 14 deletions.
6 changes: 6 additions & 0 deletions components/app_trace/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)

if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()

set(srcs
"app_trace.c"
"app_trace_util.c"
Expand Down
6 changes: 6 additions & 0 deletions components/app_update/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)

if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()

idf_component_register(SRCS "esp_ota_ops.c" "esp_ota_app_desc.c"
INCLUDE_DIRS "include"
REQUIRES partition_table bootloader_support esp_app_format esp_bootloader_format esp_partition
Expand Down
6 changes: 6 additions & 0 deletions components/bootloader/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)

if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()

idf_component_register(PRIV_REQUIRES partition_table esptool_py)

# Do not generate flash file when building bootloader or is in early expansion of the build
Expand Down
6 changes: 6 additions & 0 deletions components/bootloader_support/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)

if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()

set(srcs
"src/bootloader_common.c"
"src/bootloader_common_loader.c"
Expand Down
6 changes: 6 additions & 0 deletions components/bt/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)

if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()

# API headers that are used in the docs are also compiled
# even if CONFIG_BT_ENABLED=n as long as CONFIG_IDF_DOC_BUILD=y

Expand Down
7 changes: 7 additions & 0 deletions components/console/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
idf_build_get_property(target IDF_TARGET)

if(${target} STREQUAL "linux")
return() # This component is currently not supported by the POSIX/Linux simulator, but we may support it in the
# future (TODO: IDF-8103)
endif()

set(argtable_srcs argtable3/arg_cmd.c
argtable3/arg_date.c
argtable3/arg_dbl.c
Expand Down
6 changes: 6 additions & 0 deletions components/cxx/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)

if(${target} STREQUAL "linux")
return() # This component is not necessary on the POSIX/Linux simulator
endif()

idf_component_register(SRCS "cxx_exception_stubs.cpp"
"cxx_guards.cpp"
# Make sure that pthread is in component list
Expand Down
4 changes: 4 additions & 0 deletions components/driver/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
idf_build_get_property(target IDF_TARGET)

if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()

# Always compiled source files
set(srcs
"gpio/gpio.c"
Expand Down
4 changes: 4 additions & 0 deletions components/efuse/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
idf_build_get_property(target IDF_TARGET)

if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()

if(CONFIG_EFUSE_VIRTUAL)
message(STATUS "Efuse virtual mode is enabled. If Secure boot or Flash encryption is on"
" it does not provide any security. FOR TESTING ONLY!")
Expand Down
4 changes: 4 additions & 0 deletions components/esp_adc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
idf_build_get_property(target IDF_TARGET)

if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()

set(includes "include" "interface" "${target}/include" "deprecated/include")

set(srcs "adc_cali.c"
Expand Down
6 changes: 6 additions & 0 deletions components/esp_app_format/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)

if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()

if(NOT BOOTLOADER_BUILD)
set(src "esp_app_desc.c")
else()
Expand Down
6 changes: 6 additions & 0 deletions components/esp_bootloader_format/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)

if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()

idf_component_register(SRCS "esp_bootloader_desc.c"
INCLUDE_DIRS "include")

Expand Down
4 changes: 4 additions & 0 deletions components/esp_coex/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
idf_build_get_property(idf_target IDF_TARGET)

if(${idf_target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()

if(CONFIG_ESP_COEX_SW_COEXIST_ENABLE OR CONFIG_ESP_COEX_EXTERNAL_COEXIST_ENABLE)
if(CONFIG_APP_NO_BLOBS)
set(link_binary_libs 0)
Expand Down
6 changes: 6 additions & 0 deletions components/esp_eth/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)

if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()

idf_build_get_property(components_to_build BUILD_COMPONENTS)

set(srcs)
Expand Down
8 changes: 7 additions & 1 deletion components/esp_gdbstub/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
set(srcs "src/gdbstub.c"
idf_build_get_property(target IDF_TARGET)

if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()

set(srcs "src/gdbstub.c"
"src/gdbstub_transport.c"
"src/packet.c")

Expand Down
6 changes: 6 additions & 0 deletions components/esp_hid/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)

if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()

set(srcs "src/esp_hidd.c"
"src/esp_hidh.c"
"src/esp_hid_common.c")
Expand Down
6 changes: 6 additions & 0 deletions components/esp_https_ota/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)

if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()

idf_component_register(SRCS "src/esp_https_ota.c"
INCLUDE_DIRS "include"
REQUIRES esp_http_client bootloader_support esp_app_format esp_event
Expand Down
6 changes: 6 additions & 0 deletions components/esp_lcd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)

if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()

set(srcs "src/esp_lcd_common.c"
"src/esp_lcd_panel_io.c"
"src/esp_lcd_panel_io_i2c_v1.c"
Expand Down
6 changes: 6 additions & 0 deletions components/esp_local_ctrl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)

if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()

set(include_dirs include)
set(priv_include_dirs proto-c src ../protocomm/proto-c)
set(srcs "src/esp_local_ctrl.c"
Expand Down
4 changes: 4 additions & 0 deletions components/esp_mm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
idf_build_get_property(target IDF_TARGET)

if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()

set(includes "include")

# Note: requires spi_flash for cache_utils, will be refactored
Expand Down
1 change: 1 addition & 0 deletions components/esp_netif/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ menu "ESP NETIF Adapter"
config ESP_NETIF_TCPIP_LWIP
bool "LwIP"
select ESP_NETIF_USES_TCPIP_WITH_BSD_API
depends on LWIP_ENABLE
help
lwIP is a small independent implementation of the TCP/IP protocol suite.

Expand Down
4 changes: 2 additions & 2 deletions components/esp_netif/loopback/esp_netif_loopback.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,13 @@ void esp_netif_free_rx_buffer(void *h, void* buffer)

esp_err_t esp_netif_transmit(esp_netif_t *esp_netif, void* data, size_t len)
{
ESP_LOGV(TAG, "Transmitting data: ptr:%p, size:%d", data, len);
ESP_LOGV(TAG, "Transmitting data: ptr:%p, size:%lu", data, (long unsigned int) len);
return (esp_netif->driver_transmit)(esp_netif->driver_handle, data, len);
}

esp_err_t esp_netif_receive(esp_netif_t *esp_netif, void *buffer, size_t len, void *eb)
{
ESP_LOGV(TAG, "Received data: ptr:%p, size:%d", buffer, len);
ESP_LOGV(TAG, "Received data: ptr:%p, size:%lu", buffer, (long unsigned int) len);
esp_netif_transmit(esp_netif, buffer, len);
if (eb) {
esp_netif_free_rx_buffer(esp_netif, eb);
Expand Down
4 changes: 4 additions & 0 deletions components/esp_phy/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
idf_build_get_property(idf_target IDF_TARGET)

if(${idf_target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()

if(IDF_TARGET STREQUAL "esp32p4")
# TODO: IDF-7460
return()
Expand Down
6 changes: 6 additions & 0 deletions components/esp_pm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)

if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()

idf_component_register(SRCS "pm_locks.c" "pm_trace.c" "pm_impl.c"
INCLUDE_DIRS include
PRIV_REQUIRES esp_system driver esp_timer
Expand Down
4 changes: 4 additions & 0 deletions components/esp_psram/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
idf_build_get_property(target IDF_TARGET)

if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()

set(includes "include")

set(priv_requires heap spi_flash esp_mm)
Expand Down
6 changes: 6 additions & 0 deletions components/esp_ringbuf/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)

if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()

idf_component_register(SRCS "ringbuf.c"
INCLUDE_DIRS "include"
LDFRAGMENTS linker.lf)
6 changes: 6 additions & 0 deletions components/esp_timer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
idf_build_get_property(target IDF_TARGET)

if(${target} STREQUAL "linux")
idf_component_register(INCLUDE_DIRS include)
else()

set(srcs "src/esp_timer.c"
"src/ets_timer_legacy.c"
"src/system_time.c"
Expand All @@ -20,3 +24,5 @@ idf_component_register(SRCS "${srcs}"
PRIV_INCLUDE_DIRS private_include
REQUIRES esp_common
PRIV_REQUIRES soc driver)

endif()
7 changes: 6 additions & 1 deletion components/esp_wifi/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
idf_build_get_property(idf_target IDF_TARGET)

if(${idf_target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()

if(CONFIG_ESP_WIFI_ENABLED)
idf_build_get_property(idf_target IDF_TARGET)

if(CONFIG_APP_NO_BLOBS)
set(link_binary_libs 0)
Expand Down
8 changes: 7 additions & 1 deletion components/espcoredump/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
set(srcs "src/core_dump_common.c"
idf_build_get_property(target IDF_TARGET)

if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()

set(srcs "src/core_dump_common.c"
"src/core_dump_checksum.c"
"src/core_dump_flash.c"
"src/core_dump_uart.c"
Expand Down
6 changes: 6 additions & 0 deletions components/esptool_py/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)

if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()

idf_component_register(REQUIRES bootloader PRIV_REQUIRES partition_table)

if(NOT BOOTLOADER_BUILD)
Expand Down
4 changes: 4 additions & 0 deletions components/idf_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
idf_build_get_property(target IDF_TARGET)

if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()

idf_component_register(INCLUDE_DIRS "include" "include/${target}")
6 changes: 5 additions & 1 deletion components/ieee802154/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
idf_build_get_property(idf_target IDF_TARGET)
idf_build_get_property(target IDF_TARGET)

if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()

set(srcs "")
set(include "include")
Expand Down
6 changes: 6 additions & 0 deletions components/newlib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)

if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()

if(BOOTLOADER_BUILD)
# Bootloader builds need the platform_include directory (for assert.h), but nothing else
idf_component_register(INCLUDE_DIRS platform_include)
Expand Down
6 changes: 6 additions & 0 deletions components/nvs_sec_provider/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)

if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()

idf_component_register(SRCS "nvs_sec_provider.c"
INCLUDE_DIRS include
PRIV_REQUIRES bootloader_support efuse esp_partition nvs_flash)
Expand Down
8 changes: 7 additions & 1 deletion components/openthread/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
idf_build_get_property(idf_target IDF_TARGET)

if(${idf_target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()

if(CONFIG_OPENTHREAD_ENABLED OR CONFIG_IDF_DOC_BUILD)

set(public_include_dirs
"include"
"openthread/include")
endif()

if(CONFIG_OPENTHREAD_ENABLED)
idf_build_get_property(idf_target IDF_TARGET)

set(private_include_dirs
"openthread/examples/platforms"
Expand Down
6 changes: 6 additions & 0 deletions components/perfmon/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)

if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()

idf_build_get_property(arch IDF_TARGET_ARCH)

if(NOT "${arch}" STREQUAL "xtensa")
Expand Down
6 changes: 6 additions & 0 deletions components/protocomm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
idf_build_get_property(target IDF_TARGET)

if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()

set(include_dirs include/common
include/security
include/transports)
Expand Down
Loading

0 comments on commit 548022f

Please sign in to comment.