rust+c的混合模式链接成功
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
idf_component_register(SRCS "my_usb_project.c"
|
||||
idf_component_register(SRCS "my_usb_project.c" "../rust_app/rust_app_wrapper.c"
|
||||
INCLUDE_DIRS "."
|
||||
PRIV_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/../rust_app")
|
||||
|
||||
target_link_libraries(${COMPONENT_LIB} INTERFACE "-L${CMAKE_CURRENT_LIST_DIR}/../rust_app/target/xtensa-esp32s3-none-elf/debug" "-lrust_app")
|
||||
set(RUST_LIB_PATH "${CMAKE_CURRENT_LIST_DIR}/../rust_app/target/xtensa-esp32s3-none-elf/debug/librust_app.a")
|
||||
message(STATUS "Rust library path: ${RUST_LIB_PATH}")
|
||||
|
||||
# 直接将 Rust 库添加到链接器命令中
|
||||
add_prebuilt_library(rust_app_lib "${RUST_LIB_PATH}" REQUIRES "")
|
||||
target_link_libraries(${COMPONENT_LIB} INTERFACE rust_app_lib)
|
||||
|
||||
Reference in New Issue
Block a user