소스 검색

token: add new package (#8124)

choyy 3 일 전
부모
커밋
62902cd303
1개의 변경된 파일37개의 추가작업 그리고 0개의 파일을 삭제
  1. 37 0
      packages/t/token/xmake.lua

+ 37 - 0
packages/t/token/xmake.lua

@@ -0,0 +1,37 @@
+package("token")
+    set_homepage("https://gitlab.kitware.com/utils/token")
+    set_description("Utilities for string tokenization. Tokens (string hashes) can be used in place of the strings themselves for fast dictionary key lookup in the place of length string comparators and improve security when used carefully to avoid unnecessary string processing.")
+    set_license("BSD-3-Clause")
+
+    add_urls("https://gitlab.kitware.com/utils/token.git")
+    add_versions("24.09.0", "24.09")
+
+    add_deps("cmake")
+    add_deps("nlohmann_json", {configs = {cmake = true}})
+
+    on_load(function (package)
+        package:add("includedirs", "include/token/" .. package:version())
+    end)
+
+    on_install("windows", "linux", "bsd", "macosx", function (package)
+        io.replace("token/CMakeLists.txt", "foreach (class ${classes})", [[
+                    install(FILES "${CMAKE_CURRENT_BINARY_DIR}/CxxABIConfigure.h"
+                            DESTINATION include/token/${token_VERSION}/token)
+                    foreach (class ${classes})]], {plain = true})
+        local configs = {
+            "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"),
+            "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"),
+        }
+        import("package.tools.cmake").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            #include <token/Token.h>
+            #include <token/Manager.h>
+            void test() {
+                std::shared_ptr<token::Manager> manager(new token::Manager);
+                auto h = manager->manage("fooset");
+            }
+        ]]}, {configs = {languages = "c++11"}}))
+    end)