xmake.lua 1.3 KB

1234567891011121314151617181920212223242526272829
  1. package("unity_test")
  2. set_homepage("http://www.throwtheswitch.org/unity")
  3. set_description("Simple Unit Testing for C")
  4. set_license("MIT")
  5. add_urls("https://github.com/ThrowTheSwitch/Unity/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/ThrowTheSwitch/Unity.git")
  7. add_versions("v2.5.2", "3786de6c8f389be3894feae4f7d8680a02e70ed4dbcce36109c8f8646da2671a")
  8. add_versions("v2.5.1", "5ce08ef62f5f64d18f8137b3eaa6d29199ee81d1fc952cef0eea96660a2caf47")
  9. add_versions("v2.5.0", "d470165dc46652cf73fda54e2650b483b94a7e24ccf793ded28615729b2f41ed")
  10. add_versions("v2.4.3", "a8c5e384f511a03c603bbecc9edc24d2cb4a916998d51a29cf2e3a2896920d03")
  11. add_deps("cmake")
  12. on_install(function (package)
  13. local configs = {"-DUNITY_EXTENSION_FIXTURE=ON", "-DUNITY_EXTENSION_MEMORY=ON"}
  14. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  15. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  16. import("package.tools.cmake").install(package, configs)
  17. end)
  18. on_test(function (package)
  19. assert(package:check_csnippets({test = [[
  20. void test_main(void) {
  21. TEST_ASSERT_EQUAL_INT(1, 1);
  22. }
  23. ]]}, {includes = "unity/unity.h"}))
  24. end)