Skip to content

Commit

Permalink
duckx: add package (#2783)
Browse files Browse the repository at this point in the history
* duckx: add package

* kuba-zip: enable mingw
  • Loading branch information
star-hengxing authored Nov 2, 2023
1 parent c353991 commit a023df0
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 8 deletions.
41 changes: 41 additions & 0 deletions packages/d/duckx/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package("duckx")
set_homepage("https://github.com/amiremohamadi/DuckX")
set_description("C++ library for creating and modifying Microsoft Word (.docx) files")
set_license("MIT")

add_urls("https://github.com/amiremohamadi/DuckX.git")
add_versions("2021.08.05", "6b6656309d7a46a483267abd1d591ef41226badd")

add_deps("kuba-zip", "pugixml")

on_install("windows", "linux", "macosx", "mingw", function (package)
io.writefile("xmake.lua", [[
add_requires("kuba-zip", "pugixml")
add_rules("mode.debug", "mode.release")
set_languages("c++11")
target("duckx")
set_kind("$(kind)")
add_files("src/duckx.cpp")
add_includedirs("include")
add_headerfiles("include/*.hpp", {prefixdir = "duckx"})
if is_plat("windows") and is_kind("shared") then
add_rules("utils.symbols.export_all", {export_classes = true})
end
add_packages("kuba-zip", "pugixml")
]])
io.replace("include/duckx.hpp", "zip.h", "zip/zip.h", {plain = true})
io.replace("include/duckx.hpp", "<constants.hpp>", [["constants.hpp"]], {plain = true})
io.replace("include/duckx.hpp", "<duckxiterator.hpp>", [["duckxiterator.hpp"]], {plain = true})
io.replace("src/duckx.cpp", "zip_total_entries", "zip_entries_total", {plain = true})
import("package.tools.xmake").install(package, configs)
end)

on_test(function (package)
assert(package:check_cxxsnippets({test = [[
#include <duckx/duckx.hpp>
void test() {
duckx::Document doc("file.docx");
doc.open();
}
]]}, {configs = {languages = "c++11"}}))
end)
19 changes: 11 additions & 8 deletions packages/k/kuba-zip/xmake.lua
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
package("kuba-zip")

set_homepage("https://github.com/kuba--/zip")
set_description("A portable, simple zip library written in C")
set_license("Unlicense")

add_urls("https://github.com/kuba--/zip/archive/refs/tags/$(version).tar.gz",
"https://github.com/kuba--/zip.git")

add_versions("v0.2.2", "f278b1da5e5382c7a1a1db1502cfa1f6df6b1e05e36253d661344d30277f9895")
add_versions("v0.2.5", "e052f6cbe6713f69f8caec61214fda4e5ae5150d1fcba02c9e79f1a05d939305")
add_versions("v0.2.6", "6a00e10dc5242f614f76f1bd1d814726a41ee6e3856ef3caf7c73de0b63acf0b")

add_deps("cmake")
on_load("windows", "mingw@windows", function (package)
if package:config("shared") then
package:add("defines", "ZIP_SHARED")
end
end)

on_install("windows", "macosx", "linux", "mingw@windows", function (package)
on_install("windows", "macosx", "linux", "mingw", function (package)
local configs = {"-DCMAKE_DISABLE_TESTING=ON", "-DZIP_BUILD_DOCS=OFF"}
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:config("shared") then
table.insert(configs, "-DBUILD_SHARED_LIBS=ON")
if package:is_plat("windows", "mingw") then
package:add("defines", "ZIP_SHARED")
end
else
table.insert(configs, "-DBUILD_SHARED_LIBS=OFF")
end
import("package.tools.cmake").install(package, configs)
end)

Expand Down

0 comments on commit a023df0

Please sign in to comment.