|
5 | 5 | baremodule libLLVM_jll
|
6 | 6 | using Base, Libdl
|
7 | 7 |
|
8 |
| -const PATH_list = String[] |
9 |
| -const LIBPATH_list = String[] |
10 |
| - |
11 | 8 | export libLLVM
|
12 | 9 |
|
13 | 10 | # These get calculated in __init__()
|
14 | 11 | const PATH = Ref("")
|
| 12 | +const PATH_list = String[] |
15 | 13 | const LIBPATH = Ref("")
|
| 14 | +const LIBPATH_list = String[] |
16 | 15 | artifact_dir::String = ""
|
17 |
| -libLLVM_handle::Ptr{Cvoid} = C_NULL |
18 | 16 | libLLVM_path::String = ""
|
19 | 17 |
|
| 18 | +_libLLVM_dependencies = LazyLibrary[] |
| 19 | + |
20 | 20 | if Sys.iswindows()
|
21 |
| - const libLLVM = "$(Base.libllvm_name).dll" |
| 21 | + const _libLLVM_path = BundledLazyLibraryPath("$(Base.libllvm_name).dll") |
22 | 22 | elseif Sys.isapple()
|
23 |
| - const libLLVM = "@rpath/libLLVM.dylib" |
| 23 | + const _libLLVM_path = BundledLazyLibraryPath("libLLVM.dylib") |
24 | 24 | else
|
25 |
| - const libLLVM = "$(Base.libllvm_name).so" |
| 25 | + const _libLLVM_path = BundledLazyLibraryPath("$(Base.libllvm_name).so") |
26 | 26 | end
|
27 | 27 |
|
| 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 | + |
28 | 38 | function __init__()
|
29 |
| - global libLLVM_handle = dlopen(libLLVM) |
30 |
| - global libLLVM_path = dlpath(libLLVM_handle) |
| 39 | + global libLLVM_path = string(_libLLVM_path) |
31 | 40 | global artifact_dir = dirname(Sys.BINDIR)
|
32 | 41 | LIBPATH[] = dirname(libLLVM_path)
|
33 | 42 | push!(LIBPATH_list, LIBPATH[])
|
34 | 43 | end
|
35 | 44 |
|
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 |
| - |
45 | 45 | end # module libLLVM_jll
|
0 commit comments