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.

34 lines
1.4 KiB

5 years ago
package("gtest")
set_homepage("https://github.com/google/googletest")
set_description("Google Testing and Mocking Framework.")
5 years ago
add_urls("https://github.com/google/googletest/archive/release-$(version).zip", {alias = "archive"})
5 years ago
add_urls("https://github.com/google/googletest.git", {alias = "github"})
add_versions("github:1.8.1", "release-1.8.1")
5 years ago
add_versions("archive:1.8.1", "927827c183d01734cc5cfef85e0ff3f5a92ffe6188e0d18e909c5efebf28a0c7")
5 years ago
on_install(function (package)
5 years ago
io.writefile("xmake.lua", [[
target("gtest")
set_kind("static")
add_files("googletest/src/gtest-all.cc")
add_includedirs("googletest/include", "googletest")
add_headerfiles("googletest/include/(**.h)")
]])
import("package.tools.xmake").install(package)
5 years ago
end)
on_test(function (package)
assert(package:check_cxxsnippets({test = [[
int factorial(int number) { return number <= 1 ? number : factorial(number - 1) * number; }
TEST(FactorialTest, Zero) {
5 years ago
testing::InitGoogleTest(0, (char**)0);
5 years ago
EXPECT_EQ(1, factorial(1));
EXPECT_EQ(2, factorial(2));
EXPECT_EQ(6, factorial(3));
EXPECT_EQ(3628800, factorial(10));
}
]]}, {configs = {languages = "c++11"}, includes = "gtest/gtest.h"}))
end)