Skip to content

Commit

Permalink
cpp-httplib: fix openssl (#3739)
Browse files Browse the repository at this point in the history
  • Loading branch information
star-hengxing committed Apr 9, 2024
1 parent 1651d94 commit efaf379
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/c/cpp-httplib/xmake.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package("cpp-httplib")

set_kind("library", {headeronly = true})
set_homepage("https://github.com/yhirose/cpp-httplib")
set_description("A C++11 single-file header-only cross platform HTTP/HTTPS library.")
set_license("MIT")

set_urls("https://github.com/yhirose/cpp-httplib/archive/v$(version).tar.gz",
"https://github.com/yhirose/cpp-httplib.git")

add_versions("0.8.5", "b353f3e7c124a08940d9425aeb7206183fa29857a8f720c162f8fd820cc18f0e")
add_versions("0.9.2", "bfef2587a2aa31c85fb361df71c720be97076f8083e4f3881da8572f6a58054f")
add_versions("0.12.1", "0e56c25c63e730ebd42e2beda6e7cb1b950131d8fc00d3158b1443a8d76f41ca")
Expand All @@ -21,12 +23,13 @@ package("cpp-httplib")
add_configs("ssl", { description = "Requires OpenSSL", default = false, type = "boolean"})
add_configs("zlib", { description = "Requires Zlib", default = false, type = "boolean"})
add_configs("brotli", { description = "Requires Brotli", default = false, type = "boolean"})
add_configs("exceptions", {description = "Enable the use of C++ exceptions", default = true, type = "boolean"})

add_deps("cmake")

on_load(function (package)
if package:config("ssl") then
package:add("deps", "openssl")
package:add("deps", "openssl" .. (package:version():ge("0.15.0") and "3" or ""))
package:add("defines", "CPPHTTPLIB_OPENSSL_SUPPORT")
end
if package:config("zlib") then
Expand All @@ -46,11 +49,12 @@ package("cpp-httplib")
local ndk_sdkver = ndk:config("ndk_sdkver")
assert(ndk_sdkver and tonumber(ndk_sdkver) >= 24, "package(httplib): need ndk api level >= 24 for android")
end
local configs = {}
local configs = {"-DHTTPLIB_COMPILE=OFF"}
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
table.insert(configs, "-DHTTPLIB_REQUIRE_OPENSSL=" .. (package:config("ssl") and "ON" or "OFF"))
table.insert(configs, "-DHTTPLIB_REQUIRE_ZLIB=" .. (package:config("zlib") and "ON" or "OFF"))
table.insert(configs, "-DHTTPLIB_REQUIRE_BROTLI=" .. (package:config("brotli") and "ON" or "OFF"))
table.insert(configs, "-DHTTPLIB_NO_EXCEPTIONS=" .. (package:config("exceptions") and "OFF" or "ON"))
import("package.tools.cmake").install(package, configs)
end)

Expand Down

0 comments on commit efaf379

Please sign in to comment.