xmake.lua 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package("platformfolders")
  2. set_homepage("https://github.com/sago007/PlatformFolders")
  3. set_description([[A C++ library to look for special directories like "My Documents" and "%APPDATA%" so that you do not need to write Linux, Windows or Mac OS X specific code]])
  4. set_license("MIT")
  5. add_urls("https://github.com/sago007/PlatformFolders/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/sago007/PlatformFolders.git")
  7. add_versions("4.3.0", "4d1c3139882c55f4f1206d89157a699224476e17fbeda68d891ddfb61f901ffd")
  8. add_versions("4.2.0", "31bb0f64a27315aec8994f226332aaafe9888d00bb69a2ff2dff9912e2f4ccf4")
  9. add_patches(">=4.2.0", "patches/4.2.0/cmake-install.patch", "a38850ff7e9b91034f226685af7633ff692de3aea4798cb3dddecc6b055a7601")
  10. if is_plat("wasm") then
  11. add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
  12. end
  13. if is_plat("windows", "mingw") then
  14. add_syslinks("ole32", "shell32", "uuid")
  15. end
  16. add_deps("cmake")
  17. on_install(function (package)
  18. local configs = {"-DPLATFORMFOLDERS_BUILD_TESTING=OFF"}
  19. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  20. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  21. if package:is_plat("windows") and package:config("shared") then
  22. table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON")
  23. end
  24. import("package.tools.cmake").install(package, configs)
  25. end)
  26. on_test(function (package)
  27. assert(package:check_cxxsnippets({test = [[
  28. void test() {
  29. sago::getConfigHome();
  30. }
  31. ]]}, {configs = {languages = "c++11"}, includes = "sago/platform_folders.h"}))
  32. end)