diff --git a/.github/workflows/macos_arm64.yml b/.github/workflows/macos_arm64.yml index e3f3af06f..145205477 100644 --- a/.github/workflows/macos_arm64.yml +++ b/.github/workflows/macos_arm64.yml @@ -33,4 +33,6 @@ jobs: sudo ln /opt/homebrew/bin/gfortran-14 /opt/homebrew/bin/gfortran find /opt/homebrew/Cellar/gcc/ -name f951 export PATH="$PATH:/opt/homebrew/Cellar/gcc/14.2.0/libexec/gcc/aarch64-apple-darwin23/14/" + export LIBRARY_PATH="$LIBRARY_PATH:/opt/homebrew/Cellar/gcc/14.2.0/lib/gcc/14/" + export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/opt/homebrew/Cellar/gcc/14.2.0/lib/gcc/14/" xmake l ./scripts/test.lua -D -a ${{ matrix.arch }} -k ${{ matrix.kind }} diff --git a/.github/workflows/macos_x86_64.yml b/.github/workflows/macos_x86_64.yml index 2e0657767..fc79b1ba3 100644 --- a/.github/workflows/macos_x86_64.yml +++ b/.github/workflows/macos_x86_64.yml @@ -33,4 +33,6 @@ jobs: sudo ln /usr/local/bin/gfortran-14 /usr/local/bin/gfortran find /usr/local/Cellar/gcc/ -name f951 export PATH="$PATH:/usr/local/Cellar/gcc/14.2.0/libexec/gcc/x86_64-apple-darwin21/14/" + export LIBRARY_PATH="$LIBRARY_PATH:/usr/local/Cellar/gcc/14.2.0/lib/gcc/14/" + export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/Cellar/gcc/14.2.0/lib/gcc/14/" xmake l ./scripts/test.lua -D -a ${{ matrix.arch }} -k ${{ matrix.kind }} diff --git a/packages/c/cminpack/xmake.lua b/packages/c/cminpack/xmake.lua index 194cc1d3c..43f2d87ab 100644 --- a/packages/c/cminpack/xmake.lua +++ b/packages/c/cminpack/xmake.lua @@ -2,12 +2,14 @@ package("cminpack") set_homepage("https://devernay.github.io/cminpack/") set_description("A C/C++ rewrite of the MINPACK software (originally in FORTRAN) for solving nonlinear equations and nonlinear least squares problems") - add_urls("https://github.com/devernay/cminpack/archive/$(version).tar.gz", + add_urls("https://github.com/devernay/cminpack/archive/refs/tags/$(version).tar.gz", "https://github.com/devernay/cminpack.git") - + add_versions("v1.3.11", "45675fac0a721a1c7600a91a9842fe1ab313069db163538f2923eaeddb0f46de") add_versions("v1.3.9", "aa37bac5b5caaa4f5805ea5c4240e3834c993672f6dab0b17190ee645e251c9f") - add_configs("blas", {description = "Compile cminpack using cblas library if possible", default = false, type = "boolean"}) + local support_openblas = is_plat("linux", "macosx") or (is_plat("windows") and is_arch("x86", "x64")) + add_configs("blas", {description = "BLAS library to compile with.", default = (support_openblas and "openblas" or nil), type = "string", values = {"openblas", "mkl", "apple"}}) + add_configs("long_double", {description = "Enable extended precision.", default = false, type = "boolean"}) if is_plat("linux") then add_syslinks("m") @@ -18,8 +20,8 @@ package("cminpack") add_deps("cmake") on_load(function (package) - if package:config("blas") then - package:add("deps", "openblas") + if package:config("blas") and not package:config("long_double") then + package:add("deps", package:config("blas")) end end) @@ -27,11 +29,23 @@ package("cminpack") if package:is_plat("windows", "mingw") and (not package:config("shared")) then package:add("defines", "CMINPACK_NO_DLL") end + if not package:config("long_double") then + io.replace("CMakeLists.txt", "${SIZEOF_LONG_DOUBLE} GREATER ${SIZEOF_DOUBLE}", "FALSE", {plain = true}) + end + local has_blas = package:config("blas") and not package:config("long_double") local configs = {"-DBUILD_EXAMPLES=OFF", "-DENABLE_TESTING=OFF"} table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release")) table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) - table.insert(configs, "-DUSE_BLAS=" .. (package:config("blas") and "ON" or "OFF")) + table.insert(configs, "-DUSE_BLAS=" .. (has_blas and "ON" or "OFF")) + if has_blas then + local bla_vendor = {mkl = "Intel10_64lp", openblas = "OpenBLAS", apple = "Apple"} + table.insert(configs, "-DBLA_VENDOR=" .. bla_vendor[package:config("blas")]) + if package:dep(package:config("blas")) then + local bla_static = not package:dep(package:config("blas")):config("shared") + table.insert(configs, "-DBLA_STATIC=" .. (bla_static and "ON" or "OFF")) + end + end import("package.tools.cmake").install(package, configs) end)