Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for julia 1.0 #184

Merged
merged 20 commits into from
Oct 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions deps/build.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if VERSION >= v"0.7.0-DEV.3382"
@static if VERSION >= v"0.7.0-DEV.3382"
using Libdl
end

Expand All @@ -15,28 +15,28 @@ function write_depsfile(path)
end
end

if is_apple()
@static if (VERSION >= v"0.7.0-DEV.3382" && Sys.isapple()) || (VERSION < v"0.7.0-DEV.3382" && is_apple())
Libdl.dlopen("libstdc++",Libdl.RTLD_GLOBAL)
end

base_env = "CPLEX_STUDIO_BINARIES"

cpxvers = ["1260","1261","1262","1263","1270", "1271","128","1280"]
const cpxvers = ["1260","1261","1262","1263","1270", "1271","128","1280"]

libnames = String["cplex"]
for v in reverse(cpxvers)
if is_apple()
if (VERSION >= v"0.7.0-DEV.3382" && Sys.isapple()) || (VERSION < v"0.7.0-DEV.3382" && is_apple())
push!(libnames, "libcplex$v.dylib")
elseif is_unix()
elseif (VERSION >= v"0.7.0-DEV.3382" && Sys.isunix()) || (VERSION < v"0.7.0-DEV.3382" && is_unix())
push!(libnames, "libcplex$v.so")
if haskey(ENV, base_env)
push!(libnames, joinpath(ENV[base_env], "libcplex$v.so"))
end
end
end

wincpxvers = ["126","1261","1262","1263","127","1270","1271","128","1280"]
if is_windows()
const wincpxvers = ["126","1261","1262","1263","127","1270","1271","128","1280"]
@static if (VERSION >= v"0.7.0-DEV.3382" && Sys.iswindows()) || (VERSION < v"0.7.0-DEV.3382" && is_windows())
for v in reverse(wincpxvers)
env = base_env * v
if haskey(ENV,env)
Expand All @@ -57,7 +57,7 @@ found = false
for l in libnames
d = Libdl.dlopen_e(l)
if d != C_NULL
found = true
global found = true
write_depsfile(Libdl.dlpath(d))
break
end
Expand Down
16 changes: 5 additions & 11 deletions src/CPLEX.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module CPLEX
using Libdl
end

if is_apple()
@static if (VERSION >= v"0.7.0-DEV.3382" && Sys.isapple()) || (VERSION < v"0.7.0-DEV.3382" && is_apple())
Libdl.dlopen("libstdc++",Libdl.RTLD_GLOBAL)
end

Expand All @@ -20,7 +20,7 @@ module CPLEX
import Base: convert, unsafe_convert, show, copy

# Standard LP interface
importall MathProgBase.SolverInterface
using MathProgBase.SolverInterface

# exported functions
# export is_valid,
Expand Down Expand Up @@ -85,6 +85,9 @@ module CPLEX

using Compat

using Compat.SparseArrays
using Compat.LinearAlgebra

include("cpx_common.jl")
include("cpx_env.jl")
v = version()
Expand Down Expand Up @@ -114,13 +117,4 @@ module CPLEX

include("CplexSolverInterface.jl")
include("MOIWrapper.jl")

# These are undocumented JuMP extensions for CPLEX which
# will need to be hosted in a separate package for Julia 0.6 and later.
if isdir(Pkg.dir("JuMP")) && VERSION < v"0.6-"
try
eval(current_module(), Expr(:import,:JuMP))
include("JuMPfunctions.jl")
end
end
end
Loading