xmake.lua 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  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. add_urls("https://github.com/rigtorp/MPMCQueue/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/rigtorp/MPMCQueue.git")
  7. add_versions("v1.0", "f009ef10b66f2b8bc6e3a4f50577efbdfea0c163464cd7de368378f173007b75")
  8. add_deps("cmake")
  9. on_install(function (package)
  10. io.replace("CMakeLists.txt", [[if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
  11. if (MSVC)
  12. add_compile_options(/permissive- /W4 /wd4172 /wd4324 /wd4530)
  13. else()
  14. add_compile_options(-Wall -Wextra -Wpedantic)
  15. endif()
  16. find_package(Threads REQUIRED)
  17. add_executable(MPMCQueueExample src/MPMCQueueExample.cpp)
  18. target_link_libraries(MPMCQueueExample MPMCQueue Threads::Threads)
  19. add_executable(MPMCQueueTest src/MPMCQueueTest.cpp)
  20. target_link_libraries(MPMCQueueTest MPMCQueue Threads::Threads)
  21. enable_testing()
  22. add_test(MPMCQueueTest MPMCQueueTest)
  23. endif()]], "", {plain = true})
  24. import("package.tools.cmake").install(package)
  25. end)
  26. on_test(function (package)
  27. assert(package:has_cxxtypes("rigtorp::mpmc::Queue<int>", {configs = {languages = "c++14"}, includes = "rigtorp/MPMCQueue.h"}))
  28. end)