@@ -5,7 +5,7 @@ use std::path::Path;
5
5
use super :: path:: { Dirs , RelPath } ;
6
6
use super :: prepare:: GitRepo ;
7
7
use 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 } ;
9
9
10
10
pub ( crate ) static SIMPLE_RAYTRACER_REPO : GitRepo = GitRepo :: github (
11
11
"ebobby" ,
@@ -14,6 +14,10 @@ pub(crate) static SIMPLE_RAYTRACER_REPO: GitRepo = GitRepo::github(
14
14
"<none>" ,
15
15
) ;
16
16
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
+
17
21
pub ( crate ) static SIMPLE_RAYTRACER : CargoProject =
18
22
CargoProject :: new ( & SIMPLE_RAYTRACER_REPO . source_dir ( ) , "simple_raytracer" ) ;
19
23
@@ -28,6 +32,20 @@ fn benchmark_simple_raytracer(dirs: &Dirs) {
28
32
std:: process:: exit ( 1 ) ;
29
33
}
30
34
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
+
31
49
let run_runs = env:: var ( "RUN_RUNS" )
32
50
. unwrap_or ( if is_ci ( ) { "2" } else { "10" } . to_string ( ) )
33
51
. parse ( )
0 commit comments