From 2c1208004949373d374cdcd149fad3daa06dd11d Mon Sep 17 00:00:00 2001 From: Renz Christian Bagaporo Date: Sun, 28 Apr 2019 11:27:30 +0800 Subject: [PATCH] components: correct dependency information for linking without link groups --- components/bootloader_support/CMakeLists.txt | 4 ++-- components/esp_wifi/CMakeLists.txt | 20 +++++++++++++---- components/newlib/CMakeLists.txt | 23 +------------------- components/newlib/project_include.cmake | 22 +++++++++++++++++++ components/protocomm/CMakeLists.txt | 3 ++- 5 files changed, 43 insertions(+), 29 deletions(-) create mode 100644 components/newlib/project_include.cmake diff --git a/components/bootloader_support/CMakeLists.txt b/components/bootloader_support/CMakeLists.txt index 526ad92a1..d1373be30 100644 --- a/components/bootloader_support/CMakeLists.txt +++ b/components/bootloader_support/CMakeLists.txt @@ -9,8 +9,8 @@ set(COMPONENT_SRCS "src/bootloader_clock.c" if(BOOTLOADER_BUILD) set(COMPONENT_ADD_INCLUDEDIRS "include include_bootloader") - set(COMPONENT_REQUIRES soc) #unfortunately the header directly uses SOC registers - set(COMPONENT_PRIV_REQUIRES spi_flash micro-ecc efuse) + set(COMPONENT_REQUIRES spi_flash soc) #unfortunately the header directly uses SOC registers + set(COMPONENT_PRIV_REQUIRES micro-ecc efuse) list(APPEND COMPONENT_SRCS "src/bootloader_init.c" "src/${IDF_TARGET}/bootloader_sha.c" "src/${IDF_TARGET}/flash_encrypt.c" diff --git a/components/esp_wifi/CMakeLists.txt b/components/esp_wifi/CMakeLists.txt index 218b4b644..be99e00d8 100644 --- a/components/esp_wifi/CMakeLists.txt +++ b/components/esp_wifi/CMakeLists.txt @@ -8,8 +8,8 @@ set(COMPONENT_SRCS "src/wifi_init.c") set(COMPONENT_ADD_INCLUDEDIRS "include") set(COMPONENT_PRIV_INCLUDEDIRS) -set(COMPONENT_REQUIRES) -set(COMPONENT_PRIV_REQUIRES "wpa_supplicant" "nvs_flash") +set(COMPONENT_REQUIRES wpa_supplicant smartconfig_ack) +set(COMPONENT_PRIV_REQUIRES "nvs_flash") if(NOT CONFIG_ESP32_NO_BLOBS) set(COMPONENT_ADD_LDFRAGMENTS "linker.lf") @@ -19,8 +19,20 @@ register_component() target_link_libraries(${COMPONENT_LIB} "-L ${CMAKE_CURRENT_SOURCE_DIR}/lib_${IDF_TARGET}") if(NOT CONFIG_ESP32_NO_BLOBS) - target_link_libraries(${COMPONENT_LIB} "-L ${CMAKE_CURRENT_SOURCE_DIR}/lib_${IDF_TARGET}") - target_link_libraries(${COMPONENT_LIB} coexist core espnow mesh net80211 phy pp rtc smartconfig wpa2 wpa wps) + set(blobs coexist core espnow mesh net80211 phy pp rtc smartconfig wpa2 wpa wps) + foreach(blob ${blobs}) + add_library(${blob} STATIC IMPORTED) + set_property(TARGET ${blob} PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/lib_${IDF_TARGET}/lib${blob}.a) + target_link_libraries(${COMPONENT_LIB} ${blob}) + + foreach(_blob ${blobs}) + if(NOT _blob STREQUAL ${blob}) + set_property(TARGET ${blob} APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${_blob}) + endif() + endforeach() + + set_property(TARGET ${blob} APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${COMPONENT_LIB}) + endforeach() endif() if(CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION) diff --git a/components/newlib/CMakeLists.txt b/components/newlib/CMakeLists.txt index 627f092e8..0d6491494 100644 --- a/components/newlib/CMakeLists.txt +++ b/components/newlib/CMakeLists.txt @@ -12,16 +12,7 @@ set(COMPONENT_SRCS "heap.c" "utime.c") set(COMPONENT_ADD_INCLUDEDIRS platform_include) - if(GCC_NOT_5_2_0) - if(CONFIG_NEWLIB_NANO_FORMAT) - set(LIBC c_nano) - else() - set(LIBC c) - endif() - - set(LIBM m) - if(CONFIG_SPIRAM_CACHE_WORKAROUND) set(COMPONENT_ADD_LDFRAGMENTS esp32-spiram-rom-functions-c.lf) endif() @@ -31,7 +22,6 @@ if(GCC_NOT_5_2_0) set(EXTRA_LINK_FLAGS "-u newlib_include_locks_impl") list(APPEND EXTRA_LINK_FLAGS "-u newlib_include_heap_impl") list(APPEND EXTRA_LINK_FLAGS "-u newlib_include_syscalls_impl") - else() # Remove this section when GCC 5.2.0 is no longer supported # 'include' and 'lib' directories should also be removed. @@ -40,21 +30,10 @@ else() set(LIB_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib) if(CONFIG_SPIRAM_CACHE_WORKAROUND) - set(LIBC c-psram-workaround) - set(LIBM m-psram-workaround) - set(COMPONENT_ADD_LDFRAGMENTS esp32-spiram-rom-functions-psram-workaround.lf) - else() - - if(CONFIG_NEWLIB_NANO_FORMAT) - set(LIBC c_nano) - else() - set(LIBC c) - endif() - - set(LIBM m) endif() endif() + set(COMPONENT_REQUIRES vfs) # for sys/ioctl.h set(COMPONENT_PRIV_REQUIRES soc) diff --git a/components/newlib/project_include.cmake b/components/newlib/project_include.cmake new file mode 100644 index 000000000..367794a1d --- /dev/null +++ b/components/newlib/project_include.cmake @@ -0,0 +1,22 @@ +if(GCC_NOT_5_2_0) + if(CONFIG_NEWLIB_NANO_FORMAT) + set(LIBC c_nano) + else() + set(LIBC c) + endif() + + set(LIBM m) +else() + if(CONFIG_SPIRAM_CACHE_WORKAROUND) + set(LIBC c-psram-workaround) + set(LIBM m-psram-workaround) + else() + if(CONFIG_NEWLIB_NANO_FORMAT) + set(LIBC c_nano) + else() + set(LIBC c) + endif() + + set(LIBM m) + endif() +endif() \ No newline at end of file diff --git a/components/protocomm/CMakeLists.txt b/components/protocomm/CMakeLists.txt index 9f9343815..79e824ceb 100644 --- a/components/protocomm/CMakeLists.txt +++ b/components/protocomm/CMakeLists.txt @@ -12,7 +12,8 @@ set(COMPONENT_SRCS "src/common/protocomm.c" "src/transports/protocomm_console.c" "src/transports/protocomm_httpd.c") -set(COMPONENT_PRIV_REQUIRES protobuf-c mbedtls console esp_http_server bt) +set(COMPONENT_REQUIRES protobuf-c bt) +set(COMPONENT_PRIV_REQUIRES mbedtls console esp_http_server) if(CONFIG_BT_ENABLED) if(CONFIG_BT_BLUEDROID_ENABLED)