Browse Source

add cpr 1.6.2 (#593)

* add cpr 1.6.2

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

Co-authored-by: ruki <[email protected]>
gajin2 4 năm trước cách đây
mục cha
commit
61692860f5
1 tập tin đã thay đổi với 32 bổ sung0 xóa
  1. 32 0
      packages/c/cpr/xmake.lua

+ 32 - 0
packages/c/cpr/xmake.lua

@@ -0,0 +1,32 @@
+package("cpr")
+
+    set_homepage("https://whoshuu.github.io/cpr/")
+    set_description("C++ Requests is a simple wrapper around libcurl inspired by the excellent Python Requests project.")
+
+    set_urls("https://github.com/whoshuu/cpr/archive/refs/tags/$(version).tar.gz",
+             "https://github.com/whoshuu/cpr.git")
+    add_versions("1.6.2", "c45f9c55797380c6ba44060f0c73713fbd7989eeb1147aedb8723aa14f3afaa3")
+
+    add_deps("cmake", "libcurl")
+
+    on_install("linux", "macosx", "windows", function (package)
+        local configs = {"-DCPR_BUILD_TESTS=OFF", "-DCPR_FORCE_USE_SYSTEM_CURL=ON"}
+        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
+        table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
+        local shflags
+        if package:config("shared") and package:is_plat("macosx") then
+            shflags = {"-framework", "Security"}
+        end
+        import("package.tools.cmake").install(package, configs, {shflags = shflags})
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            #include <cassert>
+            #include <cpr/cpr.h>
+            static void test() {
+                cpr::Response r = cpr::Get(cpr::Url{"https://xmake.io"});
+                assert(r.status_code == 200);
+            }
+        ]]}, {configs = {languages = "c++11"}}))
+    end)