Skip to content

Commit 6004e60

Browse files
simdjson: update to v4.6.6 (#10239)
* simdjson: update to v4.6.4 * Update simdjson version to 4.6.6 * Add SIMDJSON_VISUAL_STUDIO define for Windows builds * Add SIMDJSON_VISUAL_STUDIO define for Windows builds * Add build configuration options for simdjson --------- Co-authored-by: Saikari <lin@sz.cn.eu.org>
1 parent 44e8ce1 commit 6004e60

2 files changed

Lines changed: 38 additions & 15 deletions

File tree

packages/s/simdjson/port/xmake.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ target("simdjson")
2323
set_languages("c++17")
2424
set_kind("$(kind)")
2525
if is_plat("windows") and is_kind("shared") then
26-
add_defines("SIMDJSON_BUILDING_WINDOWS_DYNAMIC_LIBRARY")
26+
add_defines("SIMDJSON_VISUAL_STUDIO", "SIMDJSON_BUILDING_WINDOWS_DYNAMIC_LIBRARY")
2727
end
2828
add_options("threads", "noexceptions", "logging")
2929
add_files("singleheader/simdjson.cpp")

packages/s/simdjson/xmake.lua

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package("simdjson")
2-
32
set_homepage("https://simdjson.org")
43
set_description("Ridiculously fast JSON parsing, UTF-8 validation and JSON minifying for popular 64 bit systems.")
54
set_license("Apache-2.0")
65

76
add_urls("https://github.com/simdjson/simdjson/archive/refs/tags/$(version).tar.gz",
87
"https://github.com/simdjson/simdjson.git")
8+
add_versions("v4.6.6", "1cd4c4c18263d2ae1f0cd5d4ba8b14e679b5a419ca15988a0da4cf43c514f28d")
99
add_versions("v4.2.4", "6f942d018561a6c30838651a386a17e6e4abbfc396afd0f62740dea1810dedea")
1010
add_versions("v4.2.2", "3efae22cb41f83299fe0b2e8a187af543d3dda93abbb910586f897df670f9eaa")
1111
add_versions("v4.2.1", "72c60a0fa6871073a4a458e80947dd75894fa1ff69550c7c77f9f4e695dff7f1")
@@ -37,24 +37,47 @@ package("simdjson")
3737
add_configs("threads", { description = "Enable threads.", default = true, type = "boolean"})
3838
add_configs("noexceptions", { description = "Disable exceptions.", default = false, type = "boolean"})
3939
add_configs("logging", { description = "Enable logging.", default = false, type = "boolean"})
40+
add_configs("build", { description = "Buildsystem to build simdjson.", type = "string", values = {"cmake", "xmake"}})
4041

41-
on_load("windows|x64", function (package)
42-
if package:config("shared") then
43-
package:add("defines", "SIMDJSON_USING_WINDOWS_DYNAMIC_LIBRARY")
42+
on_load(function (package)
43+
if package:config("build") == nil then
44+
if package:gitref() or (package:version() and package:version():ge("4.6.6")) then
45+
package:config_set("build", "cmake")
46+
package:add("deps", "cmake")
47+
else
48+
package:config_set("build", "xmake")
49+
end
50+
end
51+
if package:is_plat("windows") and package:config("shared") then
52+
package:add("defines", "SIMDJSON_VISUAL_STUDIO", "SIMDJSON_USING_WINDOWS_DYNAMIC_LIBRARY")
4453
end
4554
end)
4655

47-
on_install("windows|x64", "mingw|x86_64", "macosx|x86_64", "macosx|arm64", "linux|x86_64", "linux|arm64", "iphoneos|arm64", function(package)
48-
local configs = {}
49-
if package:config("shared") then
50-
configs.kind = "shared"
51-
end
52-
configs.threads = package:config("threads")
53-
configs.noexceptions = package:config("noexceptions")
54-
configs.logging = package:config("logging")
56+
on_install(function(package)
57+
if package:config("build") == "cmake" then
58+
local configs = {}
59+
table.insert(configs, "-DSIMDJSON_JUST_LIBRARY=ON")
60+
table.insert(configs, "-DSIMDJSON_SANITIZE_UNDEFINED=OFF")
61+
table.insert(configs, "-DSIMDJSON_SANITIZE=OFF")
62+
table.insert(configs, "-DSIMDJSON_SANITIZE_THREADS=OFF")
63+
table.insert(configs, "-DSIMDJSON_BUILD_STATIC=" .. (package:config("shared") and "OFF" or "ON"))
64+
table.insert(configs, "-DSIMDJSON_DEVELOPMENT_CHECKS=OFF")
65+
table.insert(configs, "-DSIMDJSON_VERBOSE_LOGGING=" .. (package:config("logging") and "ON" or "OFF"))
66+
table.insert(configs, "-DSIMDJSON_EXCEPTIONS=" .. (package:config("noexceptions") and "OFF" or "ON"))
67+
table.insert(configs, "-DSIMDJSON_ENABLE_THREADS=" .. (package:config("threads") and "ON" or "OFF"))
68+
import("package.tools.cmake").install(package, configs)
69+
else
70+
local configs = {}
71+
if package:config("shared") then
72+
configs.kind = "shared"
73+
end
74+
configs.threads = package:config("threads")
75+
configs.noexceptions = package:config("noexceptions")
76+
configs.logging = package:config("logging")
5577

56-
os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
57-
import("package.tools.xmake").install(package, configs)
78+
os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
79+
import("package.tools.xmake").install(package, configs)
80+
end
5881
end)
5982

6083
on_test(function(package)

0 commit comments

Comments
 (0)