|
1 | 1 | package("simdjson") |
2 | | - |
3 | 2 | set_homepage("https://simdjson.org") |
4 | 3 | set_description("Ridiculously fast JSON parsing, UTF-8 validation and JSON minifying for popular 64 bit systems.") |
5 | 4 | set_license("Apache-2.0") |
6 | 5 |
|
7 | 6 | add_urls("https://github.com/simdjson/simdjson/archive/refs/tags/$(version).tar.gz", |
8 | 7 | "https://github.com/simdjson/simdjson.git") |
| 8 | + add_versions("v4.6.6", "1cd4c4c18263d2ae1f0cd5d4ba8b14e679b5a419ca15988a0da4cf43c514f28d") |
9 | 9 | add_versions("v4.2.4", "6f942d018561a6c30838651a386a17e6e4abbfc396afd0f62740dea1810dedea") |
10 | 10 | add_versions("v4.2.2", "3efae22cb41f83299fe0b2e8a187af543d3dda93abbb910586f897df670f9eaa") |
11 | 11 | add_versions("v4.2.1", "72c60a0fa6871073a4a458e80947dd75894fa1ff69550c7c77f9f4e695dff7f1") |
@@ -37,24 +37,47 @@ package("simdjson") |
37 | 37 | add_configs("threads", { description = "Enable threads.", default = true, type = "boolean"}) |
38 | 38 | add_configs("noexceptions", { description = "Disable exceptions.", default = false, type = "boolean"}) |
39 | 39 | add_configs("logging", { description = "Enable logging.", default = false, type = "boolean"}) |
| 40 | + add_configs("build", { description = "Buildsystem to build simdjson.", type = "string", values = {"cmake", "xmake"}}) |
40 | 41 |
|
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") |
44 | 53 | end |
45 | 54 | end) |
46 | 55 |
|
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") |
55 | 77 |
|
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 |
58 | 81 | end) |
59 | 82 |
|
60 | 83 | on_test(function(package) |
|
0 commit comments