xmake.lua 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. package("mpmcqueue")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("https://github.com/rigtorp/MPMCQueue")
  4. set_description("A bounded multi-producer multi-consumer concurrent queue written in C++11")
  5. set_license("MIT")
  6. add_urls("https://github.com/rigtorp/MPMCQueue/archive/refs/tags/$(version).tar.gz",
  7. "https://github.com/rigtorp/MPMCQueue.git")
  8. add_versions("v1.0", "f009ef10b66f2b8bc6e3a4f50577efbdfea0c163464cd7de368378f173007b75")
  9. add_deps("cmake")
  10. on_install(function (package)
  11. io.replace("CMakeLists.txt", [[if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
  12. if (MSVC)
  13. add_compile_options(/permissive- /W4 /wd4172 /wd4324 /wd4530)
  14. else()
  15. add_compile_options(-Wall -Wextra -Wpedantic)
  16. endif()
  17. find_package(Threads REQUIRED)
  18. add_executable(MPMCQueueExample src/MPMCQueueExample.cpp)
  19. target_link_libraries(MPMCQueueExample MPMCQueue Threads::Threads)
  20. add_executable(MPMCQueueTest src/MPMCQueueTest.cpp)
  21. target_link_libraries(MPMCQueueTest MPMCQueue Threads::Threads)
  22. enable_testing()
  23. add_test(MPMCQueueTest MPMCQueueTest)
  24. endif()]], "", {plain = true})
  25. import("package.tools.cmake").install(package)
  26. end)
  27. on_test(function (package)
  28. assert(package:has_cxxtypes("rigtorp::mpmc::Queue<int>", {configs = {languages = "c++14"}, includes = "rigtorp/MPMCQueue.h"}))
  29. end)