Skip to content

Commit

Permalink
Show version number in --help output (#260)
Browse files Browse the repository at this point in the history
  • Loading branch information
systemed authored Jul 2, 2021
1 parent 60d087d commit 5dff747
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ include_directories(${ZLIB_INCLUDE_DIR})

set(CMAKE_CXX_STANDARD 14)

execute_process(
COMMAND git describe --tags --abbrev=0
OUTPUT_VARIABLE tm_version)
add_compile_definitions(TM_VERSION=${tm_version})

if(MSVC)
find_package(unofficial-sqlite3 CONFIG REQUIRED)
add_definitions(-D_USE_MATH_DEFINES -DWIN32_LEAN_AND_MEAN -DNOGDI)
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ endif

# Main includes

CXXFLAGS := -O3 -Wall -Wno-unknown-pragmas -Wno-sign-compare -std=c++14 -pthread -fPIE $(CONFIG)
TM_VERSION := $(shell git describe --tags --abbrev=0)
CXXFLAGS := -O3 -Wall -Wno-unknown-pragmas -Wno-sign-compare -std=c++14 -pthread -fPIE -DTM_VERSION=$(TM_VERSION) $(CONFIG)
LIB := -L/usr/local/lib -lz $(LUA_LIBS) -lboost_program_options -lsqlite3 -lboost_filesystem -lboost_system -lboost_iostreams -lprotobuf -lshp
INC := -I/usr/local/include -isystem ./include -I./src $(LUA_CFLAGS)

Expand Down
8 changes: 7 additions & 1 deletion src/tilemaker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@
#include <boost/asio/post.hpp>
#include <boost/interprocess/streams/bufferstream.hpp>

#ifndef TM_VERSION
#define TM_VERSION (version not set)
#endif
#define STR1(x) #x
#define STR(x) STR1(x)

// Namespaces
using namespace std;
namespace po = boost::program_options;
Expand Down Expand Up @@ -137,7 +143,7 @@ int main(int argc, char* argv[]) {
string outputFile;
bool _verbose = false, sqlite= false, mergeSqlite = false, mapsplit = false;

po::options_description desc("tilemaker (c) 2016-2020 Richard Fairhurst and contributors\nConvert OpenStreetMap .pbf files into vector tiles\n\nAvailable options");
po::options_description desc("tilemaker " STR(TM_VERSION) "\nConvert OpenStreetMap .pbf files into vector tiles\n\nAvailable options");
desc.add_options()
("help", "show help message")
("input", po::value< vector<string> >(&inputFiles), "source .osm.pbf file")
Expand Down

0 comments on commit 5dff747

Please sign in to comment.