xmake.lua 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package("mysqlpp")
  2. set_homepage("https://tangentsoft.com/mysqlpp/wiki?name=MySQL%2B%2B&p&nsm")
  3. set_description("MySQL++ is a C++ wrapper for the MySQL and MariaDB C APIs")
  4. set_urls("https://tangentsoft.com/mysqlpp/releases/mysql++-$(version).tar.gz")
  5. add_versions("3.3.0", "449cbc46556cc2cc9f9d6736904169a8df6415f6960528ee658998f96ca0e7cf")
  6. add_configs("shared", {description = "Build shared binaries.", default = true, type = "boolean", readonly = true})
  7. add_deps("mysql")
  8. on_install("windows", "mingw", function (package)
  9. os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
  10. local configs = {}
  11. if package:config("shared") then
  12. configs.kind = "shared"
  13. end
  14. import("package.tools.xmake").install(package, configs)
  15. os.cp(path.join("lib", "*.h"), package:installdir(path.join("include", "mysql++")))
  16. end)
  17. on_install("linux", function (package)
  18. local configs = {}
  19. table.insert(configs, "--enable-shared")
  20. local mysql = package:dep("mysql")
  21. if mysql and not mysql:is_system() then
  22. table.insert(configs, "--with-mysql=" .. package:dep("mysql"):installdir())
  23. end
  24. import("package.tools.autoconf").install(package, configs)
  25. end)
  26. on_test(function (package)
  27. assert(package:check_cxxsnippets({test = [[
  28. #include <mysql++/mysql++.h>
  29. void test() {
  30. mysqlpp::String greeting("Hello, world!");
  31. }
  32. ]]}))
  33. end)