xmake.lua 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package("nativefiledialog")
  2. set_homepage("https://github.com/mlabbe/nativefiledialog")
  3. set_description("A tiny, neat C library that portably invokes native file open and save dialogs.")
  4. set_license("zlib")
  5. add_urls("https://github.com/mlabbe/nativefiledialog/archive/refs/tags/release_$(version).tar.gz", {version = function (version) return version:gsub("%.", "") end})
  6. add_urls("https://github.com/mlabbe/nativefiledialog.git")
  7. add_versions("1.1.6", "1bbaed79b9c499c8d2a54f40f89277e721c0894bf3048bb247d826b96db6bc08")
  8. if is_plat("windows") then
  9. add_syslinks("shell32", "ole32")
  10. elseif is_plat("macosx") then
  11. add_frameworks("AppKit")
  12. end
  13. on_install("windows", "macosx", "linux", function (package)
  14. os.cd("src")
  15. io.writefile("xmake.lua", [[
  16. add_rules("mode.debug", "mode.release")
  17. target("nfd")
  18. set_kind("static")
  19. set_values("objc.build.arc", false)
  20. add_includedirs("include")
  21. add_files("nfd_common.c")
  22. if is_plat("windows") then
  23. add_defines("_CRT_SECURE_NO_WARNINGS")
  24. add_files("nfd_win.cpp")
  25. elseif is_plat("macosx") then
  26. add_files("nfd_cocoa.m")
  27. elseif is_plat("linux") then
  28. add_files("nfd_zenity.c")
  29. end
  30. add_headerfiles("include/nfd.h")
  31. ]])
  32. import("package.tools.xmake").install(package)
  33. end)
  34. on_test(function (package)
  35. assert(package:check_csnippets({test = [[
  36. void test() {
  37. nfdchar_t *outPath = NULL;
  38. nfdresult_t result = NFD_OpenDialog( NULL, NULL, &outPath );
  39. }
  40. ]]}, {includes = "nfd.h"}))
  41. end)