CMakeLists.txt 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. if(CONFIG_ESP32_WIFI_ENABLED)
  2. idf_build_get_property(idf_target IDF_TARGET)
  3. if(CONFIG_ESP32_NO_BLOBS OR CONFIG_ESP32S2_NO_BLOBS)
  4. set(link_binary_libs 0)
  5. set(ldfragments)
  6. else()
  7. set(link_binary_libs 1)
  8. set(ldfragments "linker.lf")
  9. endif()
  10. if(IDF_TARGET_ESP32)
  11. # dport workaround headers are in esp32 component
  12. set(extra_priv_requires esp32)
  13. else()
  14. set(extra_priv_requires)
  15. endif()
  16. set(srcs
  17. "src/coexist.c"
  18. "src/lib_printf.c"
  19. "src/mesh_event.c"
  20. "src/smartconfig.c"
  21. "src/smartconfig_ack.c"
  22. "src/wifi_init.c"
  23. "src/wifi_default.c"
  24. "src/wifi_netif.c"
  25. "${idf_target}/esp_adapter.c")
  26. endif()
  27. idf_component_register(SRCS "${srcs}"
  28. INCLUDE_DIRS "include"
  29. REQUIRES esp_event esp_phy
  30. PRIV_REQUIRES driver esptool_py esp_netif esp_pm esp_timer nvs_flash
  31. wpa_supplicant hal ${extra_priv_requires}
  32. LDFRAGMENTS "${ldfragments}")
  33. if(CONFIG_ESP32_WIFI_ENABLED)
  34. idf_build_get_property(build_dir BUILD_DIR)
  35. set(target_name "${idf_target}")
  36. target_link_libraries(${COMPONENT_LIB} PUBLIC "-L \"${CMAKE_CURRENT_SOURCE_DIR}/lib/${target_name}\"")
  37. if(link_binary_libs)
  38. set(blobs coexist core espnow mesh net80211 pp smartconfig wapi)
  39. foreach(blob ${blobs})
  40. add_prebuilt_library(${blob} "${CMAKE_CURRENT_SOURCE_DIR}/lib/${target_name}/lib${blob}.a"
  41. REQUIRES ${COMPONENT_NAME})
  42. set(blob_reqs ${blobs})
  43. list(REMOVE_ITEM blob_reqs ${blob}) # remove itself from requirements
  44. set_property(TARGET ${blob} APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${blob_reqs})
  45. target_link_libraries(${COMPONENT_LIB} PUBLIC ${blob})
  46. endforeach()
  47. endif()
  48. endif()