summaryrefslogtreecommitdiff
path: root/third_party/packages
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/packages')
-rw-r--r--third_party/packages/n/nativefiledialog-extended/xmake.lua62
-rw-r--r--third_party/packages/t/tinyfiledialogs/xmake.lua35
2 files changed, 62 insertions, 35 deletions
diff --git a/third_party/packages/n/nativefiledialog-extended/xmake.lua b/third_party/packages/n/nativefiledialog-extended/xmake.lua
new file mode 100644
index 0000000..2086e7f
--- /dev/null
+++ b/third_party/packages/n/nativefiledialog-extended/xmake.lua
@@ -0,0 +1,62 @@
+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.1.1", "7003001d36235db2c2062cd992e61c59c77a5ad3ca5e5ed8175e56502513886e")
+ add_versions("v1.1.0", "5827d17b6bddc8881406013f419c534e8459b38f34c2f266d9c1da8a7a7464bc")
+ 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
+
+ if is_plat("windows", "mingw") 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", "mingw", function (package)
+ io.writefile("xmake.lua", [[
+ add_rules("mode.debug", "mode.release")
+ add_syslinks("shell32", "ole32")
+ add_includedirs("src/include")
+ target("nativefiledialog-extended")
+ set_kind("static")
+ add_files("src/nfd_win.cpp")
+ add_headerfiles("src/include/nfd.h")
+ add_headerfiles("src/include/nfd.hpp")
+ ]])
+ import("package.tools.xmake").install(package)
+ end)
+
+ on_install("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) \ No newline at end of file
diff --git a/third_party/packages/t/tinyfiledialogs/xmake.lua b/third_party/packages/t/tinyfiledialogs/xmake.lua
deleted file mode 100644
index 72dcca1..0000000
--- a/third_party/packages/t/tinyfiledialogs/xmake.lua
+++ /dev/null
@@ -1,35 +0,0 @@
-package("tinyfiledialogs")
-
-set_homepage("https://sourceforge.net/projects/tinyfiledialogs/")
-set_description("Native dialog library for WINDOWS MAC OSX GTK+ QT CONSOLE")
-set_license("zlib")
-
-add_urls("https://git.code.sf.net/p/tinyfiledialogs/code.git")
-
-if is_plat("windows", "mingw") then
- add_syslinks("comdlg32", "ole32", "user32", "shell32")
-end
-on_install("windows", "mingw", "linux", "macosx", function(package)
- io.writefile("xmake.lua", [[
- add_rules("mode.debug", "mode.release")
- target("tinyfiledialogs")
- set_kind("static")
- add_files("tinyfiledialogs.c")
- add_headerfiles("tinyfiledialogs.h")
- ]])
- import("package.tools.xmake").install(package)
-end)
-
-on_test(function(package)
- assert(package:check_csnippets({
- test = [[
- #include <stdio.h>
- #include <string.h>
- #include "tinyfiledialogs.h"
- void test() {
- char const * lWillBeGraphicMode;
- lWillBeGraphicMode = tinyfd_inputBox("tinyfd_query", NULL, NULL);
- }
- ]]
- }))
-end) \ No newline at end of file