Skip to content

Commit e4232d7

Browse files
author
Avik Pal
committed
Support builds for Mac and few other systems
1 parent 94d1e00 commit e4232d7

File tree

2 files changed

+23
-18
lines changed

2 files changed

+23
-18
lines changed

deps/build.jl

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,38 @@ using BinaryProvider
44
const verbose = "--verbose" in ARGS
55
const prefix = Prefix(get([a for a in ARGS if a != "--verbose"], 1, joinpath(@__DIR__, "usr")))
66
products = [
7-
LibraryProduct(prefix, "libnnpack", :libnnpack)
7+
LibraryProduct(prefix, ["libnnpack"], :libnnpack),
88
]
99

1010
# Download binaries from hosted location
11-
bin_prefix = "https://github.com/avik-pal/NNPACKBuilder/releases/download/v0.1"
11+
bin_prefix = "https://github.com/JuliaPackaging/Yggdrasil/releases/download/NNPACK-v2018.06.22-0"
1212

1313
# Listing of files generated by BinaryBuilder:
1414
download_info = Dict(
15-
Linux(:aarch64, :glibc) => ("$bin_prefix/NNPACK.v2018.6.22.aarch64-linux-gnu.tar.gz", "27037ad8384dc8d9dff79c6dae9d852f8b4aa60dcc84fb605f1856042d125e63"),
16-
Linux(:i686, :glibc) => ("$bin_prefix/NNPACK.v2018.6.22.i686-linux-gnu.tar.gz", "383264bbba19980a097662e4f3364e97ec6ab7e7e792663f8192595cf86a0ebe"),
17-
Linux(:x86_64, :glibc) => ("$bin_prefix/NNPACK.v2018.6.22.x86_64-linux-gnu.tar.gz", "fe1870a89b8d80ffd37d20681c22cdb9b86f18b4539127455d9025a0e6720bba"),
15+
Linux(:aarch64, libc=:glibc) => ("$bin_prefix/NNPACK.v2018.6.22.aarch64-linux-gnu.tar.gz", "e0c6e21ba4c47acfd5a3d3e3510e8786474080f654338f4583b88860296c1437"),
16+
Linux(:i686, libc=:glibc) => ("$bin_prefix/NNPACK.v2018.6.22.i686-linux-gnu.tar.gz", "e9b6685001bc5a5d17acef15f3f6ffeb7beb6081926300f23ed4a442beac71ca"),
17+
Linux(:i686, libc=:musl) => ("$bin_prefix/NNPACK.v2018.6.22.i686-linux-musl.tar.gz", "36c1d3c30b3bc3e0b34f215945bb46319f88e28f011fc758f21ba888b1fd9e25"),
18+
MacOS(:x86_64) => ("$bin_prefix/NNPACK.v2018.6.22.x86_64-apple-darwin14.tar.gz", "b30046223a11470b15a2ceb0d0df6f7d8a43260fe52f4a2f8ebe5f0b2df822ca"),
19+
Linux(:x86_64, libc=:glibc) => ("$bin_prefix/NNPACK.v2018.6.22.x86_64-linux-gnu.tar.gz", "150d5b6ca81fa72bfdc8bbda2428f0d3483fd11a5813724646c6d6c6a7ef969f"),
20+
Linux(:x86_64, libc=:musl) => ("$bin_prefix/NNPACK.v2018.6.22.x86_64-linux-musl.tar.gz", "d961a104f814ec5b356519a82746a70a1df193ae37fc8130f38ffb61336def16"),
1821
)
1922

2023
# Install unsatisfied or updated dependencies:
2124
unsatisfied = any(!satisfied(p; verbose=verbose) for p in products)
22-
if haskey(download_info, platform_key())
23-
url, tarball_hash = download_info[platform_key()]
24-
if unsatisfied || !isinstalled(url, tarball_hash; prefix=prefix)
25-
# Download and install binaries
26-
install(url, tarball_hash; prefix=prefix, force=true, verbose=verbose)
27-
end
28-
29-
# Write out a deps.jl file that will contain mappings for our products
30-
write_deps_file(joinpath(@__DIR__, "deps.jl"), products)
31-
elseif unsatisfied
32-
# If we don't have a BinaryProvider-compatible .tar.gz to download, complain.
25+
dl_info = choose_download(download_info, platform_key_abi())
26+
if dl_info === nothing && unsatisfied
27+
# If we don't have a compatible .tar.gz to download, complain.
3328
# Alternatively, you could attempt to install from a separate provider,
3429
# build from source or something even more ambitious here.
35-
@warn "Your platform $(triplet(platform_key())) is not supported by this NNPACK. So building NNlib without NNPACK"
30+
error("Your platform (\"$(Sys.MACHINE)\", parsed as \"$(triplet(platform_key_abi()))\") is not supported by this package!")
31+
end
32+
33+
# If we have a download, and we are unsatisfied (or the version we're
34+
# trying to install is not itself installed) then load it up!
35+
if unsatisfied || !isinstalled(dl_info...; prefix=prefix)
36+
# Download and install binaries
37+
install(dl_info...; prefix=prefix, force=true, verbose=verbose)
3638
end
39+
40+
# Write out a deps.jl file that will contain mappings for our products
41+
write_deps_file(joinpath(@__DIR__, "deps.jl"), products, verbose=verbose)

src/NNlib.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const to = TimerOutput()
88
include("dim_helpers.jl")
99

1010
# NNPACK support
11-
if Sys.islinux()
11+
if Sys.islinux() || Sys.isapple()
1212
include("nnpack/NNPACK.jl")
1313
else
1414
is_nnpack_available() = false

0 commit comments

Comments
 (0)