xmake.lua 1.4 KB

123456789101112131415161718192021222324252627282930313233
  1. package("argh")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("https://github.com/adishavit/argh")
  4. set_description("Argh! A minimalist argument handler.")
  5. set_license("BSD-3-Clause")
  6. add_urls("https://github.com/adishavit/argh/archive/refs/tags/$(version).tar.gz",
  7. "https://github.com/adishavit/argh.git")
  8. add_versions("v1.3.2", "4b76d8c55e97cc0752feee4f00b99dc58464dd030dea9ba257c0a7d24a84f9dd")
  9. on_install(function (package)
  10. os.cp("argh.h", package:installdir("include"))
  11. end)
  12. on_test(function (package)
  13. assert(package:check_cxxsnippets({test = [[
  14. #include <iostream>
  15. using namespace std;
  16. int test(int argc, char* argv[]) {
  17. argh::parser cmdl;
  18. cmdl.parse(argc, argv, argh::parser::PREFER_PARAM_FOR_UNREG_OPTION);
  19. if (cmdl["-v"]) cout << "Verbose, I am." << endl;
  20. cout << "Positional args:\n";
  21. for (auto& pos_arg : cmdl) cout << '\t' << pos_arg << endl;
  22. cout << "\nFlags:\n";
  23. for (auto& flag : cmdl.flags()) cout << '\t' << flag << endl;
  24. cout << "\nParameters:\n";
  25. for (auto& param : cmdl.params()) cout << '\t' << param.first << " : " << param.second << endl;
  26. return EXIT_SUCCESS;
  27. }
  28. ]]}, {configs = {languages = "cxx17"}, includes = "argh.h"}))
  29. end)