xmake.lua 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package("dispenso")
  2. set_homepage("https://github.com/facebookincubator/dispenso")
  3. set_description("The project provides high-performance concurrency, enabling highly parallel computation.")
  4. set_license("MIT")
  5. add_urls("https://github.com/facebookincubator/dispenso/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/facebookincubator/dispenso.git")
  7. add_versions("v1.3.0", "824afe8d0d36bfd9bc9b1cbe9be89e7f3ed642a3612766d1c99d5f8dfc647c63")
  8. add_versions("v1.2.0", "a44d9cf2f9234f5cbdbe4050fd26e63f3266b64955731651adf04dbb7f6b31df")
  9. add_versions("v1.1.0", "581f95c16cd479692bc89448d0648f6ce24162454308c544c4d35bf5e9efe5c8")
  10. add_patches("1.2.0", "patches/1.2.0/namespace.patch", "a0c00cad221f05f9624a28c2e22f6e419b21b9832281cb875283bf89847b50f1")
  11. if is_plat("linux", "bsd") then
  12. add_syslinks("pthread")
  13. elseif is_plat("windows", "mingw") then
  14. add_defines("NOMINMAX")
  15. add_syslinks("winmm", "synchronization")
  16. end
  17. add_deps("cmake")
  18. add_deps("concurrentqueue")
  19. on_install("windows|x64", "linux", "macosx", "bsd", "mingw", "msys", "android", "iphoneos", "cross", "wasm", function (package)
  20. local configs = {}
  21. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  22. table.insert(configs, "-DDISPENSO_SHARED_LIB=" .. (package:config("shared") and "ON" or "OFF"))
  23. io.replace("dispenso/CMakeLists.txt", "-Werror", "", {plain = true})
  24. io.replace("dispenso/CMakeLists.txt", "/WX", "", {plain = true})
  25. io.replace("dispenso/CMakeLists.txt", "Synchronization", "Synchronization winmm", {plain = true})
  26. import("package.tools.cmake").install(package, configs)
  27. os.tryrm(package:installdir("include/dispenso/third-party"))
  28. end)
  29. on_test(function (package)
  30. assert(package:check_cxxsnippets({test = [[
  31. #include <dispenso/thread_pool.h>
  32. void test() {
  33. dispenso::ThreadPool& threadPool = dispenso::globalThreadPool();
  34. }
  35. ]]}, {configs = {languages = "c++14"}}))
  36. end)