xmake.lua 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package("libpqxx")
  2. set_homepage("http://pqxx.org/libpqxx/")
  3. set_description("The official C++ client API for PostgreSQL.")
  4. set_license("BSD-3-Clause")
  5. add_urls("https://github.com/jtv/libpqxx/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/jtv/libpqxx.git")
  7. add_versions("7.10.3", "c5ba455e4f28901297c18a76e533c466cbe8908d4b2ff6313235954bb37cef25")
  8. add_versions("7.10.2", "9e109ffe12daa7b689da41dac05509f41b803f8405e38b1687b54e09df19000f")
  9. add_versions("7.10.1", "cfbbb1d93a0a3d81319ec71d9a3db80447bb033c4f6cee088554a88862fd77d7")
  10. add_versions("7.7.0", "2d99de960aa3016915bc69326b369fcee04425e57fbe9dad48dd3fa6203879fb")
  11. add_deps("cmake", "libpq")
  12. on_check(function (package)
  13. if package:is_plat("windows") and package:is_arch("arm64") then
  14. raise("package(libpqxx): ARM64 support on Windows is unavailable due to its dependence libpq.")
  15. end
  16. end)
  17. on_install("windows", "macosx", "linux", "bsd", function (package)
  18. if package:is_plat("windows") and package:version():eq("7.10.2") then
  19. io.replace("include/pqxx/internal/header-pre.hxx", "#if PQXX_CPLUSPLUS < 201703L && __has_include(<ciso646>)", "#if defined(_MSC_VER) && PQXX_CPLUSPLUS <= 201703L && __has_include(<ciso646>)", {plain=true})
  20. end
  21. local configs = {"-DSKIP_BUILD_TEST=ON"}
  22. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  23. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  24. import("package.tools.cmake").install(package, configs)
  25. end)
  26. on_test(function (package)
  27. assert(package:check_cxxsnippets({test = [[
  28. void test() {
  29. pqxx::connection con;
  30. }
  31. ]]}, {configs = {languages = "c++17"}, includes = "pqxx/pqxx"}))
  32. end)