-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
44 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,8 @@ | |
*.jl.*.cov | ||
*.jl.mem | ||
*.dll | ||
*.dylib | ||
*.o | ||
*.so | ||
deps/deps.jl | ||
deps/usr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
julia 0.6 | ||
GeometryTypes | ||
@windows WinRPM | ||
BinaryProvider |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,39 @@ | ||
if is_windows() | ||
using WinRPM | ||
end | ||
using BinaryProvider | ||
|
||
function find_gpp() | ||
if is_windows() | ||
#TODO, is this really the hardcoded way to get the WinRPM path to g++ ? | ||
gpp = Pkg.dir("WinRPM","deps","usr","x86_64-w64-mingw32","sys-root","mingw","bin","g++") | ||
if !isfile(gpp*".exe") | ||
info("g++ not found. installing gcc-c++ using WinRPM") | ||
WinRPM.install("gcc-c++", yes = true) | ||
WinRPM.install("gcc", yes = true) | ||
WinRPM.install("headers", yes = true) | ||
end | ||
RPMbindir = Pkg.dir("WinRPM","deps","usr","x86_64-w64-mingw32","sys-root","mingw","bin") | ||
incdir = Pkg.dir("WinRPM","deps","usr","x86_64-w64-mingw32","sys-root","mingw","include") | ||
push!(Base.Libdl.DL_LOAD_PATH, RPMbindir) # TODO does this need to be reversed? | ||
ENV["PATH"] = ENV["PATH"] * ";" * RPMbindir; | ||
return gpp, incdir | ||
end | ||
if is_unix() | ||
if success(`g++ --version`) | ||
return "g++", "" | ||
else | ||
error("no g++ found. Please install a version > 4.5") | ||
end | ||
end | ||
end | ||
# This is where all binaries will get installed | ||
const prefix = Prefix(joinpath(@__DIR__, "usr")) | ||
|
||
# generate wrapper code | ||
include("generate_code.jl") | ||
path = dirname(@__FILE__) | ||
libo = joinpath(path, "build", "earcut.o") | ||
# there are some platforms which behave weird when removing files. | ||
# since it doesn't need to be removed, we can allow it to fail | ||
save_rm(file) = try | ||
rm(file) | ||
catch e | ||
warn(e) | ||
end | ||
# Instantiate products here. Examples: | ||
earcut = LibraryProduct(prefix, "earcut") | ||
# foo_executable = ExecutableProduct(prefix, "fooifier") | ||
# libfoo_pc = FileProduct(joinpath(libdir(prefix), "pkgconfig", "libfoo.pc")) | ||
|
||
# Assign products to `products`: | ||
products = [earcut] | ||
|
||
cd(path) do | ||
gpp, incdir = find_gpp() | ||
base = joinpath(path, "build") | ||
isdir(base) || mkdir(base) | ||
libo = joinpath(base, "earcut.o") | ||
isfile(libo) && save_rm(libo) | ||
run(`$gpp -c -fPIC -std=c++11 cwrapper.cpp -o $libo -I $incdir`) | ||
lib = joinpath(base, "earcut.$(Libdl.dlext)") | ||
isfile(lib) && save_rm(lib) | ||
run(`$gpp -shared -o $lib $libo`) | ||
info("Compiled EarCut successfully!") | ||
|
||
# Download binaries from hosted location | ||
bin_prefix = "https://github.com/SimonDanisch/EarCutDeps/releases/download/v0.1.4" | ||
# Listing of files generated by BinaryBuilder: | ||
# Listing of files generated by BinaryBuilder: | ||
download_info = Dict( | ||
BinaryProvider.Linux(:aarch64, :glibc) => ("$bin_prefix/Earcut.aarch64-linux-gnu.tar.gz", "dc137e09a22397d2b1ae8162d58e7f51469d65d73c5108460f556034ded6a9cd"), | ||
BinaryProvider.Linux(:armv7l, :glibc) => ("$bin_prefix/Earcut.arm-linux-gnueabihf.tar.gz", "ffc7c5589c0bb0389d4957e320f5094df98fc254091b97ba894e9bb19cac223f"), | ||
BinaryProvider.Linux(:i686, :glibc) => ("$bin_prefix/Earcut.i686-linux-gnu.tar.gz", "5b838d58a6ca1bc6a50b2618c3f903e2964e326511041a2be4b03ea831679927"), | ||
BinaryProvider.Windows(:i686) => ("$bin_prefix/Earcut.i686-w64-mingw32.tar.gz", "83d4833cd645e3fdc0040cfb47d6082f57b9e0a67aae48fb41fc6614e16de10b"), | ||
BinaryProvider.Linux(:powerpc64le, :glibc) => ("$bin_prefix/Earcut.powerpc64le-linux-gnu.tar.gz", "1d18b6397dfaeb89297d639ae8178bf830414182689e86fb513edd652e6f6872"), | ||
BinaryProvider.MacOS() => ("$bin_prefix/Earcut.x86_64-apple-darwin14.tar.gz", "bbbf711726bf25bf2fd496938fb55ada2c688bcc3aa34127c42081225f539eeb"), | ||
BinaryProvider.Linux(:x86_64, :glibc) => ("$bin_prefix/Earcut.x86_64-linux-gnu.tar.gz", "53b6e41d7319b5a957ab59ddca224e4667577d4c0560fd0868e2aa1ff2b521a7"), | ||
BinaryProvider.Windows(:x86_64) => ("$bin_prefix/Earcut.x86_64-w64-mingw32.tar.gz", "42e63d547f5320a778375b6ebab4bd74a61d80972b71ed20a0c379c83fb0500b"), | ||
) | ||
if platform_key() in keys(download_info) | ||
# First, check to see if we're all satisfied | ||
if any(!satisfied(p; verbose=true) for p in products) | ||
# Download and install binaries | ||
url, tarball_hash = download_info[platform_key()] | ||
install(url, tarball_hash; prefix=prefix, force=true, verbose=true) | ||
end | ||
@write_deps_file earcut | ||
else | ||
error("Your platform $(Sys.MACHINE) is not supported by this package!") | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters