commit
04f844d61a
@ -0,0 +1,4 @@
|
||||
deps/build.log
|
||||
deps/deps.jl
|
||||
gen
|
||||
Manifest.toml
|
@ -0,0 +1,8 @@
|
||||
name = "CPLEXW"
|
||||
uuid = "cfecb002-79c2-11e9-35be-cb59aa640f85"
|
||||
authors = ["Alinson Xavier <axavier@anl.gov>"]
|
||||
version = "1.0.0"
|
||||
|
||||
[deps]
|
||||
CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82"
|
||||
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
|
@ -0,0 +1,61 @@
|
||||
using Libdl
|
||||
|
||||
depsfile = joinpath(dirname(@__FILE__),"deps.jl")
|
||||
if isfile(depsfile)
|
||||
rm(depsfile)
|
||||
end
|
||||
|
||||
function write_depsfile(path)
|
||||
open(depsfile,"w") do f
|
||||
print(f,"const libcplex = ")
|
||||
show(f, path) # print with backslashes excaped on windows
|
||||
println(f)
|
||||
end
|
||||
end
|
||||
|
||||
base_env = "CPLEX_STUDIO_BINARIES"
|
||||
const cpxvers = ["128", "1280", "129", "1290"]
|
||||
|
||||
libnames = String["cplex"]
|
||||
for v in reverse(cpxvers)
|
||||
if Sys.isapple()
|
||||
push!(libnames, "libcplex$v.dylib")
|
||||
elseif Sys.isunix()
|
||||
push!(libnames, "libcplex$v.so")
|
||||
if haskey(ENV, base_env)
|
||||
push!(libnames, joinpath(ENV[base_env], "libcplex$v.so"))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
const wincpxvers = ["128", "1280", "129", "1290"]
|
||||
@static if Sys.iswindows()
|
||||
for v in reverse(wincpxvers)
|
||||
env = base_env * v
|
||||
if haskey(ENV,env)
|
||||
for d in split(ENV[env],';')
|
||||
occursin("cplex", d) || continue
|
||||
if length(v) == 3
|
||||
push!(libnames,joinpath(d,"cplex$(v)0"))
|
||||
else
|
||||
push!(libnames,joinpath(d,"cplex$(v)"))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
found = false
|
||||
|
||||
for l in libnames
|
||||
d = Libdl.dlopen_e(l)
|
||||
if d != C_NULL
|
||||
global found = true
|
||||
write_depsfile(Libdl.dlpath(d))
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if !found
|
||||
error("Unable to locate CPLEX installation")
|
||||
end
|
@ -0,0 +1,18 @@
|
||||
module CPLEXW
|
||||
using CEnum, Libdl
|
||||
|
||||
if isfile(joinpath(dirname(@__FILE__),"..","deps","deps.jl"))
|
||||
include("../deps/deps.jl")
|
||||
else
|
||||
error("CPLEXW not properly installed. Please run Pkg.build(\"CPLEXW\")")
|
||||
end
|
||||
|
||||
include("commons.jl")
|
||||
include("cplex.jl")
|
||||
|
||||
foreach(names(@__MODULE__, all=true)) do s
|
||||
if startswith(string(s), "CPX")
|
||||
@eval export $s
|
||||
end
|
||||
end
|
||||
end
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in new issue