xmake.lua 1.5 KB

1234567891011121314151617181920212223242526272829303132333435
  1. package("cxxopts")
  2. set_homepage("https://github.com/jarro2783/cxxopts")
  3. set_description("Lightweight C++ command line option parser")
  4. add_urls("https://github.com/jarro2783/cxxopts.git")
  5. add_urls("https://github.com/jarro2783/cxxopts/archive/$(version).tar.gz")
  6. add_versions("v3.0.0", "36f41fa2a46b3c1466613b63f3fa73dc24d912bc90d667147f1e43215a8c6d00")
  7. add_versions("v2.2.0", "447dbfc2361fce9742c5d1c9cfb25731c977b405f9085a738fbd608626da8a4d")
  8. if is_plat("mingw") and is_subhost("msys") then
  9. add_extsources("pacman::cxxopts")
  10. elseif is_plat("linux") then
  11. add_extsources("pacman::cxxopts-git", "apt::libcxxopts-dev")
  12. elseif is_plat("macosx") then
  13. add_extsources("brew::cxxopts")
  14. end
  15. on_install(function (package)
  16. os.cp("include/*.hpp", package:installdir("include"))
  17. end)
  18. on_test(function (package)
  19. assert(package:check_cxxsnippets({test = [[
  20. static void test() {
  21. cxxopts::Options options("MyProgram", "One line description of MyProgram");
  22. options.add_options()
  23. ("d,debug", "Enable debugging") // a bool parameter
  24. ("i,integer", "Int param", cxxopts::value<int>())
  25. ("f,file", "File name", cxxopts::value<std::string>())
  26. ("v,verbose", "Verbose output", cxxopts::value<bool>()->default_value("false"));
  27. }
  28. ]]}, {configs = {languages = "c++11"}, includes = "cxxopts.hpp"}))
  29. end)