Skip to content

Commit

Permalink
Use a single header wrapper for all platforms.
Browse files Browse the repository at this point in the history
The headers are identical anyway, and this makes it possible to support
unknown platforms, which is important as this package is part of the
default Julia distribution.
  • Loading branch information
maleadt committed Sep 30, 2023
1 parent ac5c8ed commit 5551a81
Show file tree
Hide file tree
Showing 16 changed files with 13 additions and 50,109 deletions.
26 changes: 12 additions & 14 deletions gen/generator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,19 @@ umfpack_h = joinpath(include_dir, "umfpack.h")
# load common option
options = load_options(joinpath(@__DIR__, "generator.toml"))

# run generator for all platforms
for target in JLLEnvs.JLL_ENV_TRIPLES
@info "processing $target"
# we only generate a single wrapper for all platforms, because the headers are currently not
# platform dependent. since this package is part of the default Julia distribution, we also
# need to make sure that it can handle all platforms, including new ones that are not yet
# supported by BinaryBuilder (the easiest solution here is to always use a single wrapper).
options["general"]["output_file_path"] = joinpath(@__DIR__, "..", "src/solvers/wrappers.jl")
args = get_default_args()
push!(args, "-I$include_dir")

options["general"]["output_file_path"] = joinpath(@__DIR__, "..", "src/solvers/lib", "$target.jl")
header_files = [cholmod_h, SuiteSparseQR_C_h, umfpack_h]

args = get_default_args(target)
push!(args, "-I$include_dir")
ctx = create_context(header_files, args, options)

header_files = [cholmod_h, SuiteSparseQR_C_h, umfpack_h]
build!(ctx)

ctx = create_context(header_files, args, options)

build!(ctx)

path = options["general"]["output_file_path"]
format_file(path, YASStyle())
end
path = options["general"]["output_file_path"]
format_file(path, YASStyle())
33 changes: 1 addition & 32 deletions src/solvers/LibSuiteSparse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,7 @@ using SuiteSparse_jll
const TRUE = Int32(1)
const FALSE = Int32(0)

const IS_LIBC_MUSL = occursin("musl", Base.BUILD_TRIPLET)
if Sys.isapple() && Sys.ARCH === :aarch64
include("lib/aarch64-apple-darwin20.jl")
elseif Sys.islinux() && Sys.ARCH === :aarch64 && !IS_LIBC_MUSL
include("lib/aarch64-linux-gnu.jl")
elseif Sys.islinux() && Sys.ARCH === :aarch64 && IS_LIBC_MUSL
include("lib/aarch64-linux-musl.jl")
elseif Sys.islinux() && startswith(string(Sys.ARCH), "arm") && !IS_LIBC_MUSL
include("lib/armv7l-linux-gnueabihf.jl")
elseif Sys.islinux() && startswith(string(Sys.ARCH), "arm") && IS_LIBC_MUSL
include("lib/armv7l-linux-musleabihf.jl")
elseif Sys.islinux() && Sys.ARCH === :i686 && !IS_LIBC_MUSL
include("lib/i686-linux-gnu.jl")
elseif Sys.islinux() && Sys.ARCH === :i686 && IS_LIBC_MUSL
include("lib/i686-linux-musl.jl")
elseif Sys.iswindows() && Sys.ARCH === :i686
include("lib/i686-w64-mingw32.jl")
elseif Sys.islinux() && Sys.ARCH === :powerpc64le
include("lib/powerpc64le-linux-gnu.jl")
elseif Sys.isapple() && Sys.ARCH === :x86_64
include("lib/x86_64-apple-darwin14.jl")
elseif Sys.islinux() && Sys.ARCH === :x86_64 && !IS_LIBC_MUSL
include("lib/x86_64-linux-gnu.jl")
elseif Sys.islinux() && Sys.ARCH === :x86_64 && IS_LIBC_MUSL
include("lib/x86_64-linux-musl.jl")
elseif Sys.isbsd() && !Sys.isapple()
include("lib/x86_64-unknown-freebsd.jl")
elseif Sys.iswindows() && Sys.ARCH === :x86_64
include("lib/x86_64-w64-mingw32.jl")
else
error("Unknown platform: $(Base.BUILD_TRIPLET)")
end
include("wrappers.jl")

# exports
const PREFIXES = ["cholmod_", "CHOLMOD_", "umfpack_"]
Expand Down
Loading

0 comments on commit 5551a81

Please sign in to comment.