2
0

xmake.lua 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package("cppunit")
  2. set_homepage("https://freedesktop.org/wiki/Software/cppunit")
  3. set_description("CppUnit is the C++ port of the famous JUnit framework for unit testing")
  4. set_license("LGPL-2.1-or-later")
  5. add_urls("http://dev-www.libreoffice.org/src/cppunit-$(version).tar.gz")
  6. add_versions("1.15.1", "89c5c6665337f56fd2db36bc3805a5619709d51fb136e51937072f63fcc717a7")
  7. if is_plat("mingw") and is_subhost("msys") then
  8. add_extsources("pacman::cppunit")
  9. elseif is_plat("linux") then
  10. add_extsources("pacman::cppunit", "apt::libcppunit-dev")
  11. elseif is_plat("macosx") then
  12. add_extsources("brew::cppunit")
  13. end
  14. on_install("!android", function (package)
  15. if package:is_plat("windows") and package:config("shared") then
  16. package:add("defines", "CPPUNIT_DLL")
  17. end
  18. if is_host("windows") and not is_subhost("msys") then
  19. os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
  20. os.cp(path.join(package:scriptdir(), "port", "config-auto.h"), "include/cppunit/config-auto.h")
  21. import("package.tools.xmake").install(package)
  22. else
  23. local configs = {"--enable-doxygen=no", "--enable-dot=no", "--enable-werror=no", "--enable-werror=no"}
  24. table.insert(configs, "--enable-debug=" .. (package:is_debug() and "yes" or "no"))
  25. table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
  26. table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes"))
  27. import("package.tools.autoconf").install(package, configs)
  28. end
  29. end)
  30. on_test(function (package)
  31. assert(package:check_cxxsnippets({test = [[
  32. void test() {
  33. CPPUNIT_NS::TestResult controller;
  34. }
  35. ]]}, {configs = {languages = "c++11"}, includes = "cppunit/TestResult.h"}))
  36. end)