Browse Source

Add version number, fix `make style` warnings.

pull/1/head
Daniel Scharrer 14 years ago
parent
commit
6b54166ce3
  1. 11
      CMakeLists.txt
  2. 1
      VERSION
  3. 9
      src/InnoExtract.cpp
  4. 3
      src/cli/debug.cpp
  5. 2
      src/setup/info.cpp
  6. 2
      src/setup/version.hpp
  7. 19
      src/version.cpp.in
  8. 9
      src/version.hpp

11
CMakeLists.txt

@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 2.6)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
include(CompileCheck)
include(VersionString) # TODO use this
include(VersionString)
include(CheckSymbolExists)
# Force re-checking libraries if the compiler or compiler flags change.
@ -19,7 +19,7 @@ endif()
unset(LIBRARIES)
find_package(Boost REQUIRED COMPONENTS iostreams filesystem date_time)
find_package(Boost REQUIRED COMPONENTS iostreams filesystem date_time system)
check_link_library(Boost Boost_LIBRARIES)
list(APPEND LIBRARIES "${Boost_LIBRARIES}")
link_directories("${Boost_LIBRARY_DIRS}")
@ -128,6 +128,10 @@ include_directories(src ${CMAKE_CURRENT_BINARY_DIR})
configure_file("src/configure.hpp.in" "configure.hpp")
set(VERSION_FILE "${CMAKE_BINARY_DIR}/version.cpp")
version_file("src/version.cpp.in" "${VERSION_FILE}" "VERSION" ".git")
list(APPEND INNOEXTRACT_SOURCES "${VERSION_FILE}")
add_executable(innoextract ${INNOEXTRACT_SOURCES} ${ALL_INCLUDES})
target_link_libraries(innoextract ${LIBRARIES})
@ -173,9 +177,6 @@ if(PYTHONINTERP_FOUND)
# TODO add copyright notices
set(STYLE_FILTER ${STYLE_FILTER},-legal/copyright)
# TODO split up main()
set(STYLE_FILTER ${STYLE_FILTER},-readability/fn_size)
add_custom_target(style
COMMAND cmake -E chdir "${CMAKE_SOURCE_DIR}" "${PYTHON_EXECUTABLE}" "${CMAKE_MODULE_PATH}/cpplint.py" "--filter=${STYLE_FILTER}" ${INNOEXTRACT_SOURCES} ${ALL_INCLUDES}
)

1
VERSION

@ -0,0 +1 @@
Inno Extract 1.0

9
src/InnoExtract.cpp

@ -20,6 +20,8 @@
#include <boost/date_time/posix_time/ptime.hpp>
#include <boost/date_time/posix_time/posix_time_types.hpp>
#include "version.hpp"
#include "cli/debug.hpp"
#include "loader/offsets.hpp"
@ -54,7 +56,12 @@ int main(int argc, char * argv[]) {
// logger::debug = true;
if(argc <= 1) {
std::cout << "usage: innoextract <Inno Setup installer>" << endl;
cout << "usage: innoextract <Inno Setup installer>" << endl;
return 1;
}
if(!strcmp(argv[1], "-v") || !strcmp(argv[1], "--version")) {
cout << innoextract_version << endl;
return 1;
}

3
src/cli/debug.cpp

@ -441,7 +441,8 @@ static void print_header(const setup::header & header) {
cout << "Uninstall style: " << color::cyan << header.uninstall_style << color::reset << '\n';
cout << "Dir exists warning: " << color::cyan << header.dir_exists_warning
<< color::reset << '\n';
cout << if_not_equal("Privileges required", header.privileges_required, setup::header::NoPrivileges);
cout << if_not_equal("Privileges required", header.privileges_required,
setup::header::NoPrivileges);
cout << "Show language dialog: " << color::cyan << header.show_language_dialog
<< color::reset << '\n';
cout << if_not_equal("Danguage detection", header.language_detection,

2
src/setup/info.cpp

@ -127,7 +127,7 @@ void info::load(std::istream & ifs, entry_types e, const setup::version & v) {
BOOST_FOREACH(setup::message_entry & entry, messages) {
if(entry.language >= 0 ? size_t(entry.language) >= languages.size()
: entry.language != -1) {
: entry.language != -1) {
log_warning << "unexpected language index: " << entry.language;
continue;
}

2
src/setup/version.hpp

@ -15,7 +15,7 @@ typedef uint32_t version_constant;
(::setup::version_constant(a) << 24) \
| (::setup::version_constant(b) << 16) \
| (::setup::version_constant(c) << 8) \
| (::setup::version_constant(d) ) \
| (::setup::version_constant(d) << 0) \
)
#define INNO_VERSION(a, b, c) INNO_VERSION_EXT(a, b, c, 0)

19
src/version.cpp.in

@ -0,0 +1,19 @@
#include "version.hpp"
/*!
* This file is automatically processed by cmake if the version or commit id changes.
* Available variables:
* - BASE_VERSION: The contents of the VERSION file.
* - GIT_COMMIT: The current git commit. This variable is not defined if there is no .git directory.
* - GIT_COMMIT_PREFIX_i: The first i characters of the git commit (i=0..39).
* For the exact syntax see the documentation of the configure_file() cmake command.
*/
#cmakedefine GIT_COMMIT
#ifdef GIT_COMMIT
const std::string innoextract_version = "${BASE_VERSION} + ${GIT_COMMIT_PREFIX_5}";
#else
const std::string innoextract_version = "${BASE_VERSION}";
#endif

9
src/version.hpp

@ -0,0 +1,9 @@
#ifndef INNOEXTRACT_VERSION_HPP
#define INNOEXTRACT_VERSION_HPP
#include <string>
extern const std::string innoextract_version;
#endif // INNOEXTRACT_VERSION_HPP
Loading…
Cancel
Save