diff --git a/src/wrappers/aarch64-apple-darwin.jl b/src/wrappers/aarch64-apple-darwin.jl index 72e64c3..2140608 100644 --- a/src/wrappers/aarch64-apple-darwin.jl +++ b/src/wrappers/aarch64-apple-darwin.jl @@ -22,6 +22,10 @@ function __init__() ) JLLWrappers.@init_executable_product(gurobi_cl, "bin/gurobi_cl") JLLWrappers.@init_executable_product(grbgetkey, "bin/grbgetkey") + gurobi_lic = joinpath(artifact_dir, "lib", "gurobi.lic") + if isfile(gurobi_lic) + rm(gurobi_lic; force = true) + end JLLWrappers.@generate_init_footer() return end # __init__() diff --git a/src/wrappers/x86_64-apple-darwin.jl b/src/wrappers/x86_64-apple-darwin.jl index 72e64c3..2140608 100644 --- a/src/wrappers/x86_64-apple-darwin.jl +++ b/src/wrappers/x86_64-apple-darwin.jl @@ -22,6 +22,10 @@ function __init__() ) JLLWrappers.@init_executable_product(gurobi_cl, "bin/gurobi_cl") JLLWrappers.@init_executable_product(grbgetkey, "bin/grbgetkey") + gurobi_lic = joinpath(artifact_dir, "lib", "gurobi.lic") + if isfile(gurobi_lic) + rm(gurobi_lic; force = true) + end JLLWrappers.@generate_init_footer() return end # __init__() diff --git a/src/wrappers/x86_64-linux-gnu.jl b/src/wrappers/x86_64-linux-gnu.jl index a613407..fc30098 100644 --- a/src/wrappers/x86_64-linux-gnu.jl +++ b/src/wrappers/x86_64-linux-gnu.jl @@ -22,6 +22,10 @@ function __init__() ) JLLWrappers.@init_executable_product(gurobi_cl, "bin/gurobi_cl") JLLWrappers.@init_executable_product(grbgetkey, "bin/grbgetkey") + gurobi_lic = joinpath(artifact_dir, "lib", "gurobi.lic") + if isfile(gurobi_lic) + rm(gurobi_lic; force = true) + end JLLWrappers.@generate_init_footer() return end # __init__() diff --git a/src/wrappers/x86_64-w64-mingw32.jl b/src/wrappers/x86_64-w64-mingw32.jl index 52cdfc7..52d6f45 100644 --- a/src/wrappers/x86_64-w64-mingw32.jl +++ b/src/wrappers/x86_64-w64-mingw32.jl @@ -24,6 +24,10 @@ function __init__() ) JLLWrappers.@init_executable_product(gurobi_cl, "gurobi_cl.exe") JLLWrappers.@init_executable_product(grbgetkey, "grbgetkey.exe") + gurobi_lic = joinpath(artifact_dir, "gurobi.lic") + if isfile(gurobi_lic) + rm(gurobi_lic; force = true) + end JLLWrappers.@generate_init_footer() return end # __init__() diff --git a/test/runtests.jl b/test/runtests.jl index b5666f7..2b7b6eb 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -39,3 +39,13 @@ end @testset "grbgetkey" begin @test Gurobi_jll.grbgetkey_path isa String end + +@testset "license_error" begin + envptr = Ref{Ptr{Cvoid}}() + error = @ccall libgurobi.GRBemptyenv(envptr::Ptr{Ptr{Cvoid}})::Cint + @test error == 0 + error = @ccall libgurobi.GRBstartenv(envptr[]::Ptr{Cvoid})::Cint + @test error == 10009 + msg = unsafe_string(@ccall libgurobi.GRBgeterrormsg(envptr[]::Ptr{Cvoid})::Ptr{Cchar}) + @test startswith(msg, "No Gurobi license found") +end