MCPcopy Create free account
hub / github.com/Rust-GPU/rust-gpu / build_deps

Function build_deps

tests/src/main.rs:184–249  ·  view source on GitHub ↗

Runs the processes needed to build `spirv-std` & other deps.

(deps_target_dir: &Path, codegen_backend_path: &Path, target: &str)

Source from the content-addressed store, hash-verified

182
183/// Runs the processes needed to build `spirv-std` & other deps.
184fn build_deps(deps_target_dir: &Path, codegen_backend_path: &Path, target: &str) -> TestDeps {
185 // HACK(eddyb) this is only needed until we enable `resolver = "2"`, as the
186 // old ("1") resolver has a bug where it picks up extra features based on the
187 // current directory (and so we always set the working dir as a workaround).
188 let old_cargo_resolver_workaround_cwd = deps_target_dir.parent().unwrap();
189
190 // Build compiletests-deps-helper
191 std::process::Command::new("cargo")
192 .args([
193 "build",
194 "-p",
195 "compiletests-deps-helper",
196 "-Zbuild-std=core",
197 "-Zbuild-std-features=compiler-builtins-mem",
198 &*format!("--target={target}"),
199 ])
200 .arg("--target-dir")
201 .arg(deps_target_dir)
202 .env("RUSTFLAGS", rust_flags(codegen_backend_path))
203 .current_dir(old_cargo_resolver_workaround_cwd)
204 .stderr(std::process::Stdio::inherit())
205 .stdout(std::process::Stdio::inherit())
206 .status()
207 .and_then(map_status_to_result)
208 .unwrap();
209
210 let compiler_builtins = find_lib(
211 deps_target_dir,
212 "compiler_builtins",
213 DepKind::SpirvLib,
214 target,
215 )
216 .unwrap();
217 let core = find_lib(deps_target_dir, "core", DepKind::SpirvLib, target).unwrap();
218 let spirv_std = find_lib(deps_target_dir, "spirv_std", DepKind::SpirvLib, target).unwrap();
219 let glam = find_lib(deps_target_dir, "glam", DepKind::SpirvLib, target).unwrap();
220 let spirv_std_macros = find_lib(
221 deps_target_dir,
222 "spirv_std_macros",
223 DepKind::ProcMacro,
224 target,
225 )
226 .unwrap();
227
228 if [
229 &compiler_builtins,
230 &core,
231 &spirv_std,
232 &glam,
233 &spirv_std_macros,
234 ]
235 .iter()
236 .any(|o| o.is_none())
237 {
238 clean_deps(deps_target_dir);
239 build_deps(deps_target_dir, codegen_backend_path, target)
240 } else {
241 TestDeps {

Callers 1

run_modeMethod · 0.85

Calls 4

rust_flagsFunction · 0.85
find_libFunction · 0.85
clean_depsFunction · 0.85
iterMethod · 0.80

Tested by

no test coverage detected