xmake.lua 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package("xerces-c")
  2. set_homepage("https://xerces.apache.org/xerces-c/")
  3. set_description("Xerces-C++ is a validating XML parser written in a portable subset of C++.")
  4. set_license("Apache-2.0")
  5. add_urls("https://downloads.apache.org/xerces/c/3/sources/xerces-c-$(version).zip")
  6. add_versions("3.2.3", "4a3a23ed859cff886e50ee8b30e3223c603fbcad86d1ba5a11f29da692b825ce")
  7. add_deps("cmake")
  8. if is_plat("windows") then
  9. add_syslinks("advapi32")
  10. elseif is_plat("macosx") then
  11. add_frameworks("CoreFoundation", "CoreServices")
  12. end
  13. on_install("windows", "macosx", "linux", function (package)
  14. local configs = {"-Dnetwork=OFF", "-DCMAKE_DISABLE_FIND_PACKAGE_ICU=ON", "-DCMAKE_DISABLE_FIND_PACKAGE_CURL=ON"}
  15. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  16. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  17. if package:config("pic") ~= false then
  18. table.insert(configs, "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")
  19. end
  20. import("package.tools.cmake").install(package, configs)
  21. end)
  22. on_test(function (package)
  23. assert(package:check_cxxsnippets({test = [[
  24. using namespace xercesc;
  25. void test() {
  26. try {
  27. XMLPlatformUtils::Initialize();
  28. }
  29. catch (const XMLException& toCatch) {
  30. return;
  31. }
  32. XMLPlatformUtils::Terminate();
  33. }
  34. ]]}, {configs = {languages = "c++11"}, includes = "xercesc/util/PlatformUtils.hpp"}))
  35. end)