Introduce cmake compile capability
This commit is contained in:
parent
e7425da25f
commit
ad2dd205f3
@ -1,5 +1,6 @@
|
||||
cmake_minimum_required (VERSION 2.8)
|
||||
|
||||
# cmake versions:
|
||||
# Debian 6 - 2.8.2
|
||||
# Debian 7 - 2.8.9
|
||||
# CentOS 6 - 2.8.12
|
||||
@ -7,31 +8,48 @@ cmake_minimum_required (VERSION 2.8)
|
||||
project(FastNetMon)
|
||||
|
||||
set (Tutorial_VERSION_MAJOR 1)
|
||||
set (Tutorial_VERSION_MINOR 0)
|
||||
set (Tutorial_VERSION_MINOR 1)
|
||||
|
||||
# Set path to home compiled PF_RING
|
||||
set(PFRING_INCLUDE_DIRS /opt/pf_ring/include)
|
||||
set(PFRING_LIBRARIES /opt/pf_ring/lib/libpfring.so)
|
||||
|
||||
# Some defines for FastNetMon compiation tuning
|
||||
add_definitions(-DENABLE_CONNTRACKING)
|
||||
add_definitions(-DPF_RING)
|
||||
|
||||
# Our LPM library
|
||||
add_library(libpatricia STATIC libpatricia/patricia.c)
|
||||
|
||||
# Main tool
|
||||
add_executable(fastnetmon fastnetmon.cpp)
|
||||
|
||||
# Find boost: http://www.cmake.org/cmake/help/v3.0/module/FindBoost.html
|
||||
find_package(Boost COMPONENTS threads regex)
|
||||
# Detailed errors
|
||||
set(Boost_DETAILED_FAILURE_MSG ON)
|
||||
find_package(Boost COMPONENTS thread regex REQUIRED)
|
||||
|
||||
if(Boost_FOUND)
|
||||
include_directories(${Boost_INCLUDE_DIRS})
|
||||
target_link_libraries(fastnetmon ${Boost_LIBRARIES})
|
||||
endif()
|
||||
|
||||
target_link_libraries(fastnetmon boost_regex)
|
||||
target_link_libraries(fastnetmon boost_thread)
|
||||
# Try to find ncurses library
|
||||
find_package(Curses REQUIRED)
|
||||
|
||||
if(CURSES_FOUND)
|
||||
include_directories(${CURSES_INCLUDE_DIRS})
|
||||
target_link_libraries(fastnetmon ${CURSES_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# External libs
|
||||
target_link_libraries(fastnetmon log4cpp)
|
||||
target_link_libraries(fastnetmon numa)
|
||||
target_link_libraries(fastnetmon ncurses)
|
||||
target_link_libraries(fastnetmon pthread)
|
||||
|
||||
# Our libs
|
||||
target_link_libraries(fastnetmon libpatricia)
|
||||
|
||||
include_directories(/opt/pf_ring/include)
|
||||
target_link_libraries(fastnetmon /opt/pf_ring/lib/libpfring.so)
|
||||
|
||||
include_directories(/opt/pf_ring/include)
|
||||
# Custom PF_RING
|
||||
include_directories(${PFRING_INCLUDE_DIRS})
|
||||
target_link_libraries(fastnetmon ${PFRING_LIBRARIES})
|
||||
|
@ -59,6 +59,14 @@ Install FastNetMon:
|
||||
cd fastnetmon
|
||||
```
|
||||
|
||||
Building FastNetMon with cmake:
|
||||
```bash
|
||||
cd /usr/src/fastnetmon
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
make
|
||||
```
|
||||
|
||||
Select backend, we use PF_RING as default, if you need PCAP you must change variable ENGINE in Makefile.
|
||||
Compile it:
|
||||
|
@ -105,12 +105,12 @@ sub install {
|
||||
print "Install FastNetMon dependency list\n";
|
||||
|
||||
if ($distro_type eq 'debian') {
|
||||
my @fastnetmon_deps = ("git", "g++", "gcc", "libboost-all-dev", "libgpm-dev", "libncurses5-dev", "liblog4cpp5-dev", "libnuma-dev", "libgeoip-dev","libpcap-dev", "clang");
|
||||
my @fastnetmon_deps = ("git", "g++", "gcc", "libboost-all-dev", "libgpm-dev", "libncurses5-dev", "liblog4cpp5-dev", "libnuma-dev", "libgeoip-dev","libpcap-dev", "clang", "cmake");
|
||||
|
||||
my $fastnetmon_deps_as_string = join " ", @fastnetmon_deps;
|
||||
`apt-get install -y --force-yes $fastnetmon_deps_as_string`;
|
||||
} elsif ($distro_type eq 'centos') {
|
||||
my @fastnetmon_deps = ('git', 'make', 'gcc', 'gcc-c++', 'boost-devel', 'GeoIP-devel', 'log4cpp-devel', 'ncurses-devel', 'glibc-static', 'ncurses-static', 'boost-thread', 'libpcap-devel', 'gpm-static', 'gpm-devel', 'clang');
|
||||
my @fastnetmon_deps = ('git', 'make', 'gcc', 'gcc-c++', 'boost-devel', 'GeoIP-devel', 'log4cpp-devel', 'ncurses-devel', 'glibc-static', 'ncurses-static', 'boost-thread', 'libpcap-devel', 'gpm-static', 'gpm-devel', 'clang', 'cmake');
|
||||
|
||||
my $fastnetmon_deps_as_string = join " ", @fastnetmon_deps;
|
||||
`yum install -y $fastnetmon_deps_as_string`;
|
||||
|
Loading…
Reference in New Issue
Block a user