Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
odow committed Mar 12, 2024
1 parent e1145f2 commit 1f03a55
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 13 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,17 @@ jobs:
matrix:
version: ['1.6', '1']
os: ['ubuntu-latest', 'macOS-latest', 'windows-latest']
arch: [x64]
include:
- version: '1'
os: macos-14
arch: aarch64
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: 'x64'
arch: ${{ matrix.arch }}
- uses: julia-actions/cache@v1
- shell: bash
env:
Expand Down
30 changes: 21 additions & 9 deletions deps/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,29 @@ end

function try_ci_installation()
local_filename = joinpath(@__DIR__, "knitro14.zip")
download(ENV["SECRET_KNITRO_ZIP"], local_filename)
if Sys.islinux()
run(`unzip knitro14.zip`)
write_depsfile("", joinpath(@__DIR__, "libknitro1400.so"))
# If these files exist, it is because they have been cached from a separate
# CI job.
if !isfile(local_filename)
download(ENV["SECRET_KNITRO_ZIP"], local_filename)
end
if !isfile("libknitro1400.so")
if Sys.islinux()
run(`unzip knitro14.zip`)
elseif Sys.isapple()
run(`tar -xf knitro14.zip`)
elseif Sys.iswindows()
run(`tar -xf knitro14.zip`)
end
end
filename = if Sys.islinux()
"libknitro1400.so"
elseif Sys.isapple()
run(`tar -xf knitro14.zip`)
write_depsfile("", joinpath(@__DIR__, "libknitro1400.dylib"))
elseif Sys.iswindows()
run(`tar -xf knitro14.zip`)
write_depsfile("", joinpath(@__DIR__, "knitro1400.dll"))
joinpath(Sys.ARCH == :x86_64 ? "" : "mac-arm", "libknitro1400.dylib")
else
@assert Sys.iswindows()
"knitro1400.dll"
end
write_depsfile("", joinpath(@__DIR__, filename))
return
end

Expand Down
9 changes: 6 additions & 3 deletions src/KNITRO.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ end
has_knitro() = endswith(libknitro, Libdl.dlext)

function __init__()
libiomp5 = replace(libknitro, r"libknitro[0-9]+\." => "libiomp5.")
if isfile(libiomp5)
Libdl.dlopen(libiomp5)
for libiomp_name in ("libiomp5.", "libiomp.", "libiomp5md.")
libiomp = replace(libknitro, r"libknitro[0-9]+\." => libiomp_name)
if isfile(libiomp)
Libdl.dlopen(libiomp)
break
end
end
version = has_knitro() ? knitro_version() : v"0.0.0"
if version != v"0.0.0" && version < v"11.0"
Expand Down

0 comments on commit 1f03a55

Please sign in to comment.