Skip to content

Commit c3aeb98

Browse files
authored
Update sparrow to 1.0.0 (emscripten-forge#2591)
* Update sparrow to 1.0.0
1 parent 1a185b3 commit c3aeb98

3 files changed

Lines changed: 50 additions & 3 deletions

File tree

recipes/recipes_emscripten/sparrow/build.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,15 @@ emcmake cmake .. \
1616
-DBUILD_TESTS=OFF \
1717
-DBUILD_DOCS=OFF
1818

19-
# Build and install
19+
# Build step
20+
emmake make -j8
21+
22+
emcc bin/Release/libsparrow.a \
23+
$EM_FORGE_SIDE_MODULE_LDFLAGS \
24+
-o libsparrow.so
25+
26+
# Install step
2027
emmake make install -j8
28+
29+
# Manually install the shared library
30+
cp libsparrow.so "$PREFIX/lib/"
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
diff --git a/include/sparrow/details/3rdparty/float16_t.hpp b/include/sparrow/details/3rdparty/float16_t.hpp
2+
index 1e1c417..e6aec4c 100644
3+
--- a/include/sparrow/details/3rdparty/float16_t.hpp
4+
+++ b/include/sparrow/details/3rdparty/float16_t.hpp
5+
@@ -196,6 +196,30 @@
6+
#define FE_ALL_EXCEPT (FE_INVALID|FE_DIVBYZERO|FE_OVERFLOW|FE_UNDERFLOW|FE_INEXACT)
7+
#endif
8+
9+
+#ifdef __EMSCRIPTEN__
10+
+// Emscripten defines FE_ALL_EXCEPT as 0, which causes the fallback above to be skipped,
11+
+// but does not define the individual FE_* macros. So we patch them manually here.
12+
+
13+
+#ifndef FE_INEXACT
14+
+#define FE_INEXACT 0x02
15+
+#endif
16+
+#ifndef FE_INVALID
17+
+#define FE_INVALID 0x04
18+
+#endif
19+
+#ifndef FE_OVERFLOW
20+
+#define FE_OVERFLOW 0x08
21+
+#endif
22+
+#ifndef FE_UNDERFLOW
23+
+#define FE_UNDERFLOW 0x10
24+
+#endif
25+
+#ifndef FE_DIVBYZERO
26+
+#define FE_DIVBYZERO 0x01
27+
+#endif
28+
+#ifndef FE_ALL_EXCEPT
29+
+#define FE_ALL_EXCEPT (FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT)
30+
+#endif
31+
+#endif // __EMSCRIPTEN__
32+
+
33+
34+
/// Main namespace for half-precision functionality.
35+
/// This namespace contains all the functionality provided by the library.

recipes/recipes_emscripten/sparrow/recipe.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
context:
2-
version: 0.9.0
2+
version: 1.0.0
33

44
package:
55
name: sparrow
66
version: ${{ version }}
77

88
source:
99
url: https://github.com/man-group/sparrow/archive/${{ version }}.tar.gz
10-
sha256: f8bd0b19d5e76dc972385a4263e5db0cded63d326dfb0cd57c3ad9f2f6dea570
10+
sha256: 14199ae6416e4b6ed62419e4def6602a0d804c1d26ca0917d3818f06b9d33d6e
11+
patches:
12+
- patches/add-missing-fe-macros-emscripten.patch
1113

1214
build:
1315
number: 0

0 commit comments

Comments
 (0)