xmake.lua 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package("cwt-cucumber")
  2. set_homepage("https://github.com/ThoSe1990/cwt-cucumber")
  3. set_description("A C++ Cucumber interpreter")
  4. set_license("MIT")
  5. add_urls("https://github.com/ThoSe1990/cwt-cucumber/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/ThoSe1990/cwt-cucumber.git")
  7. add_versions("2.8", "30576a39a9ce2c4a915ed8f0e46f3f0ef149febf995989dfb02a05866ff38f57")
  8. add_versions("2.7", "12a38587fc50990dbb7f80a18e401011ea8d7e5d1dd82a13e66cb294a02bbd78")
  9. add_versions("2.6", "1896f695b06dccf30d030ea819f693e4324bbd2f38f336aa36cf6fa87be3dfbd")
  10. add_versions("2.5", "793d07c2f1989a2943befd4344cb8a49f36d39bdc0d596dbebbbc50e25fa3bc5")
  11. add_deps("cmake")
  12. add_deps("nlohmann_json", {configs = {cmake = true}})
  13. on_check("android", function (package)
  14. local ndk = package:toolchain("ndk"):config("ndkver")
  15. assert(ndk and tonumber(ndk) > 22, "package(cwt-cucumber) require ndk version > 22")
  16. end)
  17. on_check("macosx", function (package)
  18. if macos.version():le("14") then
  19. raise("package(cwt-cucumber): requires macOS version >= 14.5")
  20. end
  21. end)
  22. on_install(function (package)
  23. io.replace("CMakeLists.txt", "add_subdirectory(${PROJECT_SOURCE_DIR}/examples)", "", {plain = true})
  24. io.replace("CMakeLists.txt", "add_subdirectory(${PROJECT_SOURCE_DIR}/gtest)", "", {plain = true})
  25. local configs = {}
  26. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  27. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  28. if package:config("shared") and package:is_plat("windows") then
  29. table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON")
  30. end
  31. import("package.tools.cmake").install(package, configs)
  32. end)
  33. on_test(function (package)
  34. assert(package:check_cxxsnippets({test = [[
  35. struct foo {
  36. std::string word;
  37. std::string anonymous;
  38. };
  39. WHEN(word_anonymous_given, "A {word} and {}") {
  40. std::string word = CUKE_ARG(1);
  41. cuke::context<foo>().word = word;
  42. std::string anonymous = CUKE_ARG(2);
  43. cuke::context<foo>().anonymous = anonymous;
  44. }
  45. THEN(word_anonymous_then, "They will match {string} and {string}") {
  46. std::string expected_word = CUKE_ARG(1);
  47. std::string expected_anonymous = CUKE_ARG(2);
  48. cuke::equal(expected_word, cuke::context<foo>().word);
  49. cuke::equal(expected_anonymous, cuke::context<foo>().anonymous);
  50. }
  51. ]]}, {configs = {languages = "c++20"}, includes = {"cwt-cucumber/cucumber.hpp"}}))
  52. end)