2
0

xmake.lua 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package("concurrencpp")
  2. set_homepage("https://github.com/David-Haim/concurrencpp")
  3. set_description("Modern concurrency for C++. Tasks, executors, timers and C++20 coroutines to rule them all")
  4. set_license("MIT")
  5. add_urls("https://github.com/David-Haim/concurrencpp/archive/refs/tags/$(version).tar.gz", {version = function (version)
  6. return "v." .. version
  7. end})
  8. add_urls("https://github.com/David-Haim/concurrencpp.git")
  9. add_versions("0.1.5", "330150ebe11b3d30ffcb3efdecc184a34cf50a6bd43b68e294a496225d286651")
  10. add_versions("0.1.6", "e7d5c23a73ff1d7199d361d3402ad2a710dfccf7630b622346df94a7532b4221")
  11. add_versions("0.1.7", "049f3e83ad1828e0b8b518652de1a3160d5849fdff03d521d0a5af0167338e89")
  12. add_deps("cmake")
  13. if is_plat("windows") then
  14. add_syslinks("synchronization", "ws2_32", "mswsock")
  15. elseif is_plat("linux", "bsd") then
  16. add_syslinks("pthread")
  17. end
  18. on_load(function (package)
  19. package:add("includedirs", "include/concurrencpp-" .. package:version_str())
  20. end)
  21. on_install("macosx", "windows", function (package)
  22. assert(package:has_tool("cxx", "clang", "cl"), "compiler not supported!")
  23. local configs = {}
  24. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  25. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  26. import("package.tools.cmake").install(package, configs)
  27. end)
  28. on_test(function (package)
  29. assert(package:check_cxxsnippets({test = [[
  30. #include "concurrencpp/concurrencpp.h"
  31. #include <iostream>
  32. void test() {
  33. concurrencpp::runtime runtime;
  34. auto result = runtime.thread_executor()->submit([] {
  35. std::cout << "hello world" << std::endl;
  36. });
  37. result.get();
  38. }
  39. ]]}, {configs = {languages = "c++20"}}))
  40. end)