Skip to content

Commit 639c42f

Browse files
committed
Update
1 parent 97b32e2 commit 639c42f

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

src/KNITRO.jl

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,21 @@ has_knitro() = endswith(libknitro, Libdl.dlext)
1919

2020
if isdefined(@__MODULE__, :libknitro)
2121
# deps.jl must define a local installation.
22+
function __init__()
23+
libiomp5 = replace(libknitro, "libknitro" => "libiomp5")
24+
if isfile(libiomp5)
25+
Libdl.dlopen(libiomp5)
26+
end
27+
version = has_knitro() ? knitro_version() : v"0.0.0"
28+
if version != v"0.0.0" && version < v"11.0"
29+
error(
30+
"You have installed version $version of Artelys " *
31+
"Knitro, which is not supported by KNITRO.jl. We require a " *
32+
"Knitro version greater than 11.0.",
33+
)
34+
end
35+
return
36+
end
2237
elseif KNITRO_jll.is_available()
2338
import KNITRO_jll: libknitro
2439
else
@@ -28,25 +43,6 @@ else
2843
)
2944
end
3045

31-
function __init__()
32-
if KNITRO_jll.is_available()
33-
return
34-
end
35-
libiomp5 = replace(libknitro, "libknitro" => "libiomp5")
36-
if isfile(libiomp5)
37-
Libdl.dlopen(libiomp5)
38-
end
39-
version = has_knitro() ? knitro_version() : v"0.0.0"
40-
if version != v"0.0.0" && version < v"11.0"
41-
error(
42-
"You have installed version $version of Artelys " *
43-
"Knitro, which is not supported by KNITRO.jl. We require a " *
44-
"Knitro version greater than 11.0.",
45-
)
46-
end
47-
return
48-
end
49-
5046
function knitro_version()
5147
length = 15
5248
release = zeros(Cchar, length)

0 commit comments

Comments
 (0)