Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update scotch #5044

Merged
merged 3 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/macos_arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@ jobs:
run: |
wget https://curl.haxx.se/ca/cacert.pem -O /tmp/cacert.pem
export CURL_CA_BUNDLE=/tmp/cacert.pem
sudo ln /opt/homebrew/bin/gfortran-14 /opt/homebrew/bin/gfortran
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

后面可以看看吧 gcc/gfortran 也整进来,这里先备着 #5069

export PATH="$PATH:/opt/homebrew/Cellar/gcc/14.1.0_2/libexec/gcc/aarch64-apple-darwin23/14/"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这是解决啥问题?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

github action提供的macos container自带了gcc-12、gcc-13、gcc-14,但(可能是为了避免冲突)都没有加入PATH,并且可执行文件名字是gfortran-14而不是gfortran,这会导致cmake探测不到。所以这里把gfortran相关处理了一下,使得自带gfortran和正常安装的gfortran一致

xmake l ./scripts/test.lua -D -a ${{ matrix.arch }} -k ${{ matrix.kind }}
2 changes: 2 additions & 0 deletions .github/workflows/macos_x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@ jobs:
run: |
wget https://curl.haxx.se/ca/cacert.pem -O /tmp/cacert.pem
export CURL_CA_BUNDLE=/tmp/cacert.pem
sudo ln /usr/local/bin/gfortran-14 /usr/local/bin/gfortran
export PATH="$PATH:/usr/local/Cellar/gcc/14.1.0_2/libexec/gcc/x86_64-apple-darwin21/14/"
xmake l ./scripts/test.lua -D -a ${{ matrix.arch }} -k ${{ matrix.kind }}
95 changes: 67 additions & 28 deletions packages/s/scotch/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,82 @@ package("scotch")
add_urls("https://gitlab.inria.fr/scotch/scotch/-/archive/$(version)/scotch-$(version).zip",
"https://gitlab.inria.fr/scotch/scotch.git")
add_versions("v6.1.1", "21d001c390ec63ac60f987b9921f33cc1967b41cf07567e22cbf3253cda8962a")
add_versions("v7.0.5", "fd52e97844115dce069220bacbfb45fccdf83d425614b02b67b44cedf9d72640")

add_configs("zlib", {description = "Use ZLIB compression format.", default = true, type = "boolean"})
add_configs("lzma", {description = "Use LZMA compression format.", default = false, type = "boolean"})
add_configs("bz2", {description = "Use BZ2 compression format.", default = false, type = "boolean"})

add_deps("zlib")
if is_plat("linux") then
add_syslinks("pthread")
end
add_links("esmumps", "scotch", "scotcherr", "scotcherrexit", "scotchmetis")
on_install("macosx|x86_64", "linux", function (package)
os.cd("src")
if package:is_plat("macosx") then
os.cp("Make.inc/Makefile.inc.i686_mac_darwin10", "Makefile.inc")
elseif package:is_plat("linux") then
local basename
if package:is_arch("x86_64") then
basename = "Make.inc/Makefile.inc.x86-64_pc_linux2"
elseif package:is_arch("i386", "x86") then
basename = "Make.inc/Makefile.inc.i686_pc_linux2"
add_links("ptesmumps", "esmumps", "scotch", "scotcherr", "scotcherrexit", "scotchmetis", "scotchmetisv5", "scotchmetisv3")
on_load(function (package)
if package:version():ge("7.0.0") then
package:add("deps", "cmake")
package:add("deps", "flex", "bison")
package:add("deps", "gfortran", {kind = "binary"})
if package:config("zlib") then
package:add("deps", "zlib")
end
if package:config("lzma") then
package:add("deps", "xz")
end
os.cp(basename .. (package:config("shared") and ".shlib" or ""), "Makefile.inc")
if package:config("bz2") then
package:add("deps", "bzip2")
end
else
package:add("deps", "zlib")
end
io.replace("Makefile.inc", "CFLAGS%s+=", "CFLAGS := $(CFLAGS)")
io.replace("Makefile.inc", "LDFLAGS%s+=", "LDFLAGS := $(LDFLAGS)")
local envs = import("package.tools.make").buildenvs(package)
local zlib = package:dep("zlib"):fetch()
if zlib then
local cflags, ldflags
for _, includedir in ipairs(zlib.sysincludedirs or zlib.includedirs) do
cflags = (cflags or "") .. " -I" .. includedir
end)

on_install("macosx", "linux", function (package)
if package:version():ge("7.0.0") then
local configs = {"-DENABLE_TESTS=OFF", "-DBUILD_PTSCOTCH=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_ZLIB=" .. (package:config("zlib") and "ON" or "OFF"))
table.insert(configs, "-DUSE_LZMA=" .. (package:config("lzma") and "ON" or "OFF"))
table.insert(configs, "-DUSE_BZ2=" .. (package:config("bz2") and "ON" or "OFF"))
import("package.tools.cmake").install(package, configs)

elseif package:is_plat("macosx", "linux") then
import("package.tools.make")

os.cd("src")
if package:is_plat("macosx") then
os.cp("Make.inc/Makefile.inc.i686_mac_darwin10", "Makefile.inc")
elseif package:is_plat("linux") then
local basename
if package:is_arch("x86_64") then
basename = "Make.inc/Makefile.inc.x86-64_pc_linux2"
elseif package:is_arch("i386", "x86") then
basename = "Make.inc/Makefile.inc.i686_pc_linux2"
end
os.cp(basename .. (package:config("shared") and ".shlib" or ""), "Makefile.inc")
end
for _, linkdir in ipairs(zlib.linkdirs) do
ldflags = (ldflags or "") .. " -L" .. linkdir
io.replace("Makefile.inc", "CFLAGS%s+=", "CFLAGS := $(CFLAGS)")
io.replace("Makefile.inc", "LDFLAGS%s+=", "LDFLAGS := $(LDFLAGS)")
local envs = make.buildenvs(package)
local zlib = package:dep("zlib"):fetch()
if zlib then
local cflags, ldflags
for _, includedir in ipairs(zlib.sysincludedirs or zlib.includedirs) do
cflags = (cflags or "") .. " -I" .. includedir
end
for _, linkdir in ipairs(zlib.linkdirs) do
ldflags = (ldflags or "") .. " -L" .. linkdir
end
envs.CFLAGS = cflags
envs.LDFLAGS = ldflags
end
envs.CFLAGS = cflags
envs.LDFLAGS = ldflags
make.make(package, {"scotch"}, {envs = envs})
make.make(package, {"esmumps"}, {envs = envs})
make.make(package, {"prefix=" .. package:installdir(), "install"}, {envs = envs})

else
raise("Unsupported platform!")
end
os.vrunv("make", {"scotch"}, {envs = envs})
os.vrunv("make", {"esmumps"}, {envs = envs})
os.vrunv("make", {"prefix=" .. package:installdir(), "install"}, {envs = envs})
end)

on_test(function (package)
Expand Down
Loading