package An official xmake package repository
https://xrepo.xmake.io/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.3 KiB
33 lines
1.3 KiB
1 year ago
|
package("zpp_throwing")
|
||
|
set_kind("library", {headeronly = true})
|
||
|
set_homepage("https://github.com/eyalz800/zpp_throwing")
|
||
|
set_description("Using coroutines to implement C++ exceptions for freestanding environments")
|
||
|
set_license("MIT")
|
||
|
|
||
|
add_urls("https://github.com/eyalz800/zpp_throwing/archive/refs/tags/$(version).tar.gz",
|
||
|
"https://github.com/eyalz800/zpp_throwing.git")
|
||
|
|
||
|
add_versions("v1.0.1", "c15651ad36f9ddcb51e6244b0a78dbdebf7be8748b3e7ffe1c7339f0e41fd411")
|
||
|
|
||
|
on_install("linux", "macosx", "bsd", "mingw", "msys", "android", "iphoneos", "cross", "wasm", function (package)
|
||
|
os.cp("zpp_throwing.h", package:installdir("include"))
|
||
|
end)
|
||
|
|
||
|
on_test(function (package)
|
||
|
local cxxflags
|
||
|
if package:is_plat("windows") then
|
||
|
cxxflags = {"/EHsc-", "/GR-"}
|
||
|
else
|
||
|
cxxflags = {"-fno-exceptions", "-fno-rtti"}
|
||
|
end
|
||
|
assert(package:check_cxxsnippets({test = [[
|
||
|
#include <zpp_throwing.h>
|
||
|
zpp::throwing<int> test(bool success) {
|
||
|
if (!success) {
|
||
|
co_yield std::runtime_error("My runtime error");
|
||
|
}
|
||
|
co_return 1337;
|
||
|
}
|
||
|
]]}, {configs = {languages = "c++20", cxxflags = cxxflags}}))
|
||
|
end)
|