xmake.lua 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  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.6", "43f5093cac645518ad5bc8d6f48f5b77e12372ef84dc87ddb3a54c40e425bd26")
  8. add_configs("unicode", {description = "Enable Unicode", default = true, type = "boolean"})
  9. on_install(function (package)
  10. local configs = {
  11. unicode = package:config("unicode")
  12. }
  13. if not package:config("shared") then
  14. package:add("defines", "OCI_LIB_LOCAL_COMPILE")
  15. end
  16. io.replace("include/ocilibcpp/detail/core/SmartHandle.hpp",
  17. ".Set<SmartHandle*>",
  18. ".template Set<SmartHandle*>", {plain = true})
  19. os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
  20. import("package.tools.xmake").install(package, configs)
  21. end)
  22. on_test(function (package)
  23. assert(package:has_cfuncs("OCI_Initialize", {includes = "ocilib.h"}))
  24. assert(package:check_cxxsnippets({test = [[
  25. #include <ocilib.hpp>
  26. void test() {
  27. ocilib::Environment::Initialize();
  28. }
  29. ]]}, {configs = {languages = "c++11"}}))
  30. end)