Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PcapPlusPlus: enhance platform support and fix missing syslink on Windows #5419

Merged
merged 10 commits into from
Oct 6, 2024
18 changes: 13 additions & 5 deletions packages/p/pcapplusplus/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ package("pcapplusplus")

add_links("Pcap++", "Packet++", "Common++")

if is_plat("windows") then
add_syslinks("ws2_32")
if is_plat("windows") or is_plat("mingw") then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if is_plat("windows", "mingw") then

add_syslinks("ws2_32", "iphlpapi")
end

add_deps("cmake")
if is_plat("windows") then
if is_plat("windows") or is_plat("mingw") then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it.

add_deps("npcap_sdk")
elseif is_plat("linux") then
add_deps("libpcap")
end

on_install("windows", "linux", function (package)
on_install("windows", "mingw", "linux", function (package)
local configs = {
"-DPCAPPP_BUILD_EXAMPLES=OFF",
"-DPCAPPP_BUILD_TESTS=OFF",
Expand All @@ -35,11 +35,19 @@ package("pcapplusplus")

on_test(function (package)
assert(package:check_cxxsnippets({test = [[
#include <vector>
#include "pcapplusplus/IPv4Layer.h"
#include "pcapplusplus/Packet.h"
#include "pcapplusplus/PcapFileDevice.h"
void test() {
#include "pcapplusplus/PcapLiveDeviceList.h"

void testPcapFileReaderDevice() {
pcpp::PcapFileReaderDevice reader("1_packet.pcap");
}

void testPcapLiveDeviceList() {
std::vector<pcpp::PcapLiveDevice *> devList =
pcpp::PcapLiveDeviceList::getInstance().getPcapLiveDevicesList();
}
]]}, {configs = {languages = "c++17"}}))
end)
Loading