xmake.lua 1.0 KB

123456789101112131415161718192021222324252627
  1. package("cmdline")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("https://github.com/tanakh/cmdline")
  4. set_description("A Command Line Parser")
  5. set_license("BSD-3-Clause")
  6. add_urls("https://github.com/tanakh/cmdline.git")
  7. add_versions("2014.2.4", "e4cd007fb8f0314002d9a5b4d82939106e4144e4")
  8. on_install("linux", "macosx", "bsd", "mingw", function (package)
  9. os.cp("cmdline.h", package:installdir("include"))
  10. end)
  11. on_test(function (package)
  12. assert(package:check_cxxsnippets({test = [[
  13. #include <cmdline.h>
  14. using namespace std;
  15. static void test() {
  16. cmdline::parser a;
  17. a.add<string>("host", 'h', "host name", true, "");
  18. a.add<int>("port", 'p', "port number", false, 80, cmdline::range(1, 65535));
  19. a.add<string>("type", 't', "protocol type", false, "http", cmdline::oneof<string>("http", "https", "ssh", "ftp"));
  20. a.add("gzip", '\0', "gzip when transfer");
  21. }
  22. ]]}))
  23. end)