xmake.lua 1.4 KB

123456789101112131415161718192021222324252627282930
  1. package("cunit")
  2. set_homepage("https://gitlab.com/cunity/cunit")
  3. set_description("CUnit is a lightweight system for writing, administering, and running unit tests in C.")
  4. set_license("LGPL-2.1")
  5. add_urls("https://gitlab.com/cunity/cunit/-/archive/$(version)/cunit-$(version).tar.bz2",
  6. "https://gitlab.com/cunity/cunit.git")
  7. add_versions("3.4.4", "eda4c24afcb2f689b150dadea790a12efb1a0e5e2eb68df7d6417a3ae70a90c7")
  8. if is_plat("windows") then
  9. add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
  10. end
  11. add_deps("cmake")
  12. on_install(function (package)
  13. io.replace("CUnit/CMakeLists.txt", "STATIC", "", {plain = true})
  14. io.replace("CMakeLists.txt", "-Werror -Werror=strict-prototypes", "", {plain = true})
  15. io.replace("CUnit/CMakeLists.txt", "-Werror -Werror=strict-prototypes", "", {plain = true})
  16. local configs = {"-DCUNIT_DISABLE_TESTS=TRUE", "-DCUNIT_DISABLE_EXAMPLES=TRUE"}
  17. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  18. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  19. import("package.tools.cmake").install(package, configs)
  20. end)
  21. on_test(function (package)
  22. assert(package:has_cfuncs("CU_basic_set_mode", {includes = "CUnit/Basic.h"}))
  23. end)