-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from sisl/binarybuilder
[WIP] Use Cxx and BinaryBuilder
- Loading branch information
Showing
15 changed files
with
1,524 additions
and
681 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 |
---|---|---|
@@ -1,50 +1,40 @@ | ||
# Documentation: http://docs.travis-ci.com/user/languages/julia/ | ||
language: julia | ||
os: | ||
- linux | ||
julia: | ||
- 1.0 | ||
- 1.1 | ||
- nightly | ||
|
||
env: | ||
- CONDA_JL_VERSION="3" PYTHON="" | ||
|
||
addons: | ||
apt: | ||
sources: | ||
- ubuntu-toolchain-r-test | ||
packages: | ||
- g++-7 | ||
- python3-dev | ||
- clang-3.9 | ||
- graphviz | ||
|
||
matrix: | ||
allow_failures: | ||
- julia: nightly | ||
fast_finish: true | ||
|
||
notifications: | ||
email: false | ||
before_script: | ||
- sudo apt-get -qq update | ||
- sudo apt-get install -y pdf2svg | ||
- sudo apt-get install -y texlive-latex-base | ||
- sudo apt-get install -y texlive-binaries | ||
- sudo apt-get install -y texlive-pictures | ||
- sudo apt-get install -y texlive-latex-extra | ||
- sudo pip install dot2tex | ||
# Every 30 seconds, look for the build log file. If it exists, then | ||
# start watching its contents and printing them to stdout as they | ||
# change. This has two effects: | ||
# 1. it avoids Travis timing out because the build outputs nothing | ||
# 2. it makes it more obvious what part of the build, if any, gets stuck | ||
- while sleep 3; do tail ~/build/sisl/Spot.jl/deps/build.log -f ; done & | ||
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 90 | ||
script: | ||
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi | ||
- julia --project --color=yes -e 'import Pkg; Pkg.build(); Pkg.test(coverage=true)' | ||
after_success: | ||
- julia --project -e 'import Pkg; Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())' | ||
- julia --project -e 'import Pkg; Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())' | ||
|
||
# Documentation: http://docs.travis-ci.com/user/languages/julia/ | ||
language: julia | ||
os: | ||
- linux | ||
julia: | ||
- 1.2 | ||
- nightly | ||
|
||
addons: | ||
apt: | ||
sources: | ||
- ubuntu-toolchain-r-test | ||
packages: | ||
- g++-7 | ||
- clang-3.9 | ||
- graphviz | ||
|
||
matrix: | ||
allow_failures: | ||
- julia: nightly | ||
fast_finish: true | ||
|
||
notifications: | ||
email: false | ||
before_script: | ||
- sudo apt-get -qq update | ||
- sudo apt-get install -y pdf2svg | ||
- sudo apt-get install -y texlive-latex-base | ||
- sudo apt-get install -y texlive-binaries | ||
- sudo apt-get install -y texlive-pictures | ||
- sudo apt-get install -y texlive-latex-extra | ||
- sudo pip install dot2tex | ||
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 90 | ||
script: | ||
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi | ||
- julia --project --color=yes -e 'import Pkg; Pkg.build(); Pkg.test(coverage=true)' | ||
after_success: | ||
- julia --project -e 'import Pkg; Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())' | ||
- julia --project -e 'import Pkg; Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())' |
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
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
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,62 +1,45 @@ | ||
using PyCall | ||
using Conda | ||
using BinaryProvider # requires BinaryProvider 0.3.0 or later | ||
|
||
const SPOT_DEV_URL = "https://gitlab.lrde.epita.fr/spot/spot/-/jobs/21743/artifacts/download" | ||
# const SPOT_DEV_URL = "https://gitlab.lrde.epita.fr/spot/spot/-/jobs/21303/artifacts/download" | ||
# Parse some basic command-line arguments | ||
const verbose = "--verbose" in ARGS | ||
const prefix = Prefix(get([a for a in ARGS if a != "--verbose"], 1, joinpath(@__DIR__, "usr"))) | ||
products = [ | ||
LibraryProduct(prefix, ["libspot"], :libspot), | ||
] | ||
|
||
const SPOT_VERSION = "spot-2.6.3.dev" | ||
const GCC_MAJOR_VERSION = parse(Int,Char(read(`g++ -dumpversion | cut -f1 -d.`)[1])) # get g++ major version | ||
if Sys.iswindows() | ||
using Pkg | ||
Pkg.add(PackageSpec(name="Cxx", rev="gn-patch-crash")) | ||
end | ||
|
||
# Download binaries from hosted location | ||
bin_prefix = "https://github.com/MaximeBouton/SpotBuilder/releases/download/v2.8.1" | ||
|
||
if !Sys.isunix() | ||
throw("Windows not supported") | ||
# Listing of files generated by BinaryBuilder: | ||
download_info = Dict( | ||
MacOS(:x86_64) => ("$bin_prefix/Spot.v2.8.1.x86_64-apple-darwin14.tar.gz", "de9236acab1975a06f218d2939f6c319fb0bc67546e89cdc5c85ef90be509cb4"), | ||
Linux(:x86_64, libc=:glibc, compiler_abi=CompilerABI(:gcc7)) => ("$bin_prefix/Spot.v2.8.1.x86_64-linux-gnu-gcc7.tar.gz", "2fd4429180f94e67284ae37704aa22bed357e2a356062f8af0cd39397a173f4c"), | ||
Linux(:x86_64, libc=:glibc, compiler_abi=CompilerABI(:gcc8)) => ("$bin_prefix/Spot.v2.8.1.x86_64-linux-gnu-gcc8.tar.gz", "7caaa648e059c354892a5503b30bf3b2d368469b4295f54564f8a212fa3e2893"), | ||
Windows(:x86_64, compiler_abi=CompilerABI(:gcc7)) => ("$bin_prefix/Spot.v2.8.1.x86_64-w64-mingw32-gcc7.tar.gz", "782f52898e81c51abd8930c34184a6f99d78e4a49e7a6c753b9eb0741e8bcdfc"), | ||
Windows(:x86_64, compiler_abi=CompilerABI(:gcc8)) => ("$bin_prefix/Spot.v2.8.1.x86_64-w64-mingw32-gcc8.tar.gz", "283473593d120f968366f85da52bd4341ac94715c49476adf9bdd1688b445411"), | ||
) | ||
|
||
# Install unsatisfied or updated dependencies: | ||
unsatisfied = any(!satisfied(p; verbose=verbose) for p in products) | ||
dl_info = choose_download(download_info, platform_key_abi()) | ||
if dl_info === nothing && unsatisfied | ||
# If we don't have a compatible .tar.gz to download, complain. | ||
# Alternatively, you could attempt to install from a separate provider, | ||
# build from source or something even more ambitious here. | ||
error("Your platform (\"$(Sys.MACHINE)\", parsed as \"$(triplet(platform_key_abi()))\") is not supported by this package!") | ||
end | ||
|
||
# borrowed from TensorFlow.jl | ||
if PyCall.conda | ||
println("Building Spot from source...") | ||
pyversion = PyCall.pyversion | ||
base = dirname(@__FILE__) | ||
println("Switching to directory $base") | ||
cd(base) | ||
isfile("$SPOT_VERSION.zip") ? nothing : run(`wget -O $SPOT_VERSION.zip $SPOT_DEV_URL`) | ||
run(`unzip $SPOT_VERSION.zip`) | ||
run(`rm $SPOT_VERSION.zip`) | ||
run(`tar -xzf $SPOT_VERSION.tar.gz`) # extract | ||
isdir("spot") ? mkdir("spot") : nothing | ||
cd(SPOT_VERSION) | ||
if GCC_MAJOR_VERSION < 5 | ||
println("g++ version must be at least 5.0.0") | ||
end | ||
run(`./configure CXX=g++-7 PYTHON=$(Conda.PYTHONDIR)/python --prefix $(joinpath(base, "spot"))`) | ||
run(`make`) | ||
run(`make install`) | ||
println(readdir(joinpath(base, "spot", "lib"))) | ||
@assert isdir(joinpath(base, "spot")) | ||
@assert isdir(joinpath(base, "spot", "lib", "python"*string(pyversion.major)*"."*string(pyversion.minor), "site-packages")) | ||
println("Python bindings located at: ", joinpath(base, "spot", "lib", "python"*string(pyversion.major)*"."*string(pyversion.minor), "site-packages")) | ||
println("build successful") | ||
println("Linking python bindings to Conda.jl") | ||
conda_path = joinpath(Conda.ROOTENV, "lib", "python"*string(pyversion.major)*"."*string(pyversion.minor), "site-packages") | ||
pythonspot = joinpath(base, "spot", "lib","python"*string(pyversion.major)*"."*string(pyversion.minor), "site-packages") | ||
cd(conda_path) | ||
run(`ln -sf $pythonspot/spot`) | ||
run(`ln -sf $pythonspot/_buddy.a`) | ||
run(`ln -sf $pythonspot/_buddy.la`) | ||
run(`ln -sf $pythonspot/_buddy.so`) | ||
run(`ln -sf $pythonspot/buddy.py`) | ||
else | ||
try | ||
pyimport("spot") | ||
catch ee | ||
typeof(ee) <: PyCall.PyError || rethrow(ee) | ||
error(""" | ||
Python Spot not installed | ||
Please either: | ||
- Rebuild PyCall to use Conda, by running in the julia REPL: | ||
- `ENV["PYTHON"]=""; Pkg.build("PyCall"); Pkg.build("Spot")` | ||
- Or install the python binding yourself: | ||
Install Spot from https://spot.lrde.epita.fr/install.html | ||
Find the python bindings in path/to/spot/lib/python3.x/site-packages | ||
""") | ||
end | ||
# If we have a download, and we are unsatisfied (or the version we're | ||
# trying to install is not itself installed) then load it up! | ||
if unsatisfied || !isinstalled(dl_info...; prefix=prefix) | ||
# Download and install binaries | ||
install(dl_info...; prefix=prefix, force=true, verbose=verbose) | ||
end | ||
|
||
# Write out a deps.jl file that will contain mappings for our products | ||
write_deps_file(joinpath(@__DIR__, "deps.jl"), products, verbose=verbose) |
Oops, something went wrong.