CMakeLists.txt 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. idf_build_get_property(target IDF_TARGET)
  2. if(BOOTLOADER_BUILD)
  3. # For bootloader, all we need from esp_common is headers
  4. idf_component_register(INCLUDE_DIRS include)
  5. set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-Wl,--gc-sections")
  6. else()
  7. # Regular app build
  8. set(srcs "src/brownout.c"
  9. "src/esp_err.c"
  10. "src/dbg_stubs.c"
  11. "src/esp_err_to_name.c"
  12. "src/freertos_hooks.c"
  13. "src/mac_addr.c"
  14. "src/pm_locks.c"
  15. "src/stack_check.c"
  16. "src/task_wdt.c"
  17. "src/int_wdt.c")
  18. # Note: esp_ipc added as a public requirement to keep compatibility as to be located here.
  19. idf_component_register(SRCS "${srcs}"
  20. INCLUDE_DIRS include
  21. REQUIRES ${target} espcoredump esp_timer esp_ipc
  22. PRIV_REQUIRES soc
  23. LDFRAGMENTS "linker.lf")
  24. set_source_files_properties(
  25. "src/stack_check.c"
  26. PROPERTIES COMPILE_FLAGS
  27. -fno-stack-protector)
  28. set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY LINK_LIBRARIES "-Wl,--gc-sections")
  29. set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-Wl,--gc-sections")
  30. set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY LINK_INTERFACE_MULTIPLICITY 4)
  31. # List of components needed for the error codes list
  32. set(optional_reqs ulp
  33. efuse
  34. esp_http_client
  35. esp_http_server
  36. bootloader_support
  37. nvs_flash
  38. esp_wifi
  39. app_update
  40. lwip
  41. spi_flash
  42. wpa_supplicant
  43. tcpip_adapter)
  44. idf_build_get_property(build_components BUILD_COMPONENTS)
  45. foreach(req ${optional_reqs})
  46. if(req IN_LIST build_components)
  47. idf_component_get_property(req_lib ${req} COMPONENT_LIB)
  48. target_link_libraries(${COMPONENT_LIB} PRIVATE ${req_lib})
  49. endif()
  50. endforeach()
  51. endif()