Skip to content
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
22 changes: 11 additions & 11 deletions deps/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Use of this source code is governed by an MIT-style license that can be found
# in the LICENSE.md file or at https://opensource.org/licenses/MIT.
#
# Locate `libhexaly145.so` (.dylib / .dll on macOS / Windows) and emit
# Locate `libhexaly150.so` (.dylib / .dll on macOS / Windows) and emit
# `deps.jl` with `const libhexaly = "..."`. Mirrors the layout used by
# `Gurobi.jl/deps/build.jl`.

Expand All @@ -29,14 +29,14 @@ function write_depsfile(path)
end

# Supported `libhexaly` aliases, newest first. The number is the same as in
# `hx_version_code()` (major*10 + minor), so `145` is Hexaly 14.5.
const ALIASES = ["hexaly145", "hexaly144", "hexaly143", "hexaly142",
# `hx_version_code()` (major*10 + minor), so `150` is Hexaly 15.0.
const ALIASES = ["hexaly150", "hexaly145", "hexaly144", "hexaly143", "hexaly142",
"hexaly141", "hexaly140", "hexaly135"]

# Versioned directories the `.run` installer creates on Linux (and the
# matching `/Library/...` / `C:\Program Files\...` defaults elsewhere).
const VERSION_DIRS = ["hexaly_14_5", "hexaly_14_4", "hexaly_14_3", "hexaly_14_2",
"hexaly_14_1", "hexaly_14_0", "hexaly_13_5"]
const VERSION_DIRS = ["hexaly_15_0", "hexaly_14_5", "hexaly_14_4", "hexaly_14_3",
"hexaly_14_2", "hexaly_14_1", "hexaly_14_0", "hexaly_13_5"]

function _candidate_paths()
paths = String[]
Expand Down Expand Up @@ -88,7 +88,7 @@ function _try_local_install()
end

# Fallback used when no local install is found. Hexaly publishes wheels on
# `pip.hexaly.com` that bundle `libhexaly14X.{so,dylib,dll}` alongside the
# `pip.hexaly.com` that bundle `libhexaly15X.{so,dylib,dll}` alongside the
# Python files. A wheel is just a PEP 491 zip archive, so we fetch and
# extract it directly — no Python interpreter required. Opt out with
# `HEXALY_JL_NO_AUTOINSTALL=1`.
Expand Down Expand Up @@ -169,20 +169,20 @@ function _print_HEXALY_HOME_help()

```
# On Linux, this might be:
ENV["HEXALY_HOME"] = "/opt/hexaly_14_5"
ENV["HEXALY_HOME"] = "/opt/hexaly_15_0"

# On macOS:
ENV["HEXALY_HOME"] = "/Library/hexaly_14_5"
ENV["HEXALY_HOME"] = "/Library/hexaly_15_0"

# On Windows:
ENV["HEXALY_HOME"] = "C:\\\\Program Files\\\\hexaly_14_5"
ENV["HEXALY_HOME"] = "C:\\\\Program Files\\\\hexaly_15_0"

import Pkg
Pkg.build("Hexaly")
```

The `HEXALY_HOME` directory should contain a `bin/` subdirectory with
`libhexaly145.so` / `libhexaly145.dylib` / `hexaly145.dll`.
`libhexaly150.so` / `libhexaly150.dylib` / `hexaly150.dll`.
""")
end

Expand Down Expand Up @@ -217,7 +217,7 @@ function diagnose_hexaly_install()
println("""

We were looking for (but could not find) a file named like
`libhexaly145.so`, `libhexaly145.dylib`, or `hexaly145.dll`.
`libhexaly150.so`, `libhexaly150.dylib`, or `hexaly150.dll`.
""")
catch ex
if ex isa SystemError
Expand Down
2 changes: 1 addition & 1 deletion src/Hexaly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function has_license()
path = get(ENV, "HX_LICENSE_PATH", "")
!isempty(path) && isfile(path) && return true
isfile("license.dat") && return true
for ver in ("14_5", "14_4", "14_3", "14_2", "14_1", "14_0", "13_5")
for ver in ["15_0", "14_5", "14_4", "14_3", "14_2", "14_1", "14_0", "13_5"]
isfile(joinpath("/opt", "hexaly_$(ver)", "license.dat")) && return true
end
return false
Expand Down
8 changes: 7 additions & 1 deletion src/c_wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,13 @@ mutable struct HexalyOptimizer
ptr::hxoptimizer
function HexalyOptimizer()
ptr = hx_create_optimizer()
ptr == C_NULL && error("hx_create_optimizer returned NULL")
if ptr == C_NULL
err = Ref{hxerror}()
if hx_check_last_error(err)
error("hx_create_optimizer failed: $(unsafe_string(err[].message))")
end
error("hx_create_optimizer returned NULL")
end
opt = new(ptr)
finalizer(opt) do o
if o.ptr != C_NULL
Expand Down