From abb3c1abf0301481545a24445ad2bd4263fceb2b Mon Sep 17 00:00:00 2001 From: derek Date: Mon, 25 Oct 2010 14:10:42 -0400 Subject: [PATCH] Updated BamTools version information. * Also automated version information propagation forfuture updates. Only need to set version in top-level Makefile. --- Makefile | 15 +++++++++------ src/toolkit/bamtools.cpp | 37 +++++++++++++++++++------------------ 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index 1dc3f7b..f282c20 100644 --- a/Makefile +++ b/Makefile @@ -5,19 +5,22 @@ # top-level # ========================== +# define current BamTools version +BT_MAJOR_VER = 0 +BT_MINOR_VER = 8 +BT_BUILD_VER = 1025 +export BT_VERSION = $(BT_MAJOR_VER).$(BT_MINOR_VER).$(BT_BUILD_VER) + # define main directories export OBJ_DIR = obj export BIN_DIR = bin export SRC_DIR = src # define compile/link flags -export CXX = g++ -export CXXFLAGS = -Wall -O3 -D_FILE_OFFSET_BITS=64 +export CXX = g++ +export CXXFLAGS = -Wall -O3 -D_FILE_OFFSET_BITS=64 -DBT_VERSION=$(BT_VERSION) export LIBS = -lz -# define current BamTools version -export BAMTOOLS_VERSION = 0.7.0812 - # define source subdirectories SUBDIRS = $(SRC_DIR)/api \ $(SRC_DIR)/utils \ @@ -26,7 +29,7 @@ SUBDIRS = $(SRC_DIR)/api \ all: @echo "Building BamTools:" - @echo "Version: $$BAMTOOLS_VERSION" + @echo "Version: $$BT_VERSION" @echo "=========================================================" @echo "" @echo "- Creating target directories" diff --git a/src/toolkit/bamtools.cpp b/src/toolkit/bamtools.cpp index 160ff9a..6c5c1f6 100644 --- a/src/toolkit/bamtools.cpp +++ b/src/toolkit/bamtools.cpp @@ -3,12 +3,20 @@ // Marth Lab, Department of Biology, Boston College // All rights reserved. // --------------------------------------------------------------------------- -// Last modified: 12 October 2010 +// Last modified: 25 October 2010 // --------------------------------------------------------------------------- // Integrates a number of BamTools functionalities into a single executable. // *************************************************************************** +// stringify version information +#define BAMTOOLS_VER1_(x) #x +#define BAMTOOLS_VER_(x) BAMTOOLS_VER1_(x) +#define BAMTOOLS_VERSION BAMTOOLS_VER_(BT_VERSION) + +// includes +#include #include +#include #include "bamtools_convert.h" #include "bamtools_count.h" #include "bamtools_coverage.h" @@ -23,9 +31,7 @@ using namespace std; using namespace BamTools; -// ------------------------------------------ // bamtools subtool names - static const string CONVERT = "convert"; static const string COUNT = "count"; static const string COVERAGE = "coverage"; @@ -38,31 +44,29 @@ static const string SORT = "sort"; static const string SPLIT = "split"; static const string STATS = "stats"; -// ------------------------------------------ -// bamtools help/version names - -static const string HELP = "help"; -static const string LONG_HELP = "--help"; -static const string SHORT_HELP = "-h"; - +// bamtools help/version constants +static const string HELP = "help"; +static const string LONG_HELP = "--help"; +static const string SHORT_HELP = "-h"; static const string VERSION = "version"; static const string LONG_VERSION = "--version"; static const string SHORT_VERSION = "-v"; +// determine if string is a help constant static bool IsHelp(char* str) { return ( str == HELP || str == LONG_HELP || str == SHORT_HELP ); } +// determine if string is a version constant static bool IsVersion(char* str) { return ( str == VERSION || str == LONG_VERSION || str == SHORT_VERSION ); } -// ------------------------------------------ -// Subtool factory method +// subtool factory method AbstractTool* CreateTool(const string& arg) { // determine tool type based on arg @@ -82,8 +86,7 @@ AbstractTool* CreateTool(const string& arg) { return 0; } -// ------------------------------------------ -// Print help info +// print help info int Help(int argc, char* argv[]) { // check for 'bamtools help COMMAND' to print tool-specific help message @@ -118,11 +121,10 @@ int Help(int argc, char* argv[]) { return 0; } -// ------------------------------------------ -// Print version info +// print version info int Version(void) { cout << endl; - cout << "bamtools v0.8.xx" << endl; + cout << "bamtools " << BAMTOOLS_VERSION << endl; cout << "Part of BamTools API and toolkit" << endl; cout << "Primary authors: Derek Barnett, Erik Garrison, Michael Stromberg" << endl; cout << "(c) 2009-2010 Marth Lab, Biology Dept., Boston College" << endl; @@ -130,7 +132,6 @@ int Version(void) { return 0; } -// ------------------------------------------ // toolkit entry point int main(int argc, char* argv[]) { -- 2.39.2