@@ -39,12 +39,19 @@ add_custom_command(OUTPUT ${zephyr_bindgen}
39
39
set (rust_src_dir ${CMAKE_CURRENT_SOURCE_DIR} /rust )
40
40
set (rust_sysroot ${CMAKE_CURRENT_BINARY_DIR} /sysroot )
41
41
set (rust_sysroot_build ${CMAKE_CURRENT_BINARY_DIR} /sysroot-build )
42
+ set (rust_generated_project ${CMAKE_CURRENT_BINARY_DIR} /rust-app )
42
43
set (rust_app_build ${CMAKE_CURRENT_BINARY_DIR} /app )
43
44
set (rust_staticlib ${rust_app_build} /${rust_target}/release/librust_app.a )
44
- if (NOT DEFINED CARGO_MANIFEST )
45
- set (CARGO_MANIFEST ${CMAKE_SOURCE_DIR} /Cargo.toml )
45
+ if (NOT DEFINED CARGO_SOURCE_DIR )
46
+ set (CARGO_SOURCE_DIR ${CMAKE_SOURCE_DIR} )
46
47
endif ()
47
48
49
+ add_custom_command (OUTPUT ${rust_generated_project} /Cargo.toml
50
+ COMMAND ${rust_src_dir} /genproject.sh ${CARGO_SOURCE_DIR} ${rust_generated_project}
51
+ DEPENDS ${rust_src_dir} /genproject.sh
52
+ )
53
+ add_custom_target (rust_generated_project DEPENDS ${rust_generated_project} /Cargo.toml )
54
+
48
55
zephyr_get_include_directories_for_lang_as_string ( C includes )
49
56
zephyr_get_compile_definitions_for_lang_as_string ( C definitions )
50
57
@@ -60,7 +67,7 @@ ExternalProject_Add(
60
67
SOURCE_DIR ${rust_src_dir}
61
68
BUILD_IN_SOURCE 1
62
69
BUILD_ALWAYS 1
63
- DEPENDS rust_syscall_macros_h_target zephyr_bindgen_target
70
+ DEPENDS rust_syscall_macros_h_target zephyr_bindgen_target rust_generated_project
64
71
CONFIGURE_COMMAND ""
65
72
BUILD_COMMAND
66
73
env
@@ -72,7 +79,7 @@ ExternalProject_Add(
72
79
"APP_BUILD=${rust_app_build} "
73
80
"RUST_TARGET_PATH=${rust_src_dir} "
74
81
"RUST_TARGET=${rust_target} "
75
- "CARGO_MANIFEST=${CARGO_MANIFEST} "
82
+ "CARGO_MANIFEST=${rust_generated_project} /Cargo.toml "
76
83
./build.sh
77
84
INSTALL_COMMAND ""
78
85
BUILD_BYPRODUCTS ${rust_staticlib}
0 commit comments