File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -21,11 +21,16 @@ pub fn main_inner(profile: Profile) {
21
21
let tempdir = TempDir :: new ( ) . expect ( "temp dir" ) ;
22
22
let current_dir = current_dir ( ) . expect ( "current dir" ) ;
23
23
let current_dir = current_dir. to_str ( ) . expect ( "current dir" ) . to_string ( ) ;
24
- let gcc_path = Toml :: parse ( include_str ! ( "../config.toml" ) )
25
- . expect ( "Failed to parse `config.toml`" )
26
- . get_string ( "gcc-path" )
27
- . expect ( "Missing `gcc-path` key in `config.toml`" )
28
- . to_string ( ) ;
24
+ let toml = Toml :: parse ( include_str ! ( "../config.toml" ) )
25
+ . expect ( "Failed to parse `config.toml`" ) ;
26
+ let gcc_path = if let Ok ( gcc_path) = toml. get_string ( "gcc-path" ) {
27
+ PathBuf :: from ( gcc_path. to_string ( ) )
28
+ } else {
29
+ // then we try to retrieve it from the `target` folder.
30
+ let commit = include_str ! ( "../libgccjit.version" ) . trim ( ) ;
31
+ Path :: new ( "target/libgccjit" ) . join ( commit)
32
+ } ;
33
+
29
34
let gcc_path = Path :: new ( & gcc_path)
30
35
. canonicalize ( )
31
36
. expect ( "failed to get absolute path of `gcc-path`" )
You can’t perform that action at this time.
0 commit comments