Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
odow committed Mar 11, 2024
1 parent deb0a5d commit dae129d
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions src/Xpress.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@ import SparseArrays
# Load in `deps.jl`, complaining if it does not exist
const depsjl_path = joinpath(@__DIR__, "..", "deps", "deps.jl")

libxprs = ""
if isfile(depsjl_path)
include(depsjl_path)
global libxprs = joinpath(
xpressdlpath,
string(Sys.iswindows() ? "" : "lib", "xprs", ".", Libdl.dlext),
)
else
global libxprs = ""
end

include("Lib/Lib.jl")

Expand All @@ -36,27 +44,24 @@ const XPRS_ATTRIBUTES = Dict{String,Any}(
)

function initialize()
Libdl.dlopen(libxprs)
userlic()
init() # Call XPRSinit for initialization
init()
# Calling free is not necessary since destroyprob is called
# in the finalizer.
return
end

include("MOI/MOI_wrapper.jl")
include("MOI/MOI_callbacks.jl")

function __init__()
if isfile(depsjl_path)
include(depsjl_path)
global libxprs = joinpath(
xpressdlpath,
string(Sys.iswindows() ? "" : "lib", "xprs", ".", Libdl.dlext),
)
elseif haskey(ENV, "XPRESS_JL_LIBRARY")
if haskey(ENV, "XPRESS_JL_LIBRARY")
global libxprs = ENV["XPRESS_JL_LIBRARY"]
elseif !haskey(ENV, "XPRESS_JL_NO_DEPS_ERROR")
Lib._set_libxprs(libxprs)
elseif isempty(libxprs) && !haskey(ENV, "XPRESS_JL_NO_DEPS_ERROR")
error("XPRESS cannot be loaded. Please run Pkg.build(\"Xpress\").")

Check warning on line 63 in src/Xpress.jl

View check run for this annotation

Codecov / codecov/patch

src/Xpress.jl#L62-L63

Added lines #L62 - L63 were not covered by tests
end
Lib._set_libxprs(libxprs)
if !haskey(ENV, "XPRESS_JL_NO_AUTO_INIT") &&
get(ENV, "JULIA_REGISTRYCI_AUTOMERGE", "false") != "true"
initialize()
Expand Down

0 comments on commit dae129d

Please sign in to comment.