Skip to content

Commit

Permalink
version string broken into major, minor and patch
Browse files Browse the repository at this point in the history
This is much easier to use in preprocessing directives.

Signed-off-by: Rodrigo Tobar <rtobar@icrar.org>
  • Loading branch information
rtobar committed Oct 23, 2017
1 parent ac3cff6 commit 62042ec
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Expand Up @@ -26,6 +26,10 @@ cmake_minimum_required(VERSION 3.1)

# We have the version here
file(STRINGS ${CMAKE_SOURCE_DIR}/VERSION PROFIT_VERSION)
string(REPLACE "." ";" VERSION_LIST ${PROFIT_VERSION})
list(GET VERSION_LIST 0 PROFIT_VERSION_MAJOR)
list(GET VERSION_LIST 1 PROFIT_VERSION_MINOR)
list(GET VERSION_LIST 2 PROFIT_VERSION_PATCH)

# We have only C++ sources, but until cmake 3.4 the check_symbol_exists
# macro didn't work properly if only defining C++ as the project language
Expand Down
4 changes: 3 additions & 1 deletion profit/config.h.in
Expand Up @@ -28,7 +28,9 @@
#define PROFIT_CONFIG_H

/** The version of libprofit */
#define PROFIT_VERSION "@PROFIT_VERSION@"
#define PROFIT_VERSION_MAJOR @PROFIT_VERSION_MAJOR@
#define PROFIT_VERSION_MINOR @PROFIT_VERSION_MINOR@
#define PROFIT_VERSION_PATCH @PROFIT_VERSION_PATCH@

/**
* Whether libprofit should use the R/Rmath mathematical functions to perform
Expand Down
3 changes: 2 additions & 1 deletion src/profit-cli.cpp
Expand Up @@ -714,7 +714,8 @@ int parse_and_run(int argc, char *argv[]) {
return 0;

case 'V':
cout << "libprofit version " << PROFIT_VERSION << endl;
cout << "libprofit version " << PROFIT_VERSION_MAJOR << "."
<< PROFIT_VERSION_MINOR << "." << PROFIT_VERSION_PATCH << endl;
cout << "OpenCL support: ";
#ifdef PROFIT_OPENCL
cout << "Yes (up to " << PROFIT_OPENCL_MAJOR << "." << PROFIT_OPENCL_MINOR << ")";
Expand Down

0 comments on commit 62042ec

Please sign in to comment.