xmake.lua 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package("libtins")
  2. set_homepage("http://libtins.github.io/")
  3. set_description("High-level, multiplatform C++ network packet sniffing and crafting library.")
  4. set_license("BSD-2-Clause")
  5. set_urls("https://github.com/mfontanini/libtins/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/mfontanini/libtins.git")
  7. add_versions("v4.5", "6ff5fe1ada10daef8538743dccb9c9b3e19d05d028ffdc24838e62ff3fc55841")
  8. add_versions("v4.4", "ff0121b4ec070407e29720c801b7e1a972042300d37560a62c57abadc9635634")
  9. add_deps("cmake", "boost")
  10. if is_plat("windows") then
  11. add_syslinks("ws2_32", "iphlpapi")
  12. end
  13. on_load("windows", function (package)
  14. if not package:config("shared") then
  15. package:add("defines", "TINS_STATIC")
  16. end
  17. end)
  18. on_install("linux", "windows", "macosx", function (package)
  19. local configs = {
  20. "-DCMAKE_INSTALL_LIBDIR=lib",
  21. "-DLIBTINS_BUILD_EXAMPLES=OFF",
  22. "-DLIBTINS_BUILD_TESTS=OFF",
  23. "-DLIBTINS_ENABLE_PCAP=OFF",
  24. "-DLIBTINS_ENABLE_DOT11=OFF",
  25. "-DLIBTINS_ENABLE_WPA2=OFF",
  26. "-DLIBTINS_ENABLE_TCPIP=OFF",
  27. "-DLIBTINS_ENABLE_ACK_TRACKER=OFF",
  28. "-DLIBTINS_ENABLE_TCP_STREAM_CUSTOM_DATA=OFF",
  29. "-DLIBTINS_ENABLE_WPA2_CALLBACKS=OFF"
  30. }
  31. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  32. table.insert(configs, "-DLIBTINS_BUILD_SHARED=" .. (package:config("shared") and "ON" or "OFF"))
  33. import("package.tools.cmake").install(package, configs)
  34. end)
  35. on_test(function (package)
  36. assert(package:check_cxxsnippets({test = [[
  37. #include <string>
  38. using namespace Tins;
  39. void test() {
  40. std::string name = NetworkInterface::default_interface().name();
  41. printf("%s\n", name.c_str());
  42. }
  43. ]]}, {configs = {languages = "c++11"}, includes = {"tins/tins.h"}}))
  44. end)