@@ -214,37 +214,39 @@ function get_compiler_cmd(; cplusplus::Bool=false)
214214 if cc != = nothing
215215 compiler_cmd = Cmd (Base. shell_split (cc))
216216 path = nothing
217- elseif ! Sys. iswindows ()
218- compilers_cpp = (" g++" , " clang++" )
219- compilers_c = (" gcc" , " clang" )
220- found_compiler = false
221- if cplusplus
222- for compiler in compilers_cpp
223- if Sys. which (compiler) != = nothing
224- compiler_cmd = ` $compiler `
225- found_compiler = true
226- break
217+ else
218+ @static if Sys. iswindows ()
219+ path = joinpath (LazyArtifacts. artifact " mingw-w64" , " extracted_files" , (Int== Int64 ? " mingw64" : " mingw32" ), " bin" , cplusplus ? " g++.exe" : " gcc.exe" )
220+ compiler_cmd = ` $path `
221+ else
222+ compilers_cpp = (" g++" , " clang++" )
223+ compilers_c = (" gcc" , " clang" )
224+ found_compiler = false
225+ if cplusplus
226+ for compiler in compilers_cpp
227+ if Sys. which (compiler) != = nothing
228+ compiler_cmd = ` $compiler `
229+ found_compiler = true
230+ break
231+ end
227232 end
228233 end
229- end
230- if ! found_compiler
231- for compiler in compilers_c
232- if Sys. which (compiler) != = nothing
233- compiler_cmd = ` $compiler `
234- found_compiler = true
235- if cplusplus && ! WARNED_CPP_COMPILER[]
236- @warn " could not find a c++ compiler (g++ or clang++), falling back to $compiler , this might cause link errors"
237- WARNED_CPP_COMPILER[] = true
234+ if ! found_compiler
235+ for compiler in compilers_c
236+ if Sys. which (compiler) != = nothing
237+ compiler_cmd = ` $compiler `
238+ found_compiler = true
239+ if cplusplus && ! WARNED_CPP_COMPILER[]
240+ @warn " could not find a c++ compiler (g++ or clang++), falling back to $compiler , this might cause link errors"
241+ WARNED_CPP_COMPILER[] = true
242+ end
243+ break
238244 end
239- break
240245 end
241246 end
247+ found_compiler || error (" could not find a compiler, looked for " ,
248+ join (((cplusplus ? compilers_cpp : ()). .. , compilers_c... ), " , " , " and " ))
242249 end
243- found_compiler || error (" could not find a compiler, looked for " ,
244- join (((cplusplus ? compilers_cpp : ()). .. , compilers_c... ), " , " , " and " ))
245- else
246- path = joinpath (LazyArtifacts. artifact " mingw-w64" , " extracted_files" , (Int== Int64 ? " mingw64" : " mingw32" ), " bin" , cplusplus ? " g++.exe" : " gcc.exe" )
247- compiler_cmd = ` $path `
248250 end
249251 if path != = nothing
250252 compiler_cmd = addenv (compiler_cmd, " PATH" => string (ENV [" PATH" ], " ;" , dirname (path)))
0 commit comments