Skip to content

Commit b52235f

Browse files
stemanngiordano
andauthored
Added SLEEF v3.4.0 (#4569)
* Added SLEEF v3.4.0 Using GCC v7.4 like Travis for sleef Added OpenSSL dependency Added MPFR dependency Added CompilerSupportLibraries dependency Native build required before cross-compilation Added additional library products libsleefdft libsleefquad Co-authored-by: Mosè Giordano <[email protected]> * Omitted libsleefgnuabi LibraryProduct to enable macos builds * Added lowercase-windows-include patch * Omitted libsleefdft LibraryProduct to enable x86_64-w64-mingw32 build * Fixed builds for armv6l and armv7l by applying a patch to avoid forcing arch. * Excluded i686-windows platform Co-authored-by: Mosè Giordano <[email protected]>
1 parent 8d4066a commit b52235f

File tree

3 files changed

+133
-0
lines changed

3 files changed

+133
-0
lines changed

S/SLEEF/build_tarballs.jl

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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 = "SLEEF"
6+
version = v"3.4.0"
7+
8+
# Collection of sources required to complete build
9+
sources = [
10+
GitSource("https://github.com/shibatch/sleef.git", "8df2bce4596ec6b86f357beebf2e428564f0a4ec"),
11+
DirectorySource("./bundled"),
12+
]
13+
14+
# Bash recipe for building across all platforms
15+
script = raw"""
16+
cd $WORKSPACE/srcdir/sleef
17+
mkdir build-native
18+
cd build-native
19+
cmake \
20+
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_HOST_TOOLCHAIN} \
21+
-G Ninja \
22+
-DBUILD_TESTS=OFF \
23+
-DBUILD_DFT=TRUE \
24+
-DBUILD_QUAD=TRUE \
25+
..
26+
ninja all
27+
28+
cd $WORKSPACE/srcdir/sleef
29+
if [[ $target == *w64-mingw32* ]]; then
30+
atomic_patch -p1 ../patches/lowercase-windows-include.patch
31+
elif [[ $target == arm-* ]]; then
32+
atomic_patch -p1 ../patches/arm-neon32vfpv4.patch
33+
fi
34+
mkdir build-cross
35+
cd build-cross
36+
cmake \
37+
-DCMAKE_INSTALL_PREFIX=$prefix \
38+
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \
39+
-DCMAKE_BUILD_TYPE=Release \
40+
-G Ninja \
41+
-DNATIVE_BUILD_DIR=$WORKSPACE/srcdir/sleef/build-native \
42+
-DSLEEF_SHOW_CONFIG=1 \
43+
-DBUILD_TESTS=OFF \
44+
-DBUILD_DFT=TRUE \
45+
-DBUILD_QUAD=TRUE \
46+
..
47+
ninja all
48+
ninja install
49+
"""
50+
51+
# These are the platforms we will build for by default, unless further
52+
# platforms are passed in on the command line
53+
platforms = supported_platforms()
54+
filter!(p -> !(arch(p) == "i686" && Sys.iswindows(p)), platforms) # i686-windows build fails
55+
56+
# The products that we will ensure are always built
57+
products = [
58+
LibraryProduct("libsleef", :libsleef),
59+
LibraryProduct("libsleefquad", :libsleefquad),
60+
]
61+
62+
# Dependencies that must be installed before this package can be built
63+
dependencies = [
64+
Dependency(PackageSpec(name="CompilerSupportLibraries_jll", uuid="e66e0078-7015-5450-92f7-15fbd957f2ae")),
65+
Dependency("MPFR_jll"),
66+
Dependency("OpenSSL_jll"),
67+
]
68+
69+
# Build the tarballs, and possibly a `build.jl` as well.
70+
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies;
71+
preferred_gcc_version=v"7.4",
72+
julia_compat="1.6")
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
diff --git a/Configure.cmake b/Configure.cmake
2+
index 25fc675..0cde1ef 100644
3+
--- a/Configure.cmake
4+
+++ b/Configure.cmake
5+
@@ -52,7 +52,7 @@ endif()
6+
set(SLEEF_SUPPORTED_EXTENSIONS
7+
AVX512F AVX512FNOFMA AVX2 AVX2128 FMA4 AVX SSE4 SSE2 # x86
8+
ADVSIMD ADVSIMDNOFMA SVE SVENOFMA # Aarch64
9+
- NEON32 NEON32VFPV4 # Aarch32
10+
+ NEON32 # Aarch32
11+
VSX VSXNOFMA # PPC64
12+
PUREC_SCALAR PURECFMA_SCALAR # Generic type
13+
CACHE STRING "List of SIMD architectures supported by libsleef."
14+
@@ -158,18 +158,15 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
15+
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm")
16+
set(SLEEF_ARCH_AARCH32 ON CACHE INTERNAL "True for Aarch32 architecture.")
17+
set(COMPILER_SUPPORTS_NEON32 1)
18+
- set(COMPILER_SUPPORTS_NEON32VFPV4 1)
19+
20+
set(SLEEF_HEADER_LIST
21+
NEON32_
22+
NEON32
23+
- NEON32VFPV4
24+
PUREC_SCALAR
25+
PURECFMA_SCALAR
26+
)
27+
command_arguments(HEADER_PARAMS_NEON32_ cinz_ 2 4 - float32x4_t int32x2_t int32x4_t __ARM_NEON__)
28+
command_arguments(HEADER_PARAMS_NEON32 cinz_ 2 4 - float32x4_t int32x2_t int32x4_t __ARM_NEON__ neon)
29+
- command_arguments(HEADER_PARAMS_NEON32VFPV4 finz_ 2 4 - float32x4_t int32x2_t int32x4_t __ARM_NEON__ neonvfpv4)
30+
31+
command_arguments(ALIAS_PARAMS_NEON32_SP -4 float32x4_t int32x4_t - neon)
32+
command_arguments(ALIAS_PARAMS_NEON32_DP 0)
33+
@@ -223,7 +220,6 @@ command_arguments(RENAME_PARAMS_AVX512FNOFMA cinz_ 8 16 avx512fnofma)
34+
command_arguments(RENAME_PARAMS_ADVSIMD finz_ 2 4 advsimd)
35+
command_arguments(RENAME_PARAMS_ADVSIMDNOFMA cinz_ 2 4 advsimdnofma)
36+
command_arguments(RENAME_PARAMS_NEON32 cinz_ 2 4 neon)
37+
-command_arguments(RENAME_PARAMS_NEON32VFPV4 finz_ 2 4 neonvfpv4)
38+
command_arguments(RENAME_PARAMS_VSX finz_ 2 4 vsx)
39+
command_arguments(RENAME_PARAMS_VSXNOFMA cinz_ 2 4 vsxnofma)
40+
command_arguments(RENAME_PARAMS_PUREC_SCALAR cinz_ 1 1 purec)
41+
@@ -275,7 +271,6 @@ set(CLANG_FLAGS_ENABLE_AVX2128 "-mavx2;-mfma")
42+
set(CLANG_FLAGS_ENABLE_AVX512F "-mavx512f")
43+
set(CLANG_FLAGS_ENABLE_AVX512FNOFMA "-mavx512f")
44+
set(CLANG_FLAGS_ENABLE_NEON32 "--target=arm-linux-gnueabihf;-mcpu=cortex-a8")
45+
-set(CLANG_FLAGS_ENABLE_NEON32VFPV4 "-march=armv7-a;-mfpu=neon-vfpv4")
46+
# Arm AArch64 vector extensions.
47+
set(CLANG_FLAGS_ENABLE_SVE "-march=armv8-a+sve")
48+
set(CLANG_FLAGS_ENABLE_SVENOFMA "-march=armv8-a+sve")
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/src/common/arraymap.c b/src/common/arraymap.c
2+
index 43d4491..f47b932 100644
3+
--- a/src/common/arraymap.c
4+
+++ b/src/common/arraymap.c
5+
@@ -27,7 +27,7 @@ static void FTRUNCATE(FILE *fp, off_t z) {
6+
static FILE *OPENTMPFILE() { return tmpfile(); }
7+
static void CLOSETMPFILE(FILE *fp) { fclose(fp); }
8+
#else
9+
-#include <Windows.h>
10+
+#include <windows.h>
11+
12+
static void FLOCK(FILE *fp) { }
13+
static void FUNLOCK(FILE *fp) { }

0 commit comments

Comments
 (0)