feat(modem): add idf build system v2 support

This commit is contained in:
sakchhu
2026-04-01 17:16:20 +05:45
parent 272ca63d38
commit 2e52e77f3d
2 changed files with 42 additions and 0 deletions
+5
View File
@@ -40,6 +40,11 @@ set(srcs ${platform_srcs}
"src/esp_modem_vfs_socket_creator.cpp"
"${command_dir}/src/esp_modem_modules.cpp")
if(IDF_BUILD_V2)
include(CMakeLists_v2.txt)
return()
endif()
idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS include ${command_dir}/include
PRIV_INCLUDE_DIRS private_include
+37
View File
@@ -0,0 +1,37 @@
# --- IDF Build System V2 Integration ---
# Initialize lists before use to avoid inheriting variables from
# a parent component scope (recursive evaluation in v2).
set(public_deps)
set(optional_deps)
foreach(dep IN LISTS dependencies)
idf_component_include(${dep})
list(APPEND public_deps idf::${dep})
endforeach()
add_library(${COMPONENT_TARGET} STATIC ${srcs})
target_include_directories(${COMPONENT_TARGET}
PUBLIC
include
${command_dir}/include
PRIVATE
private_include
)
target_link_libraries(${COMPONENT_TARGET} PUBLIC ${public_deps})
target_compile_features(${COMPONENT_TARGET} PUBLIC cxx_std_17)
set_target_properties(${COMPONENT_TARGET} PROPERTIES
CXX_EXTENSIONS ON
)
# Optional dependency on "main" when custom module is enabled.
# Use TARGET_EXISTS generator expression so the link is a no-op when
# "main" is not part of the build (v2 makes all Kconfig visible, so
# CONFIG_ESP_MODEM_ADD_CUSTOM_MODULE can be set even if "main" is absent).
if(CONFIG_ESP_MODEM_ADD_CUSTOM_MODULE)
idf_component_include(main)
target_link_libraries(${COMPONENT_TARGET} PUBLIC
"$<$<TARGET_EXISTS:idf::main>:idf::main>")
endif()