From 1bbefbfc36fa427813aee06143819ed5a8ecfe20 Mon Sep 17 00:00:00 2001 From: Pavel Odintsov Date: Sat, 24 Jan 2015 18:23:08 +0300 Subject: [PATCH] Add ability to build fastnetmon without PF_RING support for build at Travis CI --- travis_disabled => .travis.yml | 2 +- CMakeLists.txt | 31 ++++++++++++++++++------------- 2 files changed, 19 insertions(+), 14 deletions(-) rename travis_disabled => .travis.yml (90%) diff --git a/travis_disabled b/.travis.yml similarity index 90% rename from travis_disabled rename to .travis.yml index 993b9b2..90196ac 100644 --- a/travis_disabled +++ b/.travis.yml @@ -13,7 +13,7 @@ before_script: - sudo apt-get install -y build-essential bison flex libnuma-dev wget tar make - cd PF_RING-6.0.2; cd userland/lib; ./configure --prefix=/opt/pf_ring; make; sudo make install - cd `cat /tmp/old_current_path` -script: mkdir -p build; cd build; cmake ..; make +script: mkdir -p build; cd build; cmake .. -DDISABLE_PF_RING_SUPPORT=ON; make notifications: email: recipients: diff --git a/CMakeLists.txt b/CMakeLists.txt index 3dc2906..d2f7ba3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,19 +24,22 @@ if (FASTNETMON_PROFILER) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${FASTNETMON_PROFILE_FLAGS}") endif() -# Set path to home compiled PF_RING -set(PFRING_INCLUDE_DIRS /opt/pf_ring/include) -set(PFRING_LIBRARIES /opt/pf_ring/lib/libpfring.so) - -if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - message("You are running Linux and we can build PF_RING support") - # Fefines for enable PF_RING for FastNetMon compiation - add_definitions(-DPF_RING) -else() - message("You are running not an Linux and we can't build PF_RING support") +# With this flag we can diable PF_RING build via console: cmake .. -DDISABLE_PF_RING_SUPPORT=ON +if (NOT DISABLE_PF_RING_SUPPORT) + if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + message("You are running Linux and we can build PF_RING support") + set (ENABLE_PFRING_SUPPORT ON) + else() + message("You are running not an Linux and we can't build PF_RING support") + endif() endif() - +if (ENABLE_PFRING_SUPPORT) + # Set path to home compiled PF_RING + set(PFRING_INCLUDE_DIRS /opt/pf_ring/include) + set(PFRING_LIBRARIES /opt/pf_ring/lib/libpfring.so) + add_definitions(-DPF_RING) +endif() # If you need hardware locking features # add_definitions(-DHWFILTER_LOCKING) @@ -92,6 +95,8 @@ target_link_libraries(fastnetmon patricia) target_link_libraries(fastnetmon sflow_plugin) target_link_libraries(fastnetmon netflow_plugin) -# Custom PF_RING -include_directories(${PFRING_INCLUDE_DIRS}) +if (ENABLE_PFRING_SUPPORT) + # Custom PF_RING + include_directories(${PFRING_INCLUDE_DIRS}) +endif() target_link_libraries(fastnetmon ${PFRING_LIBRARIES})