Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New package: google-cloud-cpp #5991

Merged
merged 18 commits into from
Jan 16, 2025
74 changes: 74 additions & 0 deletions packages/g/google-cloud-cpp/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package("google-cloud-cpp")
set_homepage("https://github.com/googleapis/google-cloud-cpp")
set_description("C++ Client Libraries for Google Cloud Services")
set_license("Apache-2.0")

add_urls("https://github.com/googleapis/google-cloud-cpp/archive/refs/tags/v$(version).tar.gz",
"https://github.com/googleapis/google-cloud-cpp.git")
add_versions("2.32.0","db69dd73ef4af8b2e816d80ded04950036d0e0dccc274f8c3d3ed1d7f5692a1b")

add_configs("grpc", {description = "Enable gRPC", default = true, type = "boolean"})

add_deps("cmake")
add_deps("abseil", "crc32c", "libcurl", "openssl3", "zlib")
add_deps("nlohmann_json", {configs = {cmake = true}})

on_check(function (package)
if package:is_plat("android") then
raise("package(google-cloud-cpp) unsupported on android due to package(grpc) is unsupported on android yet.")
end
if package:is_plat("wasm") then
raise("package(google-cloud-cpp) unsupported on wasm due to package(grpc) is unsupported on wasm yet.")
end
if package:is_plat("mingw") then
star-hengxing marked this conversation as resolved.
Show resolved Hide resolved
raise("package(google-cloud-cpp) unsupported on mingw due to package(grpc) is unsupported on mingw yet.")
end
if package:is_plat("iphoneos") then
raise("package(google-cloud-cpp) unsupported on iphoneos due to package(grpc) is unsupported on iphoneos yet.")
end
if package:is_plat("bsd") then
raise("package(google-cloud-cpp) unsupported on bsd")
end
if package:is_arch("arm.*") then
raise("package(google-cloud-cpp) unsupported on arm yet")
end
star-hengxing marked this conversation as resolved.
Show resolved Hide resolved
end)

on_install(function (package)
local configs = {
"-DBUILD_TESTING=OFF",
"-DGOOGLE_CLOUD_CPP_WITH_MOCKS=OFF",
"-DGOOGLE_CLOUD_CPP_ENABLE_MACOS_OPENSSL_CHECK=OFF",
"-DGOOGLE_CLOUD_CPP_ENABLE_WERROR=OFF",
}
table.insert(configs, "-DGOOGLE_CLOUD_CPP_ENABLE_GRPC=" .. (package:config("grpc") and "ON" or "OFF"))

package:add("cxxflags", "-Wno-missing-template-arg-list-after-template-kw")
import("package.tools.cmake").install(package, configs)
end)

on_load(function (package)
if package:config("shared") then
package:add("deps","protobuf-cpp",{shared= true})
star-hengxing marked this conversation as resolved.
Show resolved Hide resolved
if package:config("grpc") then
package:add("deps","grpc",{shared= true})
end
else
package:add("deps","protobuf-cpp")
if package:config("grpc") then
package:add("deps","grpc")
end
end
end)

on_test(function (package)
assert(package:check_cxxsnippets({test = [[
#include "google/cloud/version.h"
int test() {
google::cloud::version_string();
return 0;
}
]]}, {configs = {languages = "c++17"}}))
end)


Loading