Skip to content

Commit

Permalink
Added version
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahmoud Ismail committed Jun 3, 2016
1 parent dab2b61 commit ec193ae
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
project (ePipe)

cmake_minimum_required (VERSION 2.8)

set(EPIPE_VERSION_MAJOR 0)
set(EPIPE_VERSION_MINOR 0)
set(EPIPE_VERSION_BUILD 1)
configure_file(Version.h.in ${CMAKE_SOURCE_DIR}/include/Version.h)

set(Boost_USE_STATIC_LIBS ON)

find_package(Boost 1.54 REQUIRED COMPONENTS system date_time program_options thread)
Expand Down
33 changes: 33 additions & 0 deletions Version.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright (C) 2016 Hops.io
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

/*
* File: Version.h.in
* Author: Mahmoud Ismail<[email protected]>
*
*/

#ifndef VERSION_H_IN
#define VERSION_H_IN

#define EPIPE_VERSION_MAJOR @EPIPE_VERSION_MAJOR@
#define EPIPE_VERSION_MINOR @EPIPE_VERSION_MINOR@
#define EPIPE_VERSION_BUILD @EPIPE_VERSION_BUILD@

#endif /* VERSION_H_IN */

33 changes: 33 additions & 0 deletions include/Version.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright (C) 2016 Hops.io
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

/*
* File: Version.h.in
* Author: Mahmoud Ismail<[email protected]>
*
*/

#ifndef VERSION_H_IN
#define VERSION_H_IN

#define EPIPE_VERSION_MAJOR 0
#define EPIPE_VERSION_MINOR 0
#define EPIPE_VERSION_BUILD 1

#endif /* VERSION_H_IN */

10 changes: 9 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
#include "Notifier.h"
#include <boost/program_options.hpp>
#include "Version.h"

namespace po = boost::program_options;

Expand All @@ -45,6 +46,7 @@ int main(int argc, char** argv) {
("inode_type", po::value<string>()->default_value("inode"), "Elastic type for inodes.")
("lru_cap", po::value<int>()->default_value(DEFAULT_MAX_CAPACITY), "LRU Cache max capacity")
("log_level", po::value<int>()->default_value(2), "log level trace=0, debug=1, info=2, warn=3, error=4, fatal=5")
("version", "ePipe version")
;


Expand All @@ -70,10 +72,16 @@ int main(int argc, char** argv) {
po::notify(vm);

if (vm.count("help")) {
cout << desc << "\n";
cout << desc << endl;
return EXIT_SUCCESS;
}

if (vm.count("version")) {
cout << "ePipe " << EPIPE_VERSION_MAJOR << "." << EPIPE_VERSION_MINOR
<< "." << EPIPE_VERSION_BUILD << endl;
return EXIT_SUCCESS;
}

if (vm.count("connection")) {
connection_string = vm["connection"].as<string>();
}
Expand Down

0 comments on commit ec193ae

Please sign in to comment.