From e9e6ccf65105f6120d67357896cdd10d99e2021f Mon Sep 17 00:00:00 2001 From: Lucas Aschenbach Date: Fri, 27 Jan 2023 20:03:36 +0100 Subject: [PATCH 1/2] Locally compile fortran libraries on AppleSilicon --- deps/build.jl | 9 +++++---- src/DLSolvers.jl | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/deps/build.jl b/deps/build.jl index 6544cb8..8efdffd 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -40,6 +40,7 @@ end windows_flag = Sys.iswindows() apple_flag = Sys.isapple() +apple_silicon_flag = apple_flag && Sys.ARCH === :aarch64 file_extension = nothing obj_files = [] ignore_jll = read_env("ODEINTERFACE_IGNORE_JLL") != nothing @@ -440,14 +441,14 @@ if build_script != nothing create_build_script() else # to build or not-to-build? - if VERSION >= v"1.3" && !ignore_jll + if VERSION >= v"1.3" && !ignore_jll && !apple_silicon_flag # Julia supports Artifacts and we don't build anything and we try # to use ODEInterface_jll exit() else - # either Julia version before v1.3 or we were asked to ignore - # ODEInterface_jll - # => in both cases we try to build: + # either Julia version is older than v1.3, we were asked to ignore + # ODEInterface_jll or we are on AppleSilicon + # => in all cases we try to build: adapt_to_os() build_with_gfortran() end diff --git a/src/DLSolvers.jl b/src/DLSolvers.jl index 6bca7d1..7c2ea29 100644 --- a/src/DLSolvers.jl +++ b/src/DLSolvers.jl @@ -159,7 +159,8 @@ function loadODESolvers(extrapaths::Vector=AbstractString[], if isempty(extrapaths) extrapaths = [ @__DIR__ ] end - use_jll = VERSION >= v"1.3" && !ignore_jll + apple_silicon = Sys.isapple() && Sys.ARCH === :aarch64 + use_jll = VERSION >= v"1.3" && !ignore_jll && !apple_silicon if use_jll @eval ODEInterface begin using ODEInterface_jll From 360f47c2641958116b1fa516ddb94186f695b7ff Mon Sep 17 00:00:00 2001 From: Lucas Aschenbach Date: Fri, 27 Jan 2023 20:04:32 +0100 Subject: [PATCH 2/2] Automatically run loadODESolvers() when loading package --- src/ODEInterface.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ODEInterface.jl b/src/ODEInterface.jl index 3cc85b8..0df0d84 100644 --- a/src/ODEInterface.jl +++ b/src/ODEInterface.jl @@ -597,6 +597,7 @@ function __init__() # at this stage dlSolversInfo should be empty, but # just to be sure empty!(dlSolversInfo) + loadODESolvers() end