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

View file

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

View file

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