faker-cxx: add package (#3711)

* faker-cxx: add package

* add dep fmt

* switch v2

* add check

* limit plat
pull/3994/head
star9029 5 months ago committed by GitHub
parent 066ec927c7
commit 5eda937c45
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 49
      packages/f/faker-cxx/xmake.lua

@ -0,0 +1,49 @@
package("faker-cxx")
set_homepage("https://cieslarmichal.github.io/faker-cxx/")
set_description("C++ Faker library for generating fake (but realistic) data.")
set_license("MIT")
add_urls("https://github.com/cieslarmichal/faker-cxx/archive/refs/tags/$(version).tar.gz",
"https://github.com/cieslarmichal/faker-cxx.git")
add_versions("v2.0.0", "8a7f5441f4453af868444675878a2d9a74918c1595caa65d537d3ea327e46a49")
add_deps("cmake")
add_deps("fmt")
if on_check then
on_check(function (package)
assert(package:check_cxxsnippets({test = [[
#include <concepts>
#include <ranges>
static_assert(std::integral<bool>);
void test() {
const auto v = {4, 1, 3, 2};
auto it = std::ranges::find(v, 3);
}
]]}, {configs = {languages = "c++20"}}), "package(faker-cxx) Require at least C++20.")
end)
end
on_install("!wasm", function (package)
local configs = {"-DBUILD_TESTING=OFF", "-DUSE_SYSTEM_DEPENDENCIES=ON", "-DUSE_STD_FORMAT=OFF"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
local cxflags
if package:has_tool("cxx", "cl") then
cxflags = "/utf-8"
if package:config("shared") then
table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON")
end
end
import("package.tools.cmake").install(package, configs, {cxflags = cxflags})
end)
on_test(function (package)
assert(package:check_cxxsnippets({test = [[
void test() {
const auto id = faker::string::uuid();
}
]]}, {configs = {languages = "c++20"}, includes = "faker-cxx/String.h"}))
end)
Loading…
Cancel
Save