From b6173309e9993f13d2bc43abaf82d62e7a1889e8 Mon Sep 17 00:00:00 2001 From: Pavel Odintsov Date: Wed, 30 Sep 2015 12:41:59 +0300 Subject: [PATCH 1/2] Add version information for console. Closes #417 --- src/fastnetmon.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/fastnetmon.cpp b/src/fastnetmon.cpp index 87083c6a..218b58f5 100644 --- a/src/fastnetmon.cpp +++ b/src/fastnetmon.cpp @@ -2404,6 +2404,7 @@ int main(int argc, char** argv) { po::options_description desc("Allowed options"); desc.add_options() ("help", "produce help message") + ("version", "show version") ("daemonize", "detach from the terminal") ("configuration_file", po::value(), "set path to custom configuration file") ; @@ -2414,7 +2415,12 @@ int main(int argc, char** argv) { if (vm.count("help")) { std::cout << desc << std::endl; - exit(EXIT_FAILURE); + exit(EXIT_SUCCESS); + } + + if (vm.count("version")) { + std::cout << "Version: " << fastnetmon_version << std::endl; + exit(EXIT_SUCCESS); } if (vm.count("daemonize")) { From acce07774d662ee9744487a2a4a6d385d995276f Mon Sep 17 00:00:00 2001 From: Pavel Odintsov Date: Wed, 30 Sep 2015 14:00:09 +0300 Subject: [PATCH 2/2] Add git version to fastnetmon version. Closes #258 --- src/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f668a075..15612a6f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -70,7 +70,10 @@ if (FASTNETMON_PROFILER) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${FASTNETMON_PROFILE_FLAGS}") endif() -set(FASTNETMON_APPLICATION_VERSION "1.1.3 master") +# Get last commit hash +execute_process(COMMAND git rev-list HEAD COMMAND head -n 1 OUTPUT_VARIABLE GIT_LAST_COMMIT_HASH OUTPUT_STRIP_TRAILING_WHITESPACE) + +set(FASTNETMON_APPLICATION_VERSION "1.1.3 master git-${GIT_LAST_COMMIT_HASH}") configure_file(fast_platform.h.template "${PROJECT_SOURCE_DIR}/fast_platform.h") # With this flag we can diable PF_RING build via console: cmake .. -DDISABLE_PF_RING_SUPPORT=ON