Skip to content

Commit ceb2577

Browse files
lazify libLLVM_jll
1 parent fdb3f2e commit ceb2577

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

stdlib/libLLVM_jll/src/libLLVM_jll.jl

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,41 +5,41 @@
55
baremodule libLLVM_jll
66
using Base, Libdl
77

8-
const PATH_list = String[]
9-
const LIBPATH_list = String[]
10-
118
export libLLVM
129

1310
# These get calculated in __init__()
1411
const PATH = Ref("")
12+
const PATH_list = String[]
1513
const LIBPATH = Ref("")
14+
const LIBPATH_list = String[]
1615
artifact_dir::String = ""
17-
libLLVM_handle::Ptr{Cvoid} = C_NULL
1816
libLLVM_path::String = ""
1917

18+
_libLLVM_dependencies = LazyLibrary[]
19+
2020
if Sys.iswindows()
21-
const libLLVM = "$(Base.libllvm_name).dll"
21+
const _libLLVM_path = BundledLazyLibraryPath("$(Base.libllvm_name).dll")
2222
elseif Sys.isapple()
23-
const libLLVM = "@rpath/libLLVM.dylib"
23+
const _libLLVM_path = BundledLazyLibraryPath("libLLVM.dylib")
2424
else
25-
const libLLVM = "$(Base.libllvm_name).so"
25+
const _libLLVM_path = BundledLazyLibraryPath("$(Base.libllvm_name).so")
2626
end
2727

28+
const libLLVM = LazyLibrary(
29+
_libLLVM_path,
30+
dependencies=_libLLVM_dependencies,
31+
)
32+
33+
function eager_mode()
34+
dlopen(libLLVM)
35+
end
36+
is_available() = true
37+
2838
function __init__()
29-
global libLLVM_handle = dlopen(libLLVM)
30-
global libLLVM_path = dlpath(libLLVM_handle)
39+
global libLLVM_path = string(_libLLVM_path)
3140
global artifact_dir = dirname(Sys.BINDIR)
3241
LIBPATH[] = dirname(libLLVM_path)
3342
push!(LIBPATH_list, LIBPATH[])
3443
end
3544

36-
# JLLWrappers API compatibility shims. Note that not all of these will really make sense.
37-
# For instance, `find_artifact_dir()` won't actually be the artifact directory, because
38-
# there isn't one. It instead returns the overall Julia prefix.
39-
is_available() = true
40-
find_artifact_dir() = artifact_dir
41-
dev_jll() = error("stdlib JLLs cannot be dev'ed")
42-
best_wrapper = nothing
43-
get_libLLVM_path() = libLLVM_path
44-
4545
end # module libLLVM_jll

0 commit comments

Comments
 (0)