Skip to content

Commit

Permalink
add deps/build.jl
Browse files Browse the repository at this point in the history
 - inspired by Gurobi.jl
 - seems to work when `/usr/lib/libscip.so` exists.
  • Loading branch information
rschwarz committed Dec 15, 2018
1 parent 3fd6395 commit 91dbc68
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
julia 1.0
Compat
37 changes: 37 additions & 0 deletions deps/build.jl
Original file line number Diff line number Diff line change
@@ -1 +1,38 @@
using Compat
using Libdl

depsfile = joinpath(dirname(@__FILE__), "deps.jl")
if isfile(depsfile)
rm(depsfile)
end

function write_depsfile(path)
f = open(depsfile, "w")
println(f, "const libscip = \"$path\"")
close(f)
end

libname = "libscip.so"
paths_to_try = [libname]

if haskey(ENV, "SCIPOPTDIR")
if Compat.Sys.isunix()
push!(paths_to_try, joinpath(ENV["SCIPOPTDIR"], "lib", libname))
end
end

found = false
for l in paths_to_try
d = Libdl.dlopen_e(l)
if d != C_NULL
global found = true
write_depsfile(l)
break
end
end

if !found && !haskey(ENV, "SCIP_JL_SKIP_LIB_CHECK")
error("Unable to locate SCIP installation. " *
"Note that this must be downloaded separately from scip.zib.de. " *
"Please set the environment variable SCIPOPTDIR to SCIP's installation path.")
end

0 comments on commit 91dbc68

Please sign in to comment.