xmake.lua 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package("imgui-file-dialog")
  2. set_homepage("https://github.com/aiekick/ImGuiFileDialog")
  3. set_description("File Dialog for Dear ImGui")
  4. set_license("MIT")
  5. add_urls("https://github.com/aiekick/ImGuiFileDialog/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/aiekick/ImGuiFileDialog.git")
  7. add_versions("v0.6.6", "75420f6eaf74fb1fa22042713f573858d8549366e7741baaf91128eb065b4b47")
  8. add_versions("v0.6.5", "3fac0f2cfc92b3f2c806e6743236467d0f691e54b1747a3955b82ef28b13e2fa")
  9. if is_plat("mingw") then
  10. add_configs("shared", {description = "Build shared binaries.", default = false, type = "boolean", readonly = true})
  11. end
  12. add_deps("imgui")
  13. if is_plat("windows") then
  14. add_deps("dirent")
  15. end
  16. on_install("windows", "linux", "macosx", "mingw", "android", function (package)
  17. local configs = {}
  18. io.writefile("xmake.lua", [[
  19. add_requires("imgui")
  20. if is_plat("windows") then
  21. add_requires("dirent")
  22. add_packages("dirent")
  23. end
  24. add_rules("mode.debug", "mode.release")
  25. target("imgui-file-dialog")
  26. set_kind("$(kind)")
  27. set_languages("c++11")
  28. add_files("ImGuiFileDialog.cpp")
  29. add_headerfiles("ImGuiFileDialog.h", "ImGuiFileDialogConfig.h")
  30. add_packages("imgui")
  31. if is_plat("windows") and is_kind("shared") then
  32. add_rules("utils.symbols.export_all", {export_classes = true})
  33. end
  34. ]])
  35. import("package.tools.xmake").install(package, configs)
  36. end)
  37. on_test(function (package)
  38. assert(package:check_cxxsnippets({test = [[
  39. #include <ImGuiFileDialog.h>
  40. void test() {
  41. ImGuiFileDialog::Instance()->OpenDialog("ChooseFileDlgKey", "Choose File", ".cpp,.h,.hpp", ".");
  42. }
  43. ]]}, {configs = {languages = "c++11"}}))
  44. end)