Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add poco msys and mingw version #4390

Merged
merged 26 commits into from
Jul 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions packages/p/poco/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ package("poco")
end
add_configs("mysql", {description = "Enable mysql support.", default = false, type = "boolean"})
add_configs("postgresql", {description = "Enable postgresql support.", default = false, type = "boolean"})
add_configs("mongodb", {description = "Enable mongodb support.", default = false, type = "boolean"})
add_configs("odbc", {description = "Enable odbc support.", default = is_plat("windows"), type = "boolean"})
add_configs("sql_parser", {description = "Enable poco data sql parser.", default = false, type = "boolean"})

add_deps("cmake")
add_deps("openssl", "sqlite3", "expat", "zlib")
Expand All @@ -30,7 +32,7 @@ package("poco")
add_syslinks("iphlpapi")
end

on_load("windows", "linux", "macosx", function (package)
on_load(function (package)
if package:config("postgresql") then
package:add("deps", "postgresql")
end
Expand All @@ -44,7 +46,7 @@ package("poco")
end
end)

on_install("windows", "linux", "macosx", function (package)
on_install("windows", "linux", "macosx", "mingw|x86_64@msys", function (package)
io.replace("XML/CMakeLists.txt", "EXPAT REQUIRED", "EXPAT CONFIG REQUIRED")
io.replace("XML/CMakeLists.txt", "EXPAT::EXPAT", "expat::expat")
io.replace("XML/CMakeLists.txt", "PUBLIC POCO_UNBUNDLED", "PUBLIC POCO_UNBUNDLED XML_DTD XML_NS")
Expand All @@ -54,25 +56,29 @@ package("poco")
io.replace("cmake/FindPCRE2.cmake", "NAMES pcre2-8", "NAMES pcre2-8-static pcre2-8", {plain = true})
io.replace("cmake/FindPCRE2.cmake", "IMPORTED_LOCATION \"${PCRE2_LIBRARY}\"", "IMPORTED_LOCATION \"${PCRE2_LIBRARY}\"\nINTERFACE_COMPILE_DEFINITIONS PCRE2_STATIC", {plain = true})
end

local configs = {"-DPOCO_UNBUNDLED=ON", "-DENABLE_TESTS=OFF", "-DENABLE_PDF=ON"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
if package:is_plat("windows") and not package:config("shared") then
table.insert(configs, "-DPOCO_MT=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
table.insert(configs, "-DPOCO_MT=" .. (package:has_runtime("MT", "MTd") and "ON" or "OFF"))
end

if package:is_plat("windows") then
local vs_sdkver = import("core.tool.toolchain").load("msvc"):config("vs_sdkver")
local vs_sdkver = package:toolchain("msvc"):config("vs_sdkver")
if vs_sdkver then
local build_ver = string.match(vs_sdkver, "%d+%.%d+%.(%d+)%.?%d*")
assert(tonumber(build_ver) >= 18362, "poco requires Windows SDK to be at least 10.0.18362.0")
table.insert(configs, "-DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=" .. vs_sdkver)
table.insert(configs, "-DCMAKE_SYSTEM_VERSION=" .. vs_sdkver)
end
end
for _, lib in ipairs({"mysql", "postgresql", "odbc"}) do

for _, lib in ipairs({"mysql", "postgresql", "odbc", "mongodb"}) do
table.insert(configs, "-DENABLE_DATA_" .. lib:upper() .. "=" .. (package:config(lib) and "ON" or "OFF"))
end

table.insert(configs, "-DPOCO_DATA_NO_SQL_PARSER=" .. (package:config("sql_parser") and "OFF" or "ON"))

if package:config("mysql") then
io.replace("Data/MySQL/include/Poco/Data/MySQL/MySQL.h", '#pragma comment(lib, "libmysql")', '', {plain = true})
local libmysql = package:dep("mysql"):fetch()
Expand Down
Loading