Commit 0d2794c6 authored by Simon Spannagel's avatar Simon Spannagel
Browse files

Improve printout of executable

parent d3dfb704
Pipeline #523933 passed with stages
in 4 minutes and 46 seconds
......@@ -6,7 +6,7 @@ IF(COMMAND CMAKE_POLICY)
ENDIF(COMMAND CMAKE_POLICY)
# Set default version
SET(CORRYVRECKAN_VERSION "v0.1")
SET(CORRYVRECKAN_VERSION "v0.8")
# Set default build type
IF(NOT CMAKE_BUILD_TYPE)
......@@ -20,12 +20,15 @@ GET_VERSION(CORRYVRECKAN_VERSION)
# Print version
MESSAGE(STATUS "Building Corryvreckan version ${CORRYVRECKAN_VERSION}.")
# Gather information about build time:
STRING(TIMESTAMP BUILD_TIME "%Y-%m-%d, %H:%M:%S UTC" UTC)
# Define the project with the simple version
STRING(REGEX MATCH "([0-9.]+)+" SIMPLE_VERSION "${CORRYVRECKAN_VERSION}")
# Set languages to NONE to allow the documentation to be built without CXX compiler:
PROJECT(Corryvreckan VERSION ${SIMPLE_VERSION} LANGUAGES NONE)
# Access the project name (for install locations) in the source
ADD_DEFINITIONS(-DCORRYVRECKAN_PROJECT_NAME="${CMAKE_PROJECT_NAME}" -DCORRYVRECKAN_PROJECT_VERSION="${CORRYVRECKAN_VERSION}")
ADD_DEFINITIONS(-DCORRYVRECKAN_PROJECT_NAME="${CMAKE_PROJECT_NAME}" -DCORRYVRECKAN_PROJECT_VERSION="${CORRYVRECKAN_VERSION}" -DCORRYVRECKAN_BUILD_TIME="${BUILD_TIME}")
INCLUDE(cmake/CPackConfig.cmake)
INCLUDE(CPack)
......
......@@ -90,6 +90,17 @@ int main(int argc, const char* argv[]) {
for(int i = 1; i < argc; i++) {
if(strcmp(argv[i], "-h") == 0) {
print_help = true;
} else if(strcmp(argv[i], "--version") == 0) {
std::cout << "Corryvreckan version " << CORRYVRECKAN_PROJECT_VERSION << std::endl;
std::cout << " built on " << CORRYVRECKAN_BUILD_TIME << std::endl;
std::cout << std::endl;
std::cout << "Copyright (c) 2017 CERN and the Corryvreckan authors." << std::endl << std::endl;
std::cout << "This software is distributed under the terms of the MIT License." << std::endl;
std::cout << "In applying this license, CERN does not waive the privileges and immunities" << std::endl;
std::cout << "granted to it by virtue of its status as an Intergovernmental Organization" << std::endl;
std::cout << "or submit itself to any jurisdiction." << std::endl;
clean();
return 0;
} else if(strcmp(argv[i], "-v") == 0 && (i + 1 < argc)) {
try {
LogLevel log_level = Log::getLevelFromString(std::string(argv[++i]));
......@@ -112,11 +123,17 @@ int main(int argc, const char* argv[]) {
// Print help if requested or no arguments given
if(print_help) {
std::cout << "Usage: corry -c <config> [-v <level>]" << std::endl;
std::cout << "Corryvreckan " << CORRYVRECKAN_PROJECT_VERSION << std::endl;
std::cout << "The Maelstrom for Your Test Beam Data" << std::endl;
std::cout << std::endl;
std::cout << "Usage: corry -c <config> [OPTIONS]" << std::endl;
std::cout << std::endl;
std::cout << "Options:" << std::endl;
std::cout << " -c <file> configuration file to be used" << std::endl;
std::cout << " -l <file> file to log to besides standard output" << std::endl;
std::cout << " -o <option> extra configuration option(s) to pass" << std::endl;
std::cout << " -v <level> verbosity level, overwriting the global level" << std::endl;
std::cout << " --version print version information and quit" << std::endl;
clean();
return return_code;
}
......
Supports Markdown
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