1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
package("mimalloc")
set_homepage("https://github.com/microsoft/mimalloc")
set_description("mimalloc (pronounced 'me-malloc') is a general purpose allocator with excellent performance characteristics.")
set_license("MIT")
set_urls("https://github.com/microsoft/mimalloc/archive/v$(version).zip")
add_versions("3.2.8", "63302742e911c8724c2bcc192aea51fc8921c7916ca8a68b037280d72126dfb5")
add_versions("3.2.7", "0200e80d51e18bab4776a0aaf74b99fcb16e106b816fd5dbde545c71cfc90e10")
add_versions("3.2.6", "320e9b91ea2f18536129633f01eff81de3e6ee40b07e519a70382b80aaef5ea6")
add_versions("3.1.6", "bedddb34e47447dde3aa7ddb5a1e2ec5d049f30449b3d97a3519e430df55d387")
add_versions("3.1.5", "3cf724ec469198f23505d157893331f9d062e982c38b2c92a7fb789d7ddb67d9")
add_versions("3.1.4", "fd6d79ed105c275f884e41fd7d2282377f9fe61591e7038024ab2c528f2b2d5f")
add_versions("3.0.12", "bebd1fc10b6c20398d578fc9d00d9f14716868668a4809187a51e66868596655")
add_versions("3.0.11", "32c067fad24285e5c8c0cceb7108f841b5902227e0314b285146cd1cc7092926")
add_versions("3.0.10", "a2b6925f83c536a287ef1ed2b9337377ea7dec6868a4e8b90509985d43cfb2f5")
add_versions("3.0.9", "fb5b9a6bc070bad1a96bea3ae77477d8ee7648f8ffb7cd7a3795de159a9718a6")
add_versions("3.0.8", "fcde151d6bb773b0b64af23c6199fe20ec45550c0bff39ffda80c623959d1788")
add_versions("3.0.7", "a4756650ef5807db912b6630dcb56831bf08bb23487a2168b176f989e7f35afd")
add_versions("3.0.3", "08a917e331164cd77052377f1e6d86de7febc8663dc117648319e662c0d4e6a4")
add_versions("3.0.1", "cf19cd180c1768b9ef9ee18e8ba8551f1992ec1b7c71f15344e42a62b0e0a338")
add_versions("2.2.7", "bf59bd7166cc56fc102107360404ad3add35014ed0a2505e4e36f269ea3e3418")
add_versions("2.2.6", "60935f5a7fcb2bc84517c6efa5644dcc4b7e8ab48573bc9eac86034e2593ff06")
add_versions("2.2.4", "664667a48c9f101d979bbe4e41ee631da49d2024e30d66b7779b6ba4279af367")
add_versions("2.2.3", "35fa4a4c094bb97571378192f82b78d65b6322ad7f3c6b0ad272058fa829d28c")
add_versions("2.2.2", "76878acd96650ae1343ec66373cc1b4ebe8523175560226f5291b73a4e575f94")
add_versions("2.1.9", "efc9531e88bf64403dd4955131ad5d0d24c0ff63be6561344dff77e1bcebcc78")
add_versions("2.1.8", "538b63ba0d43c184cfaac9ffef10455ae809c3560a59750dc667fc62e784c0d5")
add_versions("2.1.7", "fa61cf01e3dd869b35275bfd8be95bfde77f0b65dfa7e34012c09a66e1ea463f")
add_versions("2.1.6", "a1a775563e90b447569191c2c060b81f9a771e6d5f857adc17a7e9eb9d5c1215")
add_versions("2.1.5", "7f013cc4f848fe19d146629c2fc94c9e82119eddc85ee2c032bcb003361654f0")
add_versions("2.1.4", "41aa2f6ca7d60b41d0ed1644a4ab437a2233ca40115e36b41a1ebe07b7d58854")
add_versions("2.1.2", "86281c918921c1007945a8a31e5ad6ae9af77e510abfec20d000dd05d15123c7")
add_versions("2.0.7", "ddb32937aabddedd0d3a57bf68158d4e53ecf9e051618df3331a67182b8b0508")
add_versions("2.0.6", "23e7443d0b4d7aa945779ea8a806e4e109c0ed62d740953d3656cddea7e04cf8")
add_versions("2.0.5", "e8d4e031123e82081325a5131ac57d954f5123b6a13653a6d984cbc3b8488bd9")
add_versions("2.0.3", "8e5f0b74fdafab09e8853415700a9ade4d62d5f56cd43f54adf02580ceda86c1")
add_versions("2.0.2", "6ccba822e251b8d10f8a63d5d7767bc0cbfae689756a4047cdf3d1e4a9fd33d0")
add_versions("2.0.1", "59c1fe79933e0ac9837a9ca4d954e4887dccd80a84281a6f849681b89a8b8876")
add_versions("1.7.7", "d51a5b8f3bc6800a0b2fc46830ce67b4d31b12f4e4550ff80cf394d5a88fead8")
add_versions("1.7.6", "bae56f8ebdcd43da83b52610d7f1c1602ea8d3798d906825defa5c40ad2eb560")
add_versions("1.7.3", "8319eca4a114dce5f897a4cb7d945bce22d915b4b262adb861cd7ac68fa3e848")
add_versions("1.7.2", "2c432e44803d9f4f017323be705f194db5d1452f9a60e38896605e7cfe8b332f")
add_versions("1.7.1", "dc3219066b4fd50c7f23d60c13fa15ae269a2b10b7dd45b046d5c52c9addb477")
add_versions("1.7.0", "13f3c82bca3a95233c5e29adb5675ab2b772f0ade23184d822079578c9d6c698")
add_versions("1.6.7", "5a12aac020650876615a2ce3dd8adc8b208cdcee4d9e6bcfc33b3fbe307f0dbf")
add_configs("secure", {description = "Use a secured version of mimalloc", default = false, type = "boolean"})
add_configs("rltgenrandom", {description = "Use a RtlGenRandom instead of BCrypt", default = false, type = "boolean"})
add_configs("embed_debug_info", {description = "Use /Z7 to embed debug info for linker merging", default = true, type = "boolean"})
add_deps("cmake")
if is_plat("windows") then
add_syslinks("advapi32", "bcrypt")
elseif is_plat("linux") then
add_syslinks("pthread")
elseif is_plat("android") then
add_syslinks("atomic")
end
on_install("macosx", "windows", "linux", "android", "mingw", function (package)
local configs = {"-DMI_OVERRIDE=OFF", "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release")}
table.insert(configs, "-DMI_BUILD_STATIC=" .. (package:config("shared") and "OFF" or "ON"))
table.insert(configs, "-DMI_BUILD_SHARED=" .. (package:config("shared") and "ON" or "OFF"))
table.insert(configs, "-DMI_SECURE=" .. (package:config("secure") and "ON" or "OFF"))
table.insert(configs, "-DMI_BUILD_TESTS=OFF")
table.insert(configs, "-DMI_BUILD_OBJECT=OFF")
--x64:mimalloc-redirect.lib/dll x86:mimalloc-redirect32.lib/dll
if package:version():le("2.0.1") and package:config("shared") and package:is_plat("windows") and package:is_arch("x86") then
io.replace("CMakeLists.txt", "-redirect.", "-redirect32.", {plain = true})
end
local cxflags = {}
if package:config("rltgenrandom") then
table.insert(cxflags, "-DMI_USE_RTLGENRANDOM")
end
-- Use /Z7 on Windows so debug info is embedded in the .obj files and
-- merged into the final PDB by the linker, rather than living in a
-- separate PDB in the xmake package cache.
if package:is_plat("windows") and package:config("embed_debug_info") then
table.insert(cxflags, "/Z7")
end
import("package.tools.cmake").build(package, configs, {buildir = "build", cxflags = #cxflags > 0 and table.concat(cxflags, " ") or nil})
if package:is_plat("windows") then
os.trycp("build/**.dll", package:installdir("bin"))
os.trycp("build/**.lib", package:installdir("lib"))
elseif package:is_plat("mingw") then
os.trycp("build/**.dll", package:installdir("bin"))
os.trycp("build/**.a", package:installdir("lib"))
else
os.trycp("build/*.so", package:installdir("bin"))
os.trycp("build/*.so", package:installdir("lib"))
os.trycp("build/*.a", package:installdir("lib"))
end
os.cp("include", package:installdir())
end)
on_test(function (package)
if not package:is_cross() then
assert(package:has_cfuncs("mi_malloc", {includes = "mimalloc.h"}))
end
end)
|