Commit c6164bc0 authored by Atkins, Charles Vernon's avatar Atkins, Charles Vernon
Browse files

Use a 4 part version string in between releases

This moves towards an automatically updating 4-part version string that
determines the "tweak" version based on the number of commits since the
most recent release.  This allows us to reference version numbers
in-between releases.
parent 9c94bbb0
......@@ -12,7 +12,11 @@ if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
"separate from the source directory")
endif()
project(ADIOS2 VERSION 2.4.0)
include(${CMAKE_CURRENT_LIST_DIR}/cmake/ADIOSFunctions.cmake)
setup_version(2.4.0)
project(ADIOS2 VERSION ${ADIOS2_VERSION})
if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
......@@ -63,7 +67,6 @@ add_subdirectory(cmake/install/pre)
#------------------------------------------------------------------------------#
# Top level options
#------------------------------------------------------------------------------#
include(ADIOSFunctions)
# Default to a debug build if not specified
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
......
......@@ -120,10 +120,7 @@ PYBIND11_MODULE(adios2, m)
m.attr("GlobalValue") = false;
m.attr("LocalValue") = true;
std::ostringstream versionss;
versionss << ADIOS2_VERSION_MAJOR << "." << ADIOS2_VERSION_MINOR << "."
<< ADIOS2_VERSION_PATCH;
m.attr("__version__") = versionss.str();
m.attr("__version__") = ADIOS2_VERSION_STR;
// enum classes
pybind11::enum_<adios2::Mode>(m, "Mode")
......
......@@ -3,6 +3,34 @@
# accompanying file Copyright.txt for details.
#------------------------------------------------------------------------------#
function(setup_version BASE)
set(ver_tweak)
if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/.git)
if(NOT GIT_COMMAND)
find_program(GIT_COMMAND git)
endif()
if(GIT_COMMAND)
execute_process(
COMMAND git
--git-dir=${CMAKE_CURRENT_LIST_DIR}/.git
describe --tags --match v${BASE}
RESULT_VARIABLE res
OUTPUT_VARIABLE out
ERROR_QUIET
)
if(res EQUAL 0 AND out MATCHES "[^-]*-([^-]*)-g[a-f0-9]*")
set(ver_tweak ${CMAKE_MATCH_1})
endif()
endif()
endif()
if(ver_tweak)
set(ADIOS2_VERSION ${BASE}.${ver_tweak} PARENT_SCOPE)
else()
set(ADIOS2_VERSION ${BASE} PARENT_SCOPE)
endif()
set(ADIOS2_LIBRARY_VERSION ${BASE} PARENT_SCOPE)
endfunction()
function(adios_option name description default)
set(ADIOS2_USE_${name} ${default} CACHE STRING "${description}")
set_property(CACHE ADIOS2_USE_${name} PROPERTY
......
......@@ -224,7 +224,7 @@ endif()
# Set library version information
set_target_properties(adios2 PROPERTIES
VERSION ${ADIOS2_VERSION}
VERSION ${ADIOS2_LIBRARY_VERSION}
SOVERSION ${ADIOS2_VERSION_MAJOR}
)
......
......@@ -7,10 +7,11 @@
#define ADIOSCONFIG_H_
/* ADIOS Version Information */
#define ADIOS2_VERSION_STR "@ADIOS2_VERSION@"
#define ADIOS2_VERSION_MAJOR @ADIOS2_VERSION_MAJOR@
#define ADIOS2_VERSION_MINOR @ADIOS2_VERSION_MINOR@
#define ADIOS2_VERSION_PATCH @ADIOS2_VERSION_PATCH@
#define ADIOS2_VERSION @ADIOS2_VERSION@
#cmakedefine ADIOS2_VERSION_TWEAK @ADIOS2_VERSION_TWEAK@
/*
* ADIOS Build Information:
......
......@@ -721,12 +721,7 @@ void BP3Serializer::PutMinifooter(const uint64_t pgIndexStart,
helper::CopyToBuffer(buffer, position, version.c_str());
};
const std::string majorVersion(std::to_string(ADIOS2_VERSION_MAJOR));
const std::string minorVersion(std::to_string(ADIOS2_VERSION_MINOR));
const std::string patchVersion(std::to_string(ADIOS2_VERSION_PATCH));
const std::string versionLongTag("ADIOS-BP v" + majorVersion + "." +
minorVersion + "." + patchVersion);
const std::string versionLongTag("ADIOS-BP v" ADIOS2_VERSION_STR);
const size_t versionLongTagSize = versionLongTag.size();
if (versionLongTagSize < 24)
{
......@@ -739,9 +734,12 @@ void BP3Serializer::PutMinifooter(const uint64_t pgIndexStart,
helper::CopyToBuffer(buffer, position, versionLongTag.c_str(), 24);
}
lf_CopyVersionChar(majorVersion, buffer, position);
lf_CopyVersionChar(minorVersion, buffer, position);
lf_CopyVersionChar(patchVersion, buffer, position);
lf_CopyVersionChar(std::to_string(ADIOS2_VERSION_MAJOR), buffer, position);
lf_CopyVersionChar(std::to_string(ADIOS2_VERSION_MINOR), buffer, position);
lf_CopyVersionChar(std::to_string(ADIOS2_VERSION_PATCH), buffer, position);
#ifdef ADIOS2_VERSION_TWEAK
lf_CopyVersionChar(std::to_string(ADIOS2_VERSION_TWEAK), buffer, position);
#endif
++position;
helper::CopyToBuffer(buffer, position, &pgIndexStart);
......
......@@ -33,7 +33,7 @@ endif()
# Set library version information
set_target_properties(sst PROPERTIES
OUTPUT_NAME adios2_sst
VERSION ${ADIOS2_VERSION}
VERSION ${ADIOS2_LIBRARY_VERSION}
SOVERSION ${ADIOS2_VERSION_MAJOR}
)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment