Skip to content

Commit 2d78746

Browse files
Inform cargo to rerun on source changes
1 parent b58f4b1 commit 2d78746

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

build.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ fn main() {
5050
&objcopy,
5151
&cargo,
5252
);
53+
54+
// Inform cargo that we should rerun this on linker script changes
55+
println!("cargo:rerun-if-changed=linker.ld");
5356
}
5457

5558
fn build_subproject(
@@ -126,4 +129,10 @@ fn build_subproject(
126129
// Staticlibs can't be used as normal dependencies, they have to be linked by a build script
127130
println!("cargo:rustc-link-search=native={}", &binary_dir.display());
128131
println!("cargo:rustc-link-lib=static={}", &subproject_name);
132+
133+
// Inform cargo to rerun on source changes
134+
//
135+
// Cargo doesn't understand that the subcrates are part of the project because of how we build them, we have to tell it ourselves
136+
println!("cargo:rerun-if-changed={}", &target_file_path);
137+
println!("cargo:rerun-if-changed={}", &subproject_dir.display());
129138
}

0 commit comments

Comments
 (0)