xmake.lua 1.6 KB

1234567891011121314151617181920212223242526272829303132333435
  1. package("libenvpp")
  2. set_homepage("https://github.com/ph3at/libenvpp")
  3. set_description("A modern C++ library for type-safe environment variable parsing")
  4. set_license("Apache-2.0")
  5. add_urls("https://github.com/ph3at/libenvpp/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/ph3at/libenvpp.git")
  7. add_versions("v1.1.0", "c373a6867ed915ffdacbbebfa017e03c0797dc4c2eb173659f607024e9cfbac9")
  8. add_configs("shared", {description = "Build shared binaries.", default = false, type = "boolean", readonly = true})
  9. add_deps("cmake")
  10. add_deps("fmt >=9.1.0", {configs = {header_only = false}})
  11. on_install(function (package)
  12. local configs = {"-DLIBENVPP_EXAMPLES=OFF", "-DLIBENVPP_TESTS=OFF", "-DLIBENVPP_INSTALL=ON"}
  13. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  14. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  15. table.insert(configs, "-DLIBENVPP_CHECKS=" .. (package:is_debug() and "ON" or "OFF"))
  16. import("package.tools.cmake").install(package, configs)
  17. os.rm(package:installdir("include/fmt"))
  18. os.rm(package:installdir("lib/pkgconfig"))
  19. os.rm(package:installdir("lib/cmake/fmt"))
  20. os.rm(package:installdir("lib/fmt*"))
  21. end)
  22. on_test(function (package)
  23. assert(package:check_cxxsnippets({test = [[
  24. #include <libenvpp/env.hpp>
  25. void test() {
  26. auto pre = env::prefix("MYPROG");
  27. }
  28. ]]}, {configs = {languages = "c++17"}}))
  29. end)