فهرست منبع

add tinygltf and gsl (#347)

* add tinygltf

* add gsl

* update libffi

* remove unused print

* improve downloading
Hoildkv 4 سال پیش
والد
کامیت
83e9c9ad47
3فایلهای تغییر یافته به همراه51 افزوده شده و 3 حذف شده
  1. 25 0
      packages/g/gsl/xmake.lua
  2. 4 3
      packages/l/libffi/xmake.lua
  3. 22 0
      packages/t/tinygltf/xmake.lua

+ 25 - 0
packages/g/gsl/xmake.lua

@@ -0,0 +1,25 @@
+package("gsl")
+
+    set_homepage("https://github.com/microsoft/GSL")
+    set_description("Guidelines Support Library")
+    set_license("MIT")
+
+    add_urls("https://github.com/microsoft/GSL/archive/$(version).tar.gz",
+             "https://github.com/microsoft/GSL.git")
+    add_versions("v3.1.0", "d3234d7f94cea4389e3ca70619b82e8fb4c2f33bb3a070799f1e18eef500a083")
+
+    on_install(function (package)
+        os.mv("include/gsl", package:installdir("include"))
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            #include <vector>
+            #include <type_traits>
+            void test() {
+                std::vector<int> v{1,2,3,4};
+                gsl::span sp{v};
+                static_assert(std::is_same<decltype(sp), gsl::span<int>>::value);
+            }
+        ]]}, {configs = {languages = "c++17"}, includes = "gsl/span"}))
+    end)

+ 4 - 3
packages/l/libffi/xmake.lua

@@ -4,14 +4,15 @@ package("libffi")
     set_description("Portable Foreign Function Interface library.")
 
     set_urls("https://sourceware.org/pub/libffi/libffi-$(version).tar.gz",
-             "https://deb.debian.org/debian/pool/main/libf/libffi/libffi_$(version).orig.tar.gz",
-             "https://github.com/atgreen/libffi.git")
+             "https://github.com/libffi/libffi/releases/download/v$(version)/libffi-$(version).tar.gz",
+             "https://github.com/libffi/libffi.git")
     add_versions("3.2.1", "d06ebb8e1d9a22d19e38d63fdb83954253f39bedc5d46232a05645685722ca37")
+    add_versions("3.3", "72fba7922703ddfa7a028d513ac15a85c8d54c8d67f55fa5a4802885dc652056")
 
     on_load(function (package)
         if package:gitref() then
             package:add("deps", "autoconf", "automake", "libtool")
-        else
+        elseif package:version():le("3.2.1") then
             package:add("includedirs", "lib/libffi-" .. package:version_str() .. "/include")
         end
     end)

+ 22 - 0
packages/t/tinygltf/xmake.lua

@@ -0,0 +1,22 @@
+package("tinygltf")
+
+    set_homepage("https://github.com/syoyo/tinygltf/")
+    set_description("Header only C++11 tiny glTF 2.0 library")
+    set_license("MIT")
+
+    add_urls("https://github.com/syoyo/tinygltf/archive/refs/tags/$(version).tar.gz",
+             "https://github.com/syoyo/tinygltf.git")
+    add_versions("v2.5.0", "5d85bd556b60b1b69527189293cfa4902957d67fabb8582b6532f23a5ef27ec1")
+
+    add_deps("stb", "nlohmann_json")
+    on_install(function (package)
+        os.cp("tiny_gltf.h", package:installdir("include"))
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            void test() {
+                tinygltf::TinyGLTF loader;
+            }
+        ]]}, {configs = {languages = "c++14"}, includes = "tiny_gltf.h"}))
+    end)