add mysqlpp (#2219)
* add mysqlpp * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * add linux support * use add_files * use autoconf * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.luapull/2226/head
parent
2ba6f0664a
commit
0fa79eab86
2 changed files with 58 additions and 0 deletions
@ -0,0 +1,19 @@ |
||||
add_rules("mode.debug", "mode.release") |
||||
add_requires("mysql", "zlib", "zstd") |
||||
|
||||
target("mysqlpp") |
||||
set_kind("shared") |
||||
add_files("lib/beemutex.cpp", "lib/cmdline.cpp", "lib/connection.cpp", "lib/cpool.cpp", "lib/datetime.cpp") |
||||
add_files("lib/dbdriver.cpp", "lib/field_names.cpp", "lib/field_types.cpp", "lib/manip.cpp", "lib/myset.cpp") |
||||
add_files("lib/mysql++.cpp", "lib/mystring.cpp", "lib/null.cpp", "lib/options.cpp", "lib/qparms.cpp", "lib/query.cpp") |
||||
add_files("lib/result.cpp", "lib/row.cpp", "lib/scopedconnection.cpp", "lib/sql_buffer.cpp", "lib/sqlstream.cpp") |
||||
add_files("lib/ssqls2.cpp", "lib/stadapter.cpp", "lib/tcp_connection.cpp", "lib/transaction.cpp", "lib/type_info.cpp") |
||||
add_files("lib/uds_connection.cpp", "lib/utility.cpp", "lib/vallist.cpp", "lib/wnp_connection.cpp") |
||||
add_packages("mysql", "zlib", "zstd") |
||||
if is_plat("windows") then |
||||
add_syslinks("advapi32") |
||||
add_defines("_USRDLL", "DLL_EXPORTS", "UNICODE", "_UNICODE", "MYSQLPP_MAKING_DLL", "HAVE_MYSQL_SSL_SET") |
||||
elseif is_plat("mingw") then |
||||
add_syslinks("pthread") |
||||
add_defines("UNICODE", "_UNICODE", "MYSQLPP_NO_DLL", "HAVE_MYSQL_SSL_SET") |
||||
end |
@ -0,0 +1,39 @@ |
||||
package("mysqlpp") |
||||
set_homepage("https://tangentsoft.com/mysqlpp/wiki?name=MySQL%2B%2B&p&nsm") |
||||
set_description("MySQL++ is a C++ wrapper for the MySQL and MariaDB C APIs") |
||||
|
||||
set_urls("https://tangentsoft.com/mysqlpp/releases/mysql++-$(version).tar.gz") |
||||
add_versions("3.3.0", "449cbc46556cc2cc9f9d6736904169a8df6415f6960528ee658998f96ca0e7cf") |
||||
|
||||
add_configs("shared", {description = "Build shared binaries.", default = true, type = "boolean", readonly = true}) |
||||
|
||||
add_deps("mysql") |
||||
|
||||
on_install("windows", "mingw", function (package) |
||||
os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua") |
||||
local configs = {} |
||||
if package:config("shared") then |
||||
configs.kind = "shared" |
||||
end |
||||
import("package.tools.xmake").install(package, configs) |
||||
os.cp(path.join("lib", "*.h"), package:installdir(path.join("include", "mysql++"))) |
||||
end) |
||||
|
||||
on_install("linux", function (package) |
||||
local configs = {} |
||||
table.insert(configs, "--enable-shared") |
||||
local mysql = package:dep("mysql") |
||||
if mysql and not mysql:is_system() then |
||||
table.insert(configs, "--with-mysql=" .. package:dep("mysql"):installdir()) |
||||
end |
||||
import("package.tools.autoconf").install(package, configs) |
||||
end) |
||||
|
||||
on_test(function (package) |
||||
assert(package:check_cxxsnippets({test = [[ |
||||
#include <mysql++/mysql++.h> |
||||
void test() { |
||||
mysqlpp::String greeting("Hello, world!"); |
||||
} |
||||
]]})) |
||||
end) |
Loading…
Reference in new issue