|
4 | 4 | baremodule OpenLibm_jll |
5 | 5 | using Base, Libdl |
6 | 6 |
|
7 | | -const PATH_list = String[] |
8 | | -const LIBPATH_list = String[] |
9 | | - |
10 | 7 | export libopenlibm |
11 | 8 |
|
12 | 9 | # These get calculated in __init__() |
13 | 10 | const PATH = Ref("") |
| 11 | +const PATH_list = String[] |
14 | 12 | const LIBPATH = Ref("") |
| 13 | +const LIBPATH_list = String[] |
15 | 14 | artifact_dir::String = "" |
16 | 15 | libopenlibm_path::String = "" |
17 | 16 |
|
18 | 17 | if Sys.iswindows() |
19 | | - const libopenlibm = "libopenlibm.dll" |
| 18 | + const _libopenlibm_path = BundledLazyLibraryPath("libopenlibm.dll") |
20 | 19 | elseif Sys.isapple() |
21 | | - const libopenlibm = "@rpath/libopenlibm.4.dylib" |
| 20 | + const _libopenlibm_path = BundledLazyLibraryPath("libopenlibm.4.dylib") |
22 | 21 | else |
23 | | - const libopenlibm = "libopenlibm.so.4" |
| 22 | + const _libopenlibm_path = BundledLazyLibraryPath("libopenlibm.so.4") |
24 | 23 | end |
25 | 24 |
|
| 25 | +const libopenlibm = LazyLibrary(_libopenlibm_path) |
| 26 | + |
| 27 | +function eager_mode() |
| 28 | + dlopen(libopenlibm) |
| 29 | +end |
| 30 | +is_available() = true |
| 31 | + |
26 | 32 | function __init__() |
27 | | - global libopenlibm_handle = dlopen(libopenlibm) |
28 | | - global libopenlibm_path = dlpath(libopenlibm_handle) |
| 33 | + global libopenlibm_path = string(_libopenlibm_path) |
29 | 34 | global artifact_dir = dirname(Sys.BINDIR) |
30 | 35 | LIBPATH[] = dirname(libopenlibm_path) |
31 | 36 | push!(LIBPATH_list, LIBPATH[]) |
32 | 37 | end |
33 | 38 |
|
34 | | -# JLLWrappers API compatibility shims. Note that not all of these will really make sense. |
35 | | -# For instance, `find_artifact_dir()` won't actually be the artifact directory, because |
36 | | -# there isn't one. It instead returns the overall Julia prefix. |
37 | | -is_available() = true |
38 | | -find_artifact_dir() = artifact_dir |
39 | | -dev_jll() = error("stdlib JLLs cannot be dev'ed") |
40 | | -best_wrapper = nothing |
41 | | -get_libopenlibm_path() = libopenlibm_path |
42 | | - |
43 | 39 | end # module OpenLibm_jll |
0 commit comments