@@ -6,6 +6,7 @@ package("snmalloc")
66 add_urls (" https://github.com/microsoft/snmalloc/archive/refs/tags/$(version).tar.gz" ,
77 " https://github.com/microsoft/snmalloc.git" )
88
9+ add_versions (" 0.7.3" , " a908b604a77213169b526ab96a64a79c222a03a41a87f13ac00adfeff379f0be" )
910 add_versions (" 0.7.1" , " 91824fdf553f03cf6ef8be57f29f1d4f79cd651667455e9fe4af8b7c09e705d3" )
1011 add_versions (" 0.7.0" , " 9e6bd04e58d981218bd5bd3a853d93bbcb1a82dd914f912670f798e011e86746" )
1112 add_versions (" 0.6.2" , " e0486ccf03eac5dd8acbb66ea8ad33bec289572a51614acdf7117397e4f1af8c" )
@@ -25,6 +26,16 @@ package("snmalloc")
2526 add_syslinks (" pthread" )
2627 end
2728
29+ if on_check then
30+ on_check (" android" , function (package )
31+ if package :version () and package :version ():ge (" 0.7.2" ) then
32+ local ndk = package :toolchain (" ndk" )
33+ local ndk_sdkver = ndk :config (" ndk_sdkver" )
34+ assert (ndk_sdkver and tonumber (ndk_sdkver ) > 21 , " package(snmalloc) require ndk api level > 21" )
35+ end
36+ end )
37+ end
38+
2839 on_load (function (package )
2940 if package :config (" header_only" ) then
3041 package :set (" kind" , " library" , {headeronly = true })
@@ -34,6 +45,14 @@ package("snmalloc")
3445
3546 on_install (" !wasm and !iphoneos" , function (package )
3647 io .replace (" CMakeLists.txt" , " -Werror" , " " , {plain = true })
48+ io .replace (" CMakeLists.txt" , " /WX" , " " , {plain = true })
49+
50+ if os.isfile (" src/snmalloc/pal/pal_windows.h" ) and package :has_runtime (" MT" ) then
51+ -- duplicate symbol: public: static void * __cdecl snmalloc::PALWindows::reserve(unsigned __int64)
52+ io .replace (" src/snmalloc/pal/pal_windows.h" ,
53+ " static void* reserve(size_t size) noexcept;" ,
54+ " static inline void* reserve(size_t size) noexcept;" , {plain = true })
55+ end
3756
3857 local configs = {" -DSNMALLOC_BUILD_TESTING=OFF" }
3958 table.insert (configs , " -DCMAKE_BUILD_TYPE=" .. (package :is_debug () and " Debug" or " Release" ))
0 commit comments