From e2c86567acf8e45ad369498f433debe418c55a2b Mon Sep 17 00:00:00 2001 From: Marius Vikhammer Date: Mon, 6 Jul 2026 13:36:34 +0800 Subject: [PATCH] fix: preserve Linux component header registration Keep Linux components include-only when their runtime dependencies are unavailable. Co-authored-by: Cursor --- components/esp_driver_ana_cmpr/CMakeLists.txt | 16 ++++++++----- components/esp_driver_cam/CMakeLists.txt | 19 ++++++++------- components/esp_driver_cordic/CMakeLists.txt | 13 ++++++----- components/esp_driver_isp/CMakeLists.txt | 12 ++++------ components/esp_driver_jpeg/CMakeLists.txt | 13 ++++++----- components/esp_driver_mcpwm/CMakeLists.txt | 13 ++++++----- components/esp_driver_parlio/CMakeLists.txt | 14 ++++++----- components/esp_driver_pcnt/CMakeLists.txt | 13 ++++++----- components/esp_driver_ppa/CMakeLists.txt | 14 ++++++----- components/esp_driver_sdio/CMakeLists.txt | 14 ++++++----- components/esp_driver_tsens/CMakeLists.txt | 15 +++++++----- components/esp_hal_gpspi/CMakeLists.txt | 23 +++++++++++-------- 12 files changed, 98 insertions(+), 81 deletions(-) diff --git a/components/esp_driver_ana_cmpr/CMakeLists.txt b/components/esp_driver_ana_cmpr/CMakeLists.txt index df5fd84da91..497d646786a 100644 --- a/components/esp_driver_ana_cmpr/CMakeLists.txt +++ b/components/esp_driver_ana_cmpr/CMakeLists.txt @@ -1,9 +1,5 @@ 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) # Analog comparator related source files @@ -14,9 +10,17 @@ if(CONFIG_SOC_ANA_CMPR_SUPPORTED) endif() endif() +if(${target} STREQUAL "linux") + set(priv_requires "") + set(requires "") +else() + set(priv_requires esp_pm esp_driver_gpio) + set(requires esp_hal_ana_cmpr) +endif() + idf_component_register(SRCS ${srcs} INCLUDE_DIRS "include" - PRIV_REQUIRES esp_pm esp_driver_gpio - REQUIRES esp_hal_ana_cmpr + PRIV_REQUIRES "${priv_requires}" + REQUIRES "${requires}" LDFRAGMENTS "linker.lf" ) diff --git a/components/esp_driver_cam/CMakeLists.txt b/components/esp_driver_cam/CMakeLists.txt index 4b2580697c9..9b32728ac9f 100644 --- a/components/esp_driver_cam/CMakeLists.txt +++ b/components/esp_driver_cam/CMakeLists.txt @@ -1,16 +1,17 @@ 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 "esp_cam_ctlr.c" "dvp_share_ctrl.c") +set(srcs) set(includes "include" "interface") -set(requires "esp_driver_isp" "esp_hal_cam") - -set(priv_requires "esp_driver_gpio" "esp_driver_dma") +if(${target} STREQUAL "linux") + set(requires "esp_driver_isp") + set(priv_requires "") +else() + list(APPEND srcs "esp_cam_ctlr.c" "dvp_share_ctrl.c") + set(requires "esp_driver_isp" "esp_hal_cam" "esp_mm") + set(priv_requires "esp_driver_gpio" "esp_driver_dma") +endif() if(CONFIG_SOC_MIPI_CSI_SUPPORTED) list(APPEND srcs "csi/src/esp_cam_ctlr_csi.c") @@ -22,8 +23,6 @@ if(CONFIG_SOC_ISP_DVP_SUPPORTED) list(APPEND includes "isp_dvp/include") endif() -list(APPEND requires esp_mm) - if(CONFIG_SOC_LCDCAM_CAM_SUPPORTED) list(APPEND srcs "dvp/src/esp_cam_ctlr_dvp_gdma.c" "dvp/src/esp_cam_ctlr_dvp_cam.c") list(APPEND includes "dvp/include") diff --git a/components/esp_driver_cordic/CMakeLists.txt b/components/esp_driver_cordic/CMakeLists.txt index 0c4f94b7e81..920f519042e 100644 --- a/components/esp_driver_cordic/CMakeLists.txt +++ b/components/esp_driver_cordic/CMakeLists.txt @@ -1,14 +1,15 @@ 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(public_include "include") -set(requires esp_hal_cordic) -set(priv_requires esp_pm) +if(${target} STREQUAL "linux") + set(requires "") + set(priv_requires "") +else() + set(requires esp_hal_cordic) + set(priv_requires esp_pm) +endif() if(CONFIG_SOC_CORDIC_SUPPORTED) list(APPEND srcs diff --git a/components/esp_driver_isp/CMakeLists.txt b/components/esp_driver_isp/CMakeLists.txt index 7a1bc026f9b..de3a6990493 100644 --- a/components/esp_driver_isp/CMakeLists.txt +++ b/components/esp_driver_isp/CMakeLists.txt @@ -1,16 +1,16 @@ 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(public_include "include") set(priv_requires "esp_driver_gpio") -set(requires "esp_hal_cam") +if(${target} STREQUAL "linux") + set(requires "") +else() + set(requires "esp_hal_cam" "esp_mm") +endif() if(CONFIG_SOC_ISP_SUPPORTED) list(APPEND srcs "src/isp_core.c" @@ -54,8 +54,6 @@ if(CONFIG_SOC_ISP_CROP_SUPPORTED) list(APPEND srcs "src/isp_crop.c") endif() -list(APPEND requires esp_mm) - idf_component_register(SRCS ${srcs} INCLUDE_DIRS ${public_include} REQUIRES ${requires} diff --git a/components/esp_driver_jpeg/CMakeLists.txt b/components/esp_driver_jpeg/CMakeLists.txt index 23c6b748eda..49740cb8466 100644 --- a/components/esp_driver_jpeg/CMakeLists.txt +++ b/components/esp_driver_jpeg/CMakeLists.txt @@ -1,9 +1,5 @@ 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(public_include "include") @@ -27,8 +23,13 @@ if(CONFIG_SOC_JPEG_CODEC_SUPPORTED) endif() endif() -set(requires esp_hal_jpeg) -set(priv_requires esp_mm esp_pm esp_psram esp_driver_dma) +if(${target} STREQUAL "linux") + set(requires "") + set(priv_requires "") +else() + set(requires esp_hal_jpeg) + set(priv_requires esp_mm esp_pm esp_psram esp_driver_dma) +endif() idf_component_register(SRCS ${srcs} INCLUDE_DIRS ${public_include} diff --git a/components/esp_driver_mcpwm/CMakeLists.txt b/components/esp_driver_mcpwm/CMakeLists.txt index 3c3981ffade..90a92965a20 100644 --- a/components/esp_driver_mcpwm/CMakeLists.txt +++ b/components/esp_driver_mcpwm/CMakeLists.txt @@ -1,9 +1,5 @@ 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(public_include "include") if(CONFIG_SOC_MCPWM_SUPPORTED) @@ -23,8 +19,13 @@ if(CONFIG_SOC_MCPWM_SUPPORTED) endif() endif() -set(requires esp_hal_mcpwm) -set(priv_requires esp_pm esp_driver_gpio) +if(${target} STREQUAL "linux") + set(requires "") + set(priv_requires "") +else() + set(requires esp_hal_mcpwm) + set(priv_requires esp_pm esp_driver_gpio) +endif() idf_component_register(SRCS ${srcs} INCLUDE_DIRS ${public_include} diff --git a/components/esp_driver_parlio/CMakeLists.txt b/components/esp_driver_parlio/CMakeLists.txt index 2d9c29e57f7..92898912e0d 100644 --- a/components/esp_driver_parlio/CMakeLists.txt +++ b/components/esp_driver_parlio/CMakeLists.txt @@ -1,9 +1,5 @@ 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(public_include "include") if(CONFIG_SOC_PARLIO_SUPPORTED) @@ -21,12 +17,18 @@ if(CONFIG_SOC_PARLIO_SUPPORTED) endif() -set(priv_requires esp_pm esp_driver_gpio esp_mm esp_driver_bitscrambler esp_driver_dma) +if(${target} STREQUAL "linux") + set(requires "") + set(priv_requires "") +else() + set(requires esp_hal_parlio) + set(priv_requires esp_pm esp_driver_gpio esp_mm esp_driver_bitscrambler esp_driver_dma) +endif() idf_component_register(SRCS ${srcs} INCLUDE_DIRS ${public_include} PRIV_INCLUDE_DIRS "src" PRIV_REQUIRES "${priv_requires}" - REQUIRES esp_hal_parlio + REQUIRES "${requires}" LDFRAGMENTS "linker.lf" ) diff --git a/components/esp_driver_pcnt/CMakeLists.txt b/components/esp_driver_pcnt/CMakeLists.txt index 63f83727a6a..b8b66e2b06f 100644 --- a/components/esp_driver_pcnt/CMakeLists.txt +++ b/components/esp_driver_pcnt/CMakeLists.txt @@ -1,17 +1,18 @@ 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(public_include "include") if(CONFIG_SOC_PCNT_SUPPORTED) list(APPEND srcs "src/pulse_cnt.c") endif() -set(requires esp_hal_pcnt) -set(priv_requires esp_pm esp_driver_gpio) +if(${target} STREQUAL "linux") + set(requires "") + set(priv_requires "") +else() + set(requires esp_hal_pcnt) + set(priv_requires esp_pm esp_driver_gpio) +endif() idf_component_register(SRCS ${srcs} INCLUDE_DIRS ${public_include} diff --git a/components/esp_driver_ppa/CMakeLists.txt b/components/esp_driver_ppa/CMakeLists.txt index 8b3ee5dc6f1..c67bb788b28 100644 --- a/components/esp_driver_ppa/CMakeLists.txt +++ b/components/esp_driver_ppa/CMakeLists.txt @@ -1,9 +1,5 @@ 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(public_include "include") if(CONFIG_SOC_PPA_SUPPORTED) @@ -16,12 +12,18 @@ if(CONFIG_SOC_PPA_SUPPORTED) endif() endif() -set(priv_requires esp_mm esp_pm esp_driver_dma efuse) +if(${target} STREQUAL "linux") + set(requires "") + set(priv_requires "") +else() + set(requires esp_hal_ppa) + set(priv_requires esp_mm esp_pm esp_driver_dma efuse) +endif() idf_component_register(SRCS ${srcs} INCLUDE_DIRS ${public_include} PRIV_INCLUDE_DIRS "src" - REQUIRES esp_hal_ppa + REQUIRES "${requires}" PRIV_REQUIRES "${priv_requires}" ) diff --git a/components/esp_driver_sdio/CMakeLists.txt b/components/esp_driver_sdio/CMakeLists.txt index 3be90e40f86..db5fb1b6489 100644 --- a/components/esp_driver_sdio/CMakeLists.txt +++ b/components/esp_driver_sdio/CMakeLists.txt @@ -1,9 +1,5 @@ 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(public_include "include") @@ -13,10 +9,16 @@ if(CONFIG_SOC_SDIO_SLAVE_SUPPORTED) list(APPEND srcs "src/sdio_slave.c") endif() -set(priv_requires esp_driver_gpio esp_ringbuf) +if(${target} STREQUAL "linux") + set(requires "") + set(priv_requires esp_ringbuf) +else() + set(requires esp_hal_sd) + set(priv_requires esp_driver_gpio esp_ringbuf) +endif() idf_component_register(SRCS ${srcs} INCLUDE_DIRS ${public_include} - REQUIRES esp_hal_sd + REQUIRES "${requires}" PRIV_REQUIRES "${priv_requires}" ) diff --git a/components/esp_driver_tsens/CMakeLists.txt b/components/esp_driver_tsens/CMakeLists.txt index 4d0dc8b94db..bb95e90f3b2 100644 --- a/components/esp_driver_tsens/CMakeLists.txt +++ b/components/esp_driver_tsens/CMakeLists.txt @@ -1,11 +1,6 @@ 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(priv_req efuse) set(public_include "include") if(CONFIG_SOC_TEMP_SENSOR_SUPPORTED) list(APPEND srcs "src/temperature_sensor.c") @@ -18,9 +13,17 @@ if(CONFIG_SOC_TEMP_SENSOR_SUPPORTED) endif() endif() +if(${target} STREQUAL "linux") + set(requires "") + set(priv_req "") +else() + set(requires esp_hal_ana_conv) + set(priv_req efuse) +endif() + idf_component_register(SRCS ${srcs} INCLUDE_DIRS ${public_include} PRIV_INCLUDE_DIRS "src" - REQUIRES esp_hal_ana_conv + REQUIRES "${requires}" PRIV_REQUIRES ${priv_req} ) diff --git a/components/esp_hal_gpspi/CMakeLists.txt b/components/esp_hal_gpspi/CMakeLists.txt index c2a25aacd24..33c8810b867 100644 --- a/components/esp_hal_gpspi/CMakeLists.txt +++ b/components/esp_hal_gpspi/CMakeLists.txt @@ -1,9 +1,5 @@ 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(includes "include") @@ -25,9 +21,16 @@ if(CONFIG_SOC_GPSPI_SUPPORTED) endif() endif() -idf_component_register( - SRCS ${srcs} - INCLUDE_DIRS ${includes} - REQUIRES soc hal esp_hal_dma - PRIV_REQUIRES esp_hal_gpio -) +if(${target} STREQUAL "linux") + idf_component_register( + INCLUDE_DIRS ${includes} + REQUIRES soc hal + ) +else() + idf_component_register( + SRCS ${srcs} + INCLUDE_DIRS ${includes} + REQUIRES soc hal esp_hal_dma + PRIV_REQUIRES esp_hal_gpio + ) +endif()