|
5 | 5 | baremodule dSFMT_jll |
6 | 6 | using Base, Libdl |
7 | 7 |
|
8 | | -const PATH_list = String[] |
9 | | -const LIBPATH_list = String[] |
10 | | - |
11 | 8 | export libdSFMT |
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 | | -libdSFMT_handle::Ptr{Cvoid} = C_NULL |
18 | 16 | libdSFMT_path::String = "" |
19 | 17 |
|
| 18 | +_libdSFMT_dependencies = LazyLibrary[] |
| 19 | + |
20 | 20 | if Sys.iswindows() |
21 | | - const libdSFMT = "libdSFMT.dll" |
| 21 | + const _libdSFMT_path = BundledLazyLibraryPath("libdSFMT.dll") |
22 | 22 | elseif Sys.isapple() |
23 | | - const libdSFMT = "@rpath/libdSFMT.dylib" |
| 23 | + const _libdSFMT_path = BundledLazyLibraryPath("libdSFMT.dylib") |
24 | 24 | else |
25 | | - const libdSFMT = "libdSFMT.so" |
| 25 | + const _libdSFMT_path = BundledLazyLibraryPath("libdSFMT.so") |
26 | 26 | end |
27 | 27 |
|
| 28 | +const libdSFMT = LazyLibrary( |
| 29 | + _libdSFMT_path, |
| 30 | + dependencies=_libdSFMT_dependencies, |
| 31 | +) |
| 32 | + |
| 33 | +function eager_mode() |
| 34 | + dlopen(libdSFMT) |
| 35 | +end |
| 36 | +is_available() = true |
| 37 | + |
28 | 38 | function __init__() |
29 | | - global libdSFMT_handle = dlopen(libdSFMT) |
30 | | - global libdSFMT_path = dlpath(libdSFMT_handle) |
| 39 | + global libdSFMT_path = string(_libdSFMT_path) |
31 | 40 | global artifact_dir = dirname(Sys.BINDIR) |
32 | 41 | LIBPATH[] = dirname(libdSFMT_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_libdSFMT_path() = libdSFMT_path |
44 | | - |
45 | 45 | end # module dSFMT_jll |
0 commit comments