-
Notifications
You must be signed in to change notification settings - Fork 0
/
conanfile.py
41 lines (34 loc) · 1.61 KB
/
conanfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from conans import ConanFile, AutoToolsBuildEnvironment, tools
class PcapplusplusConan(ConanFile):
name = "PcapPlusPlus"
version = "v18.08"
license = "Apache 2.0"
url = "https://github.com/AndreyBronin/conan-PcapPlusPlus"
description = "Conan package for PcapPlusPlus"
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"
requires = "libpcap/1.9.0@andreybronin/stable"
def source(self):
#git = tools.Git(folder="PcapPlusPlus")
self.run("git clone --branch v18.08 --depth 1 https://github.com/seladb/PcapPlusPlus.git")
def build(self):
libpcap_info = self.deps_cpp_info["libpcap"]
include_path = libpcap_info.include_paths[0]
lib_path = libpcap_info.lib_paths[0]
with tools.chdir("PcapPlusPlus"):
if self.settings.os == "Linux":
self.run("./configure-linux.sh --default")
elif self.settings.os == "Macos":
self.run("./configure-mac_os_x.sh --default")
elif self.settings.os == "Windows":
raise ConanException("Windows is not supported yet")
else:
raise ConanException("%s is not supported" % self.settings.os)
build_flags = '-I%s' % include_path
build_flags += ' -L%s' % lib_path
self.run("make -e PCAPPP_BUILD_FLAGS='%s' libs -j5" % build_flags)
def package(self):
self.copy("*.h", dst="include", src="PcapPlusPlus/Dist/header")
self.copy("*.a", dst="lib", keep_path=False)
def package_info(self):
self.cpp_info.libs = ["Packet++", "Pcap++", "Common++"]