Add Outcome (#1650)

pull/1651/head
Arthur Laurent 2 years ago committed by GitHub
parent 8bbde2f876
commit 25d546a179
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 40
      packages/o/outcome/xmake.lua

@ -0,0 +1,40 @@
package("outcome")
set_homepage("https://github.com/ned14/outcome")
set_description("Provides very lightweight outcome<T> and result<T> (non-Boost edition)")
set_license("Apache-2.0")
local versions = {
["v2.2.4"] = "4a36ba9c23b1fd5f001a3eea733a595d7e0eb9fe82ea0af12c103b2246f9421b"
}
local hashes = {
["v2.2.4"] = "90032f99503b4620f21d8160dc3af06fa343541f"
}
add_urls("https://github.com/ned14/outcome/releases/download/$(version)", {version = function (version)
return format("%s/outcome-v2-all-sources-%s.tar.xz", version, hashes[tostring(version)])
end})
add_urls("https://github.com/ned14/outcome.git")
for version, commit in pairs(versions) do
add_versions(version, commit)
end
add_deps("cmake")
add_deps("quickcpplib")
on_install(function (package)
local configs = {"-DOUTCOME_ENABLE_DEPENDENCY_SMOKE_TEST=OFF", "-DCMAKE_DISABLE_FIND_PACKAGE_Git=ON", "-DPROJECT_IS_DEPENDENCY=ON"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
import("package.tools.cmake").install(package, configs)
end)
on_test(function (package)
assert(package:check_cxxsnippets({test = [[
#include <outcome/outcome.hpp>
void test () {
using namespace OUTCOME_V2_NAMESPACE;
result<int> f(5);
outcome<void> m(in_place_type<void>);
(void) f;
(void) m;
}
]]}, {configs = {languages = "c++17"}}))
end)
Loading…
Cancel
Save