xmake.lua 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package("simplethreadpool")
  2. set_homepage("https://github.com/romch007/simplethreadpool")
  3. set_description("Simple thread pooling library in C++")
  4. set_license("MIT")
  5. add_urls("https://github.com/romch007/simplethreadpool.git")
  6. add_versions("2022.11.18", "e0eabdf732394a810f1dd1eeec0efee4954bf5b7")
  7. if is_plat("linux", "bsd") then
  8. add_syslinks("pthread")
  9. end
  10. on_load(function (package)
  11. if not package:config("shared") then
  12. package:add("defines", "SIMPLETHREADPOOL_STATIC")
  13. end
  14. end)
  15. on_install("linux", "macosx", "windows", "bsd", "android", "iphoneos", "cross", function (package)
  16. local configs = {}
  17. configs.kind = package:config("shared") and "shared" or "static"
  18. import("package.tools.xmake").install(package, configs)
  19. end)
  20. on_test(function (package)
  21. assert(package:check_cxxsnippets({test = [[
  22. void test() {
  23. simplethreadpool::pool p;
  24. int counter = 0;
  25. p.push([&] {
  26. counter++;
  27. });
  28. p.start();
  29. while (p.busy());
  30. }
  31. ]]}, {configs = {languages = "c++17"}, includes = "simplethreadpool/pool.hpp"}))
  32. end)