Commit e04d0f17 authored by kulvait's avatar kulvait

CLI11 as a submodule

*Arguments reporting possibility from program startLog
parent b43a6591
......@@ -7,3 +7,6 @@
[submodule "submodules/CTMAL"]
path = submodules/CTMAL
url = ssh://git@gitlab.stimulate.ovgu.de:2200/vojtech.kulvait/CTMAL.git
[submodule "submodules/CLI11"]
path = submodules/CLI11
url = https://github.com/CLIUtils/CLI11
......@@ -29,6 +29,8 @@ IF(OpenCL_FOUND)
include_directories(${OpenCL_INCLUDE_DIRS})
ENDIF()
#CLI11 comand line parser library
include_directories(${CMAKE_SOURCE_DIR}/submodules/CLI11/include)
#Header directories for the project
set(GLOBAL_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include)
......@@ -75,7 +77,7 @@ include_directories(${MKL_INCLUDE_DIRS})
#if (${OpenCV_VERSION_MAJOR} GREATER 2)
add_definitions("-Dstrtk_no_tr1_or_boost")
FILE( GLOB CTIOLSRC ${CMAKE_SOURCE_DIR}/src/*.cpp ${CMAKE_SOURCE_DIR}/src/ARGPARSE/*.cpp )
FILE( GLOB CTIOLSRC ${CMAKE_SOURCE_DIR}/src/*.cpp ${CMAKE_SOURCE_DIR}/src/PROG/*.cpp )
add_library(CTIOL ${CTIOLSRC})
set_target_properties(
CTIOL
......
......@@ -10,7 +10,7 @@ class Program
{
public:
Program(int argc, char* argv[], plog::Severity debugLevel = plog::debug, bool logToFile = true, bool logToConsole = true);
void startLog();
void startLog(bool reportArguments=false);
void endLog(bool reportTimings=false);
util::RunTimeInfo getRunTimeInfo();
......
......@@ -21,7 +21,18 @@ Program::Program(
start_time = std::chrono::steady_clock::now();
}
void Program::startLog() { LOGI << io::xprintf("START %s", rti.getExecutableName().c_str()); }
void Program::startLog(bool reportArguments)
{
std::string str = io::xprintf("START %s", rti.getExecutableName().c_str());
if(reportArguments)
{
for(int i = 1; i < argc; i++)
{
str = io::xprintf("%s %s", str.c_str(), argv[i]);
}
}
LOGI << io::xprintf("START %s", rti.getExecutableName().c_str());
}
void Program::endLog(bool reportTimings)
{
......@@ -41,9 +52,8 @@ void Program::endLog(bool reportTimings)
float(t.count() / 1000.0f));
} else if(min.count() > 0)
{
LOGI << io::xprintf("END %s, duration %02dm %02.3fs.",
rti.getExecutableName().c_str(), min.count(),
float(t.count() / 1000.0f));
LOGI << io::xprintf("END %s, duration %02dm %02.3fs.", rti.getExecutableName().c_str(),
min.count(), float(t.count() / 1000.0f));
} else
{
LOGI << io::xprintf("END %s, duration %02.3fs.", rti.getExecutableName().c_str(),
......
Subproject commit dd0d8e4fe729e5b1110232c7a5c9566dad884686
......@@ -2,10 +2,12 @@
#include "catch.hpp"
#include <plog/Log.h>
#include "PROG/RunTimeInfo.hpp"
#include "PROG/Program.hpp"
using namespace CTL;
TEST_CASE("TEST: RunTimeInfo.hpp", "RunTimeInfo")
TEST_CASE("TEST: RunTimeInfo.hpp", "[RunTimeInfo][Program]")
{
util::Program prog(0, nullptr);
util::RunTimeInfo rti;
std::string exe = rti.getExecutableName();
std::string path = rti.getExecutablePath();
......
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