Skip to content

Commit ee65155

Browse files
[MFEM] Add sequential version (#4915)
* [Add MFEM] a lightweight, general, scalable C++ library for finite element methods * [MFEM] Clean cmake cmd Co-authored-by: Mosè Giordano <[email protected]> * [MFEM] try all platforms Co-authored-by: Mosè Giordano <[email protected]> * [MFEM] expand cxx string ABIs Co-authored-by: Mosè Giordano <[email protected]> * [MFEM] use GCC 5 MFEM 4 requires GCC 4.9 at least. * [MFEM] Add patch for building on Musl * [MFEM] use GCC v6 GCC 6 might be necessary for boolean enums Co-authored-by: Mosè Giordano <[email protected]> * [MFEM] move seq build in dedicated folder * [MFEM] try GCC v7 Co-authored-by: Mosè Giordano <[email protected]> * [MFEM] try GCC 8 Co-authored-by: Mosè Giordano <[email protected]>
1 parent 073ba6a commit ee65155

File tree

2 files changed

+92
-0
lines changed

2 files changed

+92
-0
lines changed

M/MFEM/MFEM_seq/build_tarballs.jl

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Note that this script can accept some limited command-line arguments, run
2+
# `julia build_tarballs.jl --help` to see a usage message.
3+
using BinaryBuilder, Pkg
4+
5+
name = "MFEM_seq"
6+
version = v"4.4.0"
7+
8+
# Collection of sources required to complete build
9+
sources = [
10+
GitSource("https://github.com/mfem/mfem.git",
11+
"a1f6902ed72552f3e680d1489f1aa6ade2e0d3b2"),
12+
DirectorySource("./bundled"),
13+
]
14+
15+
# Bash recipe for building across all platforms
16+
script = raw"""
17+
cd $WORKSPACE/srcdir/mfem*
18+
19+
# Backport https://github.com/mfem/mfem/pull/2995 to be able to compile with Musl
20+
atomic_patch -p1 ../patches/0001-use_overloaded_function_definitions_instead_of_unreliable_macros.diff
21+
22+
mkdir build; cd build
23+
cmake -DCMAKE_INSTALL_PREFIX=${prefix} \
24+
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \
25+
-DCMAKE_BUILD_TYPE=Release \
26+
-DBUILD_SHARED_LIBS=1 \
27+
..
28+
make -j${nproc}
29+
make install
30+
"""
31+
32+
# These are the platforms we will build for by default, unless further
33+
# platforms are passed in on the command line
34+
platforms = supported_platforms()
35+
platforms = expand_cxxstring_abis(platforms)
36+
37+
# The products that we will ensure are always built
38+
products = [
39+
LibraryProduct("libmfem", :libmfem)
40+
]
41+
42+
# Dependencies that must be installed before this package can be built
43+
dependencies = Dependency[
44+
]
45+
46+
# Build the tarballs, and possibly a `build.jl` as well.
47+
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; julia_compat="1.6", preferred_gcc_version=v"8")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
diff --git a/general/zstr.hpp b/general/zstr.hpp
2+
index 716aa19c3..f55e0cc56 100644
3+
--- a/general/zstr.hpp
4+
+++ b/general/zstr.hpp
5+
@@ -59,6 +59,18 @@
6+
namespace strict_fstream
7+
{
8+
9+
+// Overloaded error checks to handle POSIX and GNU strerror_r
10+
+inline char* check_strerror_r(int r, char* buff, int err)
11+
+{
12+
+ if (r) { sprintf(buff, "unknown error: %d", err); }
13+
+ return buff;
14+
+}
15+
+
16+
+inline char* check_strerror_r(char* r, char*, int)
17+
+{
18+
+ return r;
19+
+}
20+
+
21+
/// Overload of error-reporting function, to enable use with VS.
22+
/// Ref: http://stackoverflow.com/a/901316/717706
23+
static std::string strerror()
24+
@@ -69,18 +81,10 @@ static std::string strerror()
25+
{
26+
buff = "Unknown error";
27+
}
28+
-#elif (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE || \
29+
- defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \
30+
- defined(__NetBSD__) || defined(__DragonFly__) || defined(__EMSCRIPTEN__)
31+
- // XSI-compliant strerror_r()
32+
- if (strerror_r(errno, &buff[0], buff.size()) != 0)
33+
- {
34+
- buff = "Unknown error";
35+
- }
36+
#else
37+
- // GNU-specific strerror_r()
38+
- auto p = strerror_r(errno, &buff[0], buff.size());
39+
- std::string tmp(p, std::strlen(p));
40+
+ char* p = check_strerror_r(strerror_r(errno, &buff[0], buff.size()), &buff[0],
41+
+ buff.size());
42+
+ std::string tmp(p, std::strlen(&buff[0]));
43+
std::swap(buff, tmp);
44+
#endif
45+
buff.resize(buff.find('\0'));

0 commit comments

Comments
 (0)