|
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 |
|
| 17 | +_libopenlibm_dependencies = LazyLibrary[] |
| 18 | + |
18 | 19 | if Sys.iswindows() |
19 | | - const libopenlibm = "libopenlibm.dll" |
| 20 | + const _libopenlibm_path = BundledLazyLibraryPath("libopenlibm.dll") |
20 | 21 | elseif Sys.isapple() |
21 | | - const libopenlibm = "@rpath/libopenlibm.4.dylib" |
| 22 | + const _libopenlibm_path = BundledLazyLibraryPath("libopenlibm.4.dylib") |
22 | 23 | else |
23 | | - const libopenlibm = "libopenlibm.so.4" |
| 24 | + const _libopenlibm_path = BundledLazyLibraryPath("libopenlibm.so.4") |
24 | 25 | end |
25 | 26 |
|
| 27 | +const libopenlibm = LazyLibrary( |
| 28 | + _libopenlibm_path, |
| 29 | + dependencies=_libopenlibm_dependencies, |
| 30 | +) |
| 31 | + |
| 32 | +function eager_mode() |
| 33 | + dlopen(libopenlibm) |
| 34 | +end |
| 35 | +is_available() = true |
| 36 | + |
26 | 37 | function __init__() |
27 | | - global libopenlibm_handle = dlopen(libopenlibm) |
28 | | - global libopenlibm_path = dlpath(libopenlibm_handle) |
| 38 | + global libopenlibm_path = string(_libopenlibm_path) |
29 | 39 | global artifact_dir = dirname(Sys.BINDIR) |
30 | 40 | LIBPATH[] = dirname(libopenlibm_path) |
31 | 41 | push!(LIBPATH_list, LIBPATH[]) |
32 | 42 | end |
33 | 43 |
|
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 | 44 | end # module OpenLibm_jll |
0 commit comments