pcapplusplus: add linux support and fix linkorders (#5367)

* pcapplusplus: add linux support and fix linkorders

* use add_links() to simplify setting linkorder

* Update xmake.lua

* redundant white space

---------

Co-authored-by: star9029 <hengxings783@gmail.com>
Co-authored-by: c8ef <c8ef@outlook.com>
pull/5369/head
Doekin 2 months ago committed by GitHub
parent cd7b705ca2
commit dbf3267c08
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 19
      packages/p/pcapplusplus/xmake.lua

@ -1,6 +1,7 @@
package("pcapplusplus") package("pcapplusplus")
set_homepage("https://github.com/seladb/PcapPlusPlus") set_homepage("https://github.com/seladb/PcapPlusPlus")
set_description("PcapPlusPlus is a multiplatform C++ library for capturing, parsing and crafting of network packets.") set_description("PcapPlusPlus is a multiplatform C++ library for capturing, parsing and crafting of network packets.")
set_license("Unlicense")
set_urls("https://github.com/seladb/PcapPlusPlus/archive/refs/tags/$(version).zip", set_urls("https://github.com/seladb/PcapPlusPlus/archive/refs/tags/$(version).zip",
"https://github.com/seladb/PcapPlusPlus.git") "https://github.com/seladb/PcapPlusPlus.git")
@ -10,16 +11,24 @@ package("pcapplusplus")
add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true}) add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
add_deps("cmake") add_links("Pcap++", "Packet++", "Common++")
if is_plat("windows") then if is_plat("windows") then
add_syslinks("ws2_32") add_syslinks("ws2_32")
end
add_deps("cmake")
if is_plat("windows") then
add_deps("npcap_sdk") add_deps("npcap_sdk")
elseif is_plat("linux") then
add_deps("libpcap")
end end
on_install("windows", function (package) on_install("windows", "linux", function (package)
local configs = {} local configs = {
table.insert(configs, "-DPCAPPP_BUILD_EXAMPLES=OFF") "-DPCAPPP_BUILD_EXAMPLES=OFF",
table.insert(configs, "-DPCAPPP_BUILD_TESTS=OFF") "-DPCAPPP_BUILD_TESTS=OFF",
}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release")) table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
import("package.tools.cmake").install(package, configs) import("package.tools.cmake").install(package, configs)
end) end)

Loading…
Cancel
Save