add nativefiledialog-extended (#1954)

* update cxxopts

* fix catch2

* update dbus

* add nativefiledialog-extended

* fix build

* fix macos build

* fix dependency
pull/1957/head
Hoildkv 2 years ago committed by GitHub
parent 0f485bf24d
commit 1a596ccf1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      packages/c/catch2/xmake.lua
  2. 7
      packages/c/cxxopts/xmake.lua
  3. 16
      packages/d/dbus/xmake.lua
  4. 47
      packages/n/nativefiledialog-extended/xmake.lua

@ -40,6 +40,9 @@ package("catch2")
on_component("main", function (package, component)
component:add("links", "Catch2Main")
if package:is_plat("windows") then
component:add("ldflags", "-subsystem:console")
end
end)
on_component("lib", function (package, component)

@ -1,10 +1,13 @@
package("cxxopts")
set_kind("library", {headeronly = true})
set_homepage("https://github.com/jarro2783/cxxopts")
set_description("Lightweight C++ command line option parser")
set_license("MIT")
add_urls("https://github.com/jarro2783/cxxopts.git")
add_urls("https://github.com/jarro2783/cxxopts/archive/$(version).tar.gz")
add_versions("v3.1.1", "523175f792eb0ff04f9e653c90746c12655f10cb70f1d5e6d6d9491420298a08")
add_versions("v3.0.0", "36f41fa2a46b3c1466613b63f3fa73dc24d912bc90d667147f1e43215a8c6d00")
add_versions("v2.2.0", "447dbfc2361fce9742c5d1c9cfb25731c977b405f9085a738fbd608626da8a4d")
@ -16,8 +19,10 @@ package("cxxopts")
add_extsources("brew::cxxopts")
end
add_deps("cmake")
on_install(function (package)
os.cp("include/*.hpp", package:installdir("include"))
local configs = {"-DCXXOPTS_BUILD_EXAMPLES=OFF", "-DCXXOPTS_BUILD_TESTS=OFF"}
import("package.tools.cmake").install(package, configs)
end)
on_test(function (package)

@ -4,8 +4,17 @@ package("dbus")
set_description("D-Bus is a message bus system, a simple way for applications to talk to one another.")
set_license("MIT")
add_urls("https://gitlab.freedesktop.org/dbus/dbus/-/archive/dbus-1.14.2/dbus-dbus-$(version).tar.gz")
add_urls("https://gitlab.freedesktop.org/dbus/dbus/-/archive/dbus-$(version)/dbus-dbus-$(version).tar.gz")
add_versions("1.14.2", "9ec5aad6310f79149aa04e8c6bd9e5e2cdca47cf3acec2d23ee9fe06ac7e7a62")
add_versions("1.14.6", "2533742eb324fa7fbb093a3ed0ff436c7eb11861fd6a31e9b857fc4878f01831")
if is_plat("mingw") and is_subhost("msys") then
add_extsources("pacman::dbus")
elseif is_plat("linux") then
add_extsources("pacman::dbus", "apt::libdbus-1-dev")
elseif is_plat("macosx") then
add_extsources("brew::dbus")
end
add_deps("expat", "cmake")
add_includedirs("include/dbus-1.0", "lib/dbus-1.0/include")
@ -13,13 +22,12 @@ package("dbus")
add_configs("shared", {description = "Build shared library.", default = true, type = "boolean", readonly = true})
on_install("windows", "linux", "macosx", "cross", function (package)
local configs = {"-DDBUS_BUILD_TESTS=OFF"}
table.insert(configs, "-DDBUS_SESSION_SOCKET_DIR=./tmp")
local configs = {"-DDBUS_BUILD_TESTS=OFF", "-DDBUS_ENABLE_DOXYGEN_DOCS=OFF", "-DDBUS_ENABLE_XML_DOCS=OFF"}
table.insert(configs, "-DDBUS_SESSION_SOCKET_DIR=" .. package:installdir("socket"))
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
local packagedeps
if package:is_plat("windows") then
packagedeps = "expat"
table.insert(configs, "-DDBUS_ENABLE_XML_DOCS=OFF")
io.replace("CMakeLists.txt", "find_package(EXPAT)", "", {plain = true})
io.replace("CMakeLists.txt", "NOT EXPAT_FOUND", "FALSE", {plain = true})
end

@ -0,0 +1,47 @@
package("nativefiledialog-extended")
set_homepage("https://github.com/btzy/nativefiledialog-extended")
set_description("Cross platform (Windows, Mac, Linux) native file dialog library with C and C++ bindings, based on mlabbe/nativefiledialog.")
add_urls("https://github.com/btzy/nativefiledialog-extended/archive/refs/tags/$(version).zip",
"https://github.com/btzy/nativefiledialog-extended.git")
add_versions("v1.0.2", "1d2c4c50fb1e3ad8caa5ad9c3df54725c3a49a6d4a21d773a20b93ebeb5780f1")
add_configs("portal", {description = "Use xdg-desktop-portal instead of GTK.", default = true, type = "boolean"})
if is_plat("windows") then
add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
end
add_deps("cmake")
if is_plat("windows") then
add_syslinks("shell32", "ole32")
elseif is_plat("macosx") then
add_frameworks("AppKit", "UniformTypeIdentifiers")
end
on_load("linux", function (package)
if package:config("portal") then
package:add("deps", "dbus")
else
package:add("deps", "gtk+3")
end
end)
on_install("windows", "macosx", "linux", function (package)
local configs = {"-DNFD_BUILD_TESTS=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"))
table.insert(configs, "-DNFD_PORTAL=" .. (package:config("portal") and "ON" or "OFF"))
import("package.tools.cmake").install(package, configs)
end)
on_test(function (package)
assert(package:check_cxxsnippets({test = [[
void test() {
NFD_Init();
nfdchar_t *outPath = NULL;
nfdfilteritem_t filterItem[2] = {{"Source code", "c,cpp,cc"}, {"Headers", "h,hpp"}};
nfdresult_t result = NFD_OpenDialog(&outPath, filterItem, 2, NULL);
NFD_Quit();
}
]]}, {includes = "nfd.h"}))
end)
Loading…
Cancel
Save