Commit e26550b4 authored by Mohcine Chraibi's avatar Mohcine Chraibi

Merge branch 'issue_79' into 'develop'

Issue 79

See merge request !7
parents b7badd30 ccd63adf
Pipeline #9562 passed with stages
in 1 minute and 22 seconds
......@@ -25,6 +25,7 @@ configure-linux:
script:
- mkdir -p build
- cd build
- which git
- cmake -DCMAKE_BUILD_TYPE=Debug -DBoost_NO_SYSTEM_PATHS=true -DBOOST_ROOT=~/boost_1_61_0 ..
- echo "configure | ${CI_PROJECT_DIR}"
stage: configure
......@@ -49,7 +50,7 @@ make-linux:
- make -j$nproc
- echo "compile | ${CI_PROJECT_DIR}"
tags:
- linux
- linux
after_script:
- echo "End CI" # todo: run report script
......@@ -20,6 +20,56 @@ if (Boost_NO_SYSTEM_PATHS)
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${BOOST_LIBRARY_DIRS})
endif (Boost_NO_SYSTEM_PATHS)
find_package(Git REQUIRED) # no need for this msg. It comes from cmake.findgit()
find_program(GIT_SCM git DOC "Git version control")
mark_as_advanced(GIT_SCM)
find_file(GITDIR NAMES .git PATHS ${CMAKE_SOURCE_DIR} NO_DEFAULT_PATH)
if (GIT_SCM AND GITDIR)
# the commit's SHA1, and whether the building workspace was dirty or not
# describe --match=NeVeRmAtCh --always --tags --abbrev=40 --dirty
execute_process(COMMAND
"${GIT_EXECUTABLE}" --no-pager describe --tags --always --dirty
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_SHA1
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
# branch
execute_process(
COMMAND "${GIT_EXECUTABLE}" rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# the date of the commit
execute_process(COMMAND
"${GIT_EXECUTABLE}" log -1 --format=%ad --date=local
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_DATE
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
# the subject of the commit
execute_process(COMMAND
"${GIT_EXECUTABLE}" log -1 --format=%s
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_COMMIT_SUBJECT
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
add_definitions("-DGIT_COMMIT_HASH=\"${GIT_SHA1}\"")
add_definitions("-DGIT_COMMIT_DATE=\"${GIT_DATE}\"")
add_definitions("-DGIT_COMMIT_SUBJECT=\"${GIT_COMMIT_SUBJECT}\"")
add_definitions("-DGIT_BRANCH=\"${GIT_BRANCH}\"")
else()
message(STATUS "Not in a git repo")
endif()
#set(EXECUTABLE_OUTPUT_PATH "../")
#INCLUDE_DIRECTORIES("./")
# message( STATUS "CMAKE_BINARY_DIR: " ${CMAKE_BINARY_DIR} )
......@@ -29,10 +79,11 @@ set(CMAKE_TEST_DIR ${CMAKE_SOURCE_DIR}/Utest)
set(JPSREPORT_MAJOR_VERSION 0)
set(JPSREPORT_MINOR_VERSION 8)
set(JPSREPORT_PATCH_VERSION 2)
set(JPSREPORT_PATCH_VERSION 3)
set(JPSREPORT_VERSION
${JPSREPORT_MAJOR_VERSION}.${JPSREPORT_MINOR_VERSION}.${JPSREPORT_PATCH_VERSION})
message( STATUS "JPSREPORT_VERSION: " ${JPSREPORT_VERSION} )
add_definitions("-DJPSREPORT_VERSION=\"${JPSREPORT_VERSION}\"")
if(NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE Release)
endif(NOT CMAKE_BUILD_TYPE)
......@@ -224,8 +275,6 @@ endif()
target_link_libraries( jpsreport geometrycore )
# ----------------------------- cTest ------------------------------------------
if(BUILD_TESTING)
SET(BUILD_TEST_TIMEOUT 10800 CACHE STRING "Global timeout on all tests (seconds).")
......
......@@ -34,8 +34,11 @@
#include <string>
#include <sstream>
#include <math.h>
#ifdef _MSC_VER
#include "../.vs/dirent.h"
#else
#include <dirent.h>
#endif
#ifdef _OPENMP
#include <omp.h>
#else
......@@ -54,7 +57,7 @@ void ArgumentParser::Usage(const std::string file)
{
Log->Write("Usage: \n");
Log->Write("\t%s input.xml\n",file.c_str());
Log->Write("%s inifile.xml\n",file.c_str());
exit(EXIT_SUCCESS);
}
......@@ -113,11 +116,6 @@ bool ArgumentParser::ParseArgs(int argc, char **argv)
Usage(argv[0]);
return false;
}
else if(argument == "-v" || argument == "--version")
{
fprintf(stderr,"You are actually using JuPedsim (jpsreport) version %s \n\n",JPS_VERSION);
return false;
}
// other special case where a single configuration file is submitted
//check if inifile options are given
......
......@@ -34,13 +34,46 @@
#include "Analysis.h"
using namespace std;
/* https://stackoverflow.com/questions/38530981/output-compiler-version-in-a-c-program#38531037 */
std::string ver_string(int a, int b, int c) {
std::ostringstream ss;
ss << a << '.' << b << '.' << c;
return ss.str();
}
std::string true_cxx =
#ifdef __clang__
"clang++";
#else
"g++";
#endif
std::string true_cxx_ver =
#ifdef __clang__
ver_string(__clang_major__, __clang_minor__, __clang_patchlevel__);
#else
ver_string(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
#endif
// todo: handle Visual Studio
/* #ifdef _MSC_VER */
/* std::to_string(_MSC_VER) */
/* #endif */
int main(int argc, char **argv)
{
Log = new STDIOHandler();
Log = new STDIOHandler();
Log->Write("----\nJuPedSim - JPSreport\n");
Log->Write("Current date : %s %s", __DATE__, __TIME__);
Log->Write("Version : %s", JPSREPORT_VERSION);
Log->Write("Compiler : %s (%s)", true_cxx.c_str(), true_cxx_ver.c_str());
Log->Write("Commit hash : %s", GIT_COMMIT_HASH);
Log->Write("Commit date : %s", GIT_COMMIT_DATE);
// Log->Write("Commit subject : %s", GIT_COMMIT_SUBJECT);
Log->Write("Branch : %s\n----\n", GIT_BRANCH);
// Parsing the arguments
ArgumentParser* args = new ArgumentParser();
ArgumentParser* args = new ArgumentParser();
if(args->ParseArgs(argc, argv))
......
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