xmake.lua 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package("ocilib")
  2. set_homepage("http://www.ocilib.net")
  3. set_description("OCILIB (C and C++ Drivers for Oracle) - Open source C and C++ library for accessing Oracle databases")
  4. set_license("Apache-2.0")
  5. add_urls("https://github.com/vrogier/ocilib/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/vrogier/ocilib.git")
  7. add_versions("v4.7.7", "92822cc683048d3a2cddbbc7835062a02a9011ed2d7382da52a4c120e8c911ab")
  8. add_versions("v4.7.6", "43f5093cac645518ad5bc8d6f48f5b77e12372ef84dc87ddb3a54c40e425bd26")
  9. add_patches("4.7.7", "patches/4.7.7/fix-gcc14.patch", "33253876d5bdffe6fd74372a812a54733b58bdc25368a5205220ffb56984da5c")
  10. add_configs("unicode", {description = "Enable Unicode", default = true, type = "boolean"})
  11. on_install(function (package)
  12. if not package:config("shared") then
  13. package:add("defines", "OCI_LIB_LOCAL_COMPILE")
  14. end
  15. io.replace("include/ocilibcpp/detail/core/SmartHandle.hpp",
  16. ".Set<SmartHandle*>",
  17. ".template Set<SmartHandle*>", {plain = true})
  18. local configs = {
  19. unicode = package:config("unicode")
  20. }
  21. os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
  22. import("package.tools.xmake").install(package, configs)
  23. end)
  24. on_test(function (package)
  25. assert(package:has_cfuncs("OCI_Initialize", {includes = "ocilib.h"}))
  26. assert(package:check_cxxsnippets({test = [[
  27. #include <ocilib.hpp>
  28. void test() {
  29. ocilib::Environment::Initialize();
  30. }
  31. ]]}, {configs = {languages = "c++11"}}))
  32. end)