xmake.lua 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package("enkits")
  2. set_homepage("https://github.com/dougbinks/enkiTS")
  3. set_description("A permissively licensed C and C++ Task Scheduler for creating parallel programs.")
  4. set_license("zlib")
  5. add_urls("https://github.com/dougbinks/enkiTS/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/dougbinks/enkiTS.git")
  7. add_versions("v1.11", "b57a782a6a68146169d29d180d3553bfecb9f1a0e87a5159082331920e7d297e")
  8. add_versions("v1.10", "578f285fc7c2744bf831548f35b855c6ab06c0d541d08c9cc50b6b72a250811a")
  9. add_deps("cmake")
  10. add_linkdirs("lib/enkiTS")
  11. add_links("enkiTS")
  12. if is_plat("linux", "bsd") then
  13. add_syslinks("pthread", "rt")
  14. end
  15. on_load("windows", function (package)
  16. if package:config("shared") then
  17. package:add("defines", "ENKITS_DLL")
  18. end
  19. end)
  20. on_install(function (package)
  21. if package:is_plat("linux") then
  22. io.replace("src/TaskScheduler.h", "#include <functional>", "#include <functional>\n#include <initializer_list>\n", {plain = true})
  23. end
  24. local configs = {"-DENKITS_BUILD_EXAMPLES=OFF", "-DENKITS_INSTALL=ON"}
  25. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  26. table.insert(configs, "-DENKITS_BUILD_SHARED=" .. (package:config("shared") and "ON" or "OFF"))
  27. import("package.tools.cmake").install(package, configs)
  28. end)
  29. on_test(function (package)
  30. assert(package:check_cxxsnippets([[
  31. void test() {
  32. enki::TaskScheduler g_TS;
  33. g_TS.Initialize();
  34. }
  35. ]], {configs = {languages = "c++17"}, includes = "enkiTS/TaskScheduler.h"}))
  36. end)