Skip to content

Commit

Permalink
coroutines: add macOS amd64 support, panic on wget errors (#18360)
Browse files Browse the repository at this point in the history
  • Loading branch information
walkingdevel committed Jun 6, 2023
1 parent c06fd55 commit 0810e84
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions vlib/v/pref/pref.v
Expand Up @@ -802,21 +802,22 @@ pub fn parse_args_and_show_errors(known_external_commands []string, args []strin
}
'-use-coroutines' {
res.use_coroutines = true
$if macos && arm64 {
$if macos {
arch := $if arm64 { 'arm64' } $else { 'amd64' }
vexe := vexe_path()
vroot := os.dir(vexe)
so_path := os.join_path(vroot, 'thirdparty', 'photon', 'photonwrapper.so')
so_url := 'https://github.com/vlang/photonbin/raw/master/photonwrapper_macos_arm64.so'
so_url := 'https://github.com/vlang/photonbin/raw/master/photonwrapper_macos_${arch}.so'
if !os.exists(so_path) {
println('coroutines .so not found, downloading...')
// http.download_file(so_url, so_path) or { panic(err) }
os.system('wget -O "${so_path}" "${so_url}"')
os.execute_or_panic('wget -O "${so_path}" "${so_url}"')
println('done!')
}
res.compile_defines << 'is_coroutine'
res.compile_defines_all << 'is_coroutine'
} $else {
println('coroutines only work on arm64 macos for now')
println('coroutines only work on macos for now')
}
}
else {
Expand Down

0 comments on commit 0810e84

Please sign in to comment.