Jelajahi Sumber

Fast float wasm (#1386)

* fast_float: fix wasm support

* Fix parenthesis

* Add v3.5.0

* Remove v3.5.0
Jérôme Leclercq 3 tahun lalu
induk
melakukan
b423793aea

+ 20 - 0
packages/f/fast_float/patches/emscripten_fix.patch

@@ -0,0 +1,20 @@
+diff --git a/include/fast_float/float_common.h b/include/fast_float/float_common.h
+index 9374cdf..90f082a 100644
+--- a/include/fast_float/float_common.h
++++ b/include/fast_float/float_common.h
+@@ -11,12 +11,12 @@
+        || defined(__amd64) || defined(__aarch64__) || defined(_M_ARM64) \
+        || defined(__MINGW64__)                                          \
+        || defined(__s390x__)                                            \
+-       || (defined(__ppc64__) || defined(__PPC64__) || defined(__ppc64le__) || defined(__PPC64LE__)) \
+-       || defined(__EMSCRIPTEN__))
++       || (defined(__ppc64__) || defined(__PPC64__) || defined(__ppc64le__) || defined(__PPC64LE__)))
+ #define FASTFLOAT_64BIT
+ #elif (defined(__i386) || defined(__i386__) || defined(_M_IX86)   \
+      || defined(__arm__) || defined(_M_ARM)                   \
+-     || defined(__MINGW32__))
++     || defined(__MINGW32__) \
++     || defined(__EMSCRIPTEN__))
+ #define FASTFLOAT_32BIT
+ #else
+   // Need to check incrementally, since SIZE_MAX is a size_t, avoid overflow.

+ 4 - 0
packages/f/fast_float/xmake.lua

@@ -8,6 +8,10 @@ package("fast_float")
              "https://github.com/fastfloat/fast_float.git")
     add_versions("v3.4.0", "a242877d2fae81ca412033f5ebf5dbc43cb029c56b4af78e33106b9a69f8f58e")
 
+    if is_plat("wasm") then
+        add_patches("v3.4.0", path.join(os.scriptdir(), "patches", "emscripten_fix.patch"), "482705431f67e6f0a375ed7bfe87d6856e7d13f071db6157e1d5659834b0eb50")
+    end
+
     on_install(function (package)
         os.vcp("include/fast_float", package:installdir("include"))
     end)