feat(src): add LEAN_VERSION_PATCH

This commit is contained in:
Soonho Kong 2014-10-07 12:00:49 -07:00
parent 900c7c41a1
commit 2cf6cf19c0
4 changed files with 8 additions and 5 deletions

View file

@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 2.8.7)
project(LEAN CXX)
set(LEAN_VERSION_MAJOR 0)
set(LEAN_VERSION_MINOR 2)
set(LEAN_VERSION_PATCH 0)
if (NOT CMAKE_BUILD_TYPE)
message(STATUS "No build type selected, default to Release")
@ -238,7 +239,7 @@ find_package(PythonInterp REQUIRED)
# CPack
set(CPACK_PACKAGE_NAME lean)
string(TOLOWER ${CMAKE_SYSTEM_NAME} LOWER_SYSTEM_NAME)
set(CPACK_PACKAGE_FILE_NAME "lean-${LEAN_VERSION_MAJOR}.${LEAN_VERSION_MINOR}-${LOWER_SYSTEM_NAME}")
set(CPACK_PACKAGE_FILE_NAME "lean-${LEAN_VERSION_MAJOR}.${LEAN_VERSION_MINOR}.${LEAN_VERSION_PATCH}-${LOWER_SYSTEM_NAME}")
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
SET(CPACK_GENERATOR TGZ)
else()

View file

@ -135,7 +135,7 @@ void export_module(std::ostream & out, environment const & env) {
serializer s2(out);
std::string r = out1.str();
unsigned h = hash(r.size(), [&](unsigned i) { return r[i]; });
s2 << g_olean_header << LEAN_VERSION_MAJOR << LEAN_VERSION_MINOR;
s2 << g_olean_header << LEAN_VERSION_MAJOR << LEAN_VERSION_MINOR << LEAN_VERSION_PATCH;
s2 << h;
// store imported files
s2 << imports.size();
@ -285,8 +285,8 @@ struct import_modules_fn {
d1 >> header;
if (header != g_olean_header)
throw exception(sstream() << "file '" << fname << "' does not seem to be a valid object Lean file, invalid header");
unsigned major, minor, claimed_hash;
d1 >> major >> minor >> claimed_hash;
unsigned major, minor, patch, claimed_hash;
d1 >> major >> minor >> patch >> claimed_hash;
// Enforce version?
unsigned num_imports = d1.read_unsigned();

View file

@ -62,7 +62,8 @@ static void on_ctrl_c(int ) {
}
static void display_header(std::ostream & out) {
out << "Lean (version " << LEAN_VERSION_MAJOR << "." << LEAN_VERSION_MINOR;
out << "Lean (version " << LEAN_VERSION_MAJOR << "."
<< LEAN_VERSION_MINOR << "." << LEAN_VERSION_PATCH;
if (!std::strcmp(g_githash, "GITDIR-NOTFOUND")) {
out << ", commit " << std::string(g_githash).substr(0, 12);
}

View file

@ -1,3 +1,4 @@
// the configured options and settings for Tutorial
#define LEAN_VERSION_MAJOR @LEAN_VERSION_MAJOR@
#define LEAN_VERSION_MINOR @LEAN_VERSION_MINOR@
#define LEAN_VERSION_PATCH @LEAN_VERSION_PATCH@