Skip to content

Commit 97a1a7a

Browse files
committed
Support augment_platform in JLLWrappers
1 parent dd045e0 commit 97a1a7a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/toplevel_generators.jl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,19 @@ function generate_imports(src_name)
3131
using Pkg.Artifacts: load_artifacts_toml, unpack_platform
3232
using Pkg.BinaryPlatforms: triplet, select_platform
3333
HostPlatform() = platform_key_abi()
34+
if !@isdefined(augment_platform)
35+
augment_platform(platform) = platform
36+
end
3437
end
3538
else
3639
# Use fast stdlib-based Artifacts + Preferences
3740
return quote
3841
using Libdl, Artifacts, JLLWrappers.Preferences, Base.BinaryPlatforms
3942
using Artifacts: load_artifacts_toml, unpack_platform
4043
using Base.BinaryPlatforms: triplet, select_platform
44+
if !@isdefined(augment_platform)
45+
augment_platform(platform) = platform
46+
end
4147
end
4248
end
4349
end
@@ -120,6 +126,8 @@ function generate_wrapper_load(src_name, pkg_uuid, __source__)
120126
# Load Artifacts.toml file and select best platform at compile-time, since this is
121127
# running at toplevel, and therefore will be run completely at compile-time. We use
122128
# a `let` block here to avoid storing unnecessary data in our `.ji` files
129+
130+
host_platform = augment_platform(HostPlatform())
123131
best_wrapper = let
124132
artifacts_toml = joinpath($(pkg_dir), "..", "Artifacts.toml")
125133
valid_wrappers = Dict{Platform,String}()
@@ -158,13 +166,13 @@ function generate_wrapper_load(src_name, pkg_uuid, __source__)
158166
end
159167

160168
# From the available options, choose the best wrapper script
161-
select_platform(valid_wrappers)
169+
select_platform(valid_wrappers, host_platform)
162170
end
163171
end
164172

165173
# Load in the wrapper, if it's not `nothing`!
166174
if best_wrapper === nothing
167-
@debug(string("Unable to load ", $(src_name), "; unsupported platform ", triplet(HostPlatform())))
175+
@debug(string("Unable to load ", $(src_name), "; unsupported platform ", triplet(host_platform)))
168176
is_available() = false
169177
else
170178
Base.include($(Symbol("$(src_name)_jll")), best_wrapper)

0 commit comments

Comments
 (0)