@@ -5,7 +5,7 @@ use std::path::Path;
55use super :: path:: { Dirs , RelPath } ;
66use super :: prepare:: GitRepo ;
77use super :: rustc_info:: { get_file_name, get_wrapper_file_name} ;
8- use super :: utils:: { hyperfine_command, is_ci, spawn_and_wait, CargoProject } ;
8+ use super :: utils:: { hyperfine_command, is_ci, spawn_and_wait, CargoProject , Compiler } ;
99
1010pub ( crate ) static SIMPLE_RAYTRACER_REPO : GitRepo = GitRepo :: github (
1111 "ebobby" ,
@@ -14,6 +14,10 @@ pub(crate) static SIMPLE_RAYTRACER_REPO: GitRepo = GitRepo::github(
1414 "<none>" ,
1515) ;
1616
17+ // Use a separate target dir for the initial LLVM build to reduce unnecessary recompiles
18+ pub ( crate ) static SIMPLE_RAYTRACER_LLVM : CargoProject =
19+ CargoProject :: new ( & SIMPLE_RAYTRACER_REPO . source_dir ( ) , "simple_raytracer_llvm" ) ;
20+
1721pub ( crate ) static SIMPLE_RAYTRACER : CargoProject =
1822 CargoProject :: new ( & SIMPLE_RAYTRACER_REPO . source_dir ( ) , "simple_raytracer" ) ;
1923
@@ -28,6 +32,20 @@ fn benchmark_simple_raytracer(dirs: &Dirs) {
2832 std:: process:: exit ( 1 ) ;
2933 }
3034
35+ eprintln ! ( "[LLVM BUILD] simple-raytracer" ) ;
36+ let host_compiler = Compiler :: host ( ) ;
37+ let build_cmd = SIMPLE_RAYTRACER_LLVM . build ( & host_compiler, dirs) ;
38+ spawn_and_wait ( build_cmd) ;
39+ fs:: copy (
40+ SIMPLE_RAYTRACER_LLVM
41+ . target_dir ( dirs)
42+ . join ( & host_compiler. triple )
43+ . join ( "debug" )
44+ . join ( get_file_name ( "main" , "bin" ) ) ,
45+ RelPath :: BUILD . to_path ( dirs) . join ( get_file_name ( "raytracer_cg_llvm" , "bin" ) ) ,
46+ )
47+ . unwrap ( ) ;
48+
3149 let run_runs = env:: var ( "RUN_RUNS" )
3250 . unwrap_or ( if is_ci ( ) { "2" } else { "10" } . to_string ( ) )
3351 . parse ( )
0 commit comments