xlsxio: fix wchar config (#2985)

* xlsxio: fix wchar config

* improve minizip includedirs

* fix deps
pull/2987/head
star9029 11 months ago committed by GitHub
parent e88484a82a
commit 15b61bf02c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      packages/e/expat/xmake.lua
  2. 4
      packages/m/minizip/xmake.lua
  3. 6
      packages/x/xlsxio/port/xmake.lua
  4. 10
      packages/x/xlsxio/xmake.lua

@ -14,6 +14,8 @@ package("expat")
add_versions("2.2.10", "b2c160f1b60e92da69de8e12333096aeb0c3bf692d41c60794de278af72135a5") add_versions("2.2.10", "b2c160f1b60e92da69de8e12333096aeb0c3bf692d41c60794de278af72135a5")
add_versions("2.2.6", "17b43c2716d521369f82fc2dc70f359860e90fa440bea65b3b85f0b246ea81f2") add_versions("2.2.6", "17b43c2716d521369f82fc2dc70f359860e90fa440bea65b3b85f0b246ea81f2")
add_configs("char_type", {description = "Character type to use", default = "char", type = "string", values = {"char", "ushort", "wchar_t"}})
add_deps("cmake") add_deps("cmake")
on_load("windows", function (package) on_load("windows", function (package)
if not package:config("shared") then if not package:config("shared") then
@ -25,6 +27,7 @@ package("expat")
local configs = {"-DEXPAT_BUILD_EXAMPLES=OFF", "-DEXPAT_BUILD_TESTS=OFF", "-DEXPAT_BUILD_DOCS=OFF"} local configs = {"-DEXPAT_BUILD_EXAMPLES=OFF", "-DEXPAT_BUILD_TESTS=OFF", "-DEXPAT_BUILD_DOCS=OFF"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DEXPAT_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) table.insert(configs, "-DEXPAT_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
table.insert(configs, "-DEXPAT_CHAR_TYPE=" .. package:config("char_type"))
if package:is_plat("windows") then if package:is_plat("windows") then
table.insert(configs, "-DEXPAT_MSVC_STATIC_CRT=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF")) table.insert(configs, "-DEXPAT_MSVC_STATIC_CRT=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
end end

@ -12,6 +12,8 @@ package("minizip")
add_deps("zlib") add_deps("zlib")
add_includedirs("include", "include/minizip")
on_install(function (package) on_install(function (package)
os.cd(path.join("contrib", "minizip")) os.cd(path.join("contrib", "minizip"))
io.writefile("xmake.lua", [[ io.writefile("xmake.lua", [[
@ -22,7 +24,7 @@ package("minizip")
target("minizip") target("minizip")
set_kind("$(kind)") set_kind("$(kind)")
add_files("zip.c", "unzip.c", "mztools.c", "ioapi.c") add_files("zip.c", "unzip.c", "mztools.c", "ioapi.c")
add_headerfiles("crypt.h", "zip.h", "unzip.h", "ioapi.h", "mztools.h") add_headerfiles("crypt.h", "zip.h", "unzip.h", "ioapi.h", "mztools.h", {prefixdir = "minizip"})
add_packages("zlib") add_packages("zlib")
if is_plat("windows") then if is_plat("windows") then
add_files("iowin32.c") add_files("iowin32.c")

@ -6,7 +6,11 @@ option("wide", {showmenu = true, default = false})
add_rules("mode.debug", "mode.release") add_rules("mode.debug", "mode.release")
add_requires("expat") if has_config("wide") then
add_requires("expat", {configs = {char_type = "wchar_t"}})
else
add_requires("expat")
end
if has_config("libzip") then if has_config("libzip") then
add_requires("libzip") add_requires("libzip")

@ -16,8 +16,6 @@ package("xlsxio")
add_syslinks("pthread") add_syslinks("pthread")
end end
add_deps("expat")
on_load(function (package) on_load(function (package)
if package:config("libzip") then if package:config("libzip") then
package:add("deps", "libzip") package:add("deps", "libzip")
@ -26,6 +24,12 @@ package("xlsxio")
else else
package:add("deps", "minizip") package:add("deps", "minizip")
end end
if package:config("wide") then
package:add("deps", "expat", {configs = {char_type = "wchar_t"}})
else
package:add("deps", "expat")
end
end) end)
on_install("windows", "linux", "macosx", "mingw", "cross", function (package) on_install("windows", "linux", "macosx", "mingw", "cross", function (package)
@ -41,8 +45,6 @@ package("xlsxio")
end end
package:add("defines", "BUILD_XLSXIO_" .. (package:config("shared") and "SHARED" or "STATIC")) package:add("defines", "BUILD_XLSXIO_" .. (package:config("shared") and "SHARED" or "STATIC"))
io.replace("lib/xlsxio_read.c", "minizip/", "", {plain = true})
io.replace("lib/xlsxio_write.c", "minizip/", "", {plain = true})
os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua") os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
import("package.tools.xmake").install(package, configs) import("package.tools.xmake").install(package, configs)
end) end)

Loading…
Cancel
Save