xmake.lua 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. package("cpp-ipc")
  2. set_homepage("https://github.com/mutouyun/cpp-ipc")
  3. set_description("A high-performance inter-process communication using shared memory on Linux/Windows")
  4. set_license("MIT")
  5. set_urls("https://github.com/mutouyun/cpp-ipc/archive/refs/tags/v$(version).zip",
  6. "https://github.com/mutouyun/cpp-ipc.git")
  7. add_versions("1.2.0", "31739760d8f191c7aaf71d1c453fce1989d1f74fdee9a61f9fdd475b29fe1888")
  8. add_deps("cmake")
  9. if is_plat("windows") then
  10. add_syslinks("advapi32")
  11. end
  12. on_install("windows", "linux", "mingw", function (package)
  13. local configs = {"-DLIBIPC_BUILD_TESTS=OFF", "-DLIBIPC_BUILD_DEMOS=OFF"}
  14. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  15. table.insert(configs, "-DLIBIPC_BUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  16. if package:is_plat("windows") and package:config("vs_runtime"):startswith("MD") then
  17. table.insert(configs, "-DLIBIPC_USE_STATIC_CRT=OFF")
  18. else
  19. table.insert(configs, "-DLIBIPC_USE_STATIC_CRT=ON")
  20. end
  21. import("package.tools.cmake").install(package, configs)
  22. end)
  23. on_test(function (package)
  24. assert(package:check_cxxsnippets({test = [[
  25. #include "libipc/ipc.h"
  26. void test() { ipc::route cc { "my-ipc-route" }; }
  27. ]]}, {configs = {languages = "c++17"}}))
  28. end)