paul-reilly 4 år sedan
förälder
incheckning
f646b1e8cb
2 ändrade filer med 61 tillägg och 0 borttagningar
  1. 28 0
      packages/s/simdjson/port/xmake.lua
  2. 33 0
      packages/s/simdjson/xmake.lua

+ 28 - 0
packages/s/simdjson/port/xmake.lua

@@ -0,0 +1,28 @@
+add_rules("mode.debug", "mode.release")
+
+option("threads")
+    set_default(true)
+    set_showmenu(true)
+    add_defines("SIMDJSON_THREADS_ENABLE")
+    if not is_plat("windows") then 
+        add_syslinks("pthread")
+    end
+
+option("noexceptions")
+    set_default(false)
+    set_showmenu(true)
+    add_defines("SIMDJSON_EXCEPTIONS=0")
+
+option("logging")
+    set_default(false)
+    set_showmenu(true)
+    add_defines("SIMDJSON_VERBOSE_LOGGING")
+
+
+target("simdjson")   
+    set_languages("c++17")
+    set_kind("$(kind)")
+    add_options("threads", "noexceptions", "logging")
+    add_files("singleheader/simdjson.cpp")
+    add_headerfiles("singleheader/simdjson.h")
+    

+ 33 - 0
packages/s/simdjson/xmake.lua

@@ -0,0 +1,33 @@
+package("simdjson")
+
+    set_homepage("https://simdjson.org")
+    set_license("Apache 2.0")
+    set_description("Ridiculously fast JSON parsing, UTF-8 validation and JSON minifying for popular 64 bit systems.")
+
+    set_urls("https://github.com/simdjson/simdjson.git")
+    add_versions("0.8.2", "61c8cfa07deb7625bb0e6b80dbceb42edd4bf387")
+
+    add_configs("threads",      { description = "Enable threads.",     default = true,  type = "boolean"})
+    add_configs("noexceptions", { description = "Disable exceptions.", default = false, type = "boolean"})
+    add_configs("logging",      { description = "Enable logging.",     default = false, type = "boolean"})
+    
+    on_install("windows|x64", "mingw|x86_64", "macosx|x86_64", "linux|x86_64", "linux|arm64", "iphoneos|arm64", function(package)
+        local configs = {}
+        if package:config("shared") then
+            configs.kind = "shared"
+        end
+        configs.threads = package:config("threads")
+        configs.noexceptions = package:config("noexceptions")
+        configs.logging = package:config("logging")
+
+        os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
+        import("package.tools.xmake").install(package, configs)
+    end)
+
+    on_test(function(package)
+        assert(package:check_cxxsnippets({ test = [[
+                simdjson::dom::parser parser;
+        ]]}, { configs = { languages = "c++17" }, includes = "simdjson.h" })
+        , "Could not compile a test C++ snippet.")
+    end)
+