diff --git a/CMakeLists.txt b/CMakeLists.txt index 6d05ce1..ae31e75 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.5) -set (CMAKE_CXX_STANDARD 17) +set (CMAKE_CXX_STANDARD 11) option(USE_PROMCPP "Use prometheus_cpp" OFF) option(USE_STATIC "Static build" OFF) @@ -17,7 +17,7 @@ endif(USE_CLANG) -project (logfilegen VERSION 2.1.0 LANGUAGES CXX) +project (logfilegen VERSION 2.2.0 LANGUAGES CXX) add_definitions(-DVERSION_NUMBER="\\"${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}\\"") @@ -42,15 +42,10 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread") -#if(USE_OPENSUSE) -# target_link_libraries(logfilegen -lstdc++fs) -# add_definitions(-DUSE_OPENSUSE=1) -#endif(USE_OPENSUSE) - -if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.1.0) - target_link_libraries(logfilegen -lstdc++fs) -endif() +#if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.1.0) +# target_link_libraries(logfilegen -lstdc++fs) +#endif() @@ -101,22 +96,5 @@ else() endif() -#find_package(prometheus-cpp CONFIG) - -#if(prometheus-cpp_FOUND) - - # message("+ prometheus-cpp support") - - # add_definitions(-DUSE_PROM=1) - - - # target_link_libraries(logfilegen PRIVATE prometheus-cpp::pull) - # target_link_libraries(logfilegen ${prometheus-cpp-core_LIBRARIES} ) - # include_directories(${prometheus-cpp-core_INCLUDE_DIRS}) - - # target_link_libraries(logfilegen PRIVATE prometheus-cpp::pull) - -#endif() - install (TARGETS logfilegen DESTINATION bin) diff --git a/ChangeLog b/ChangeLog index 22b5f89..4bda5cf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,5 @@ ++ Min C++ ver is 11 instead of 17 + + outdated GCC (< 9.1.0) support * console possibly overflow fixes * ENV variables now in the UPPER CASE only diff --git a/Makefile b/Makefile index 5fa6964..e322789 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ endif CXX = g++ #CXXFLAGS = -Wall -g -O3 -fopenmp -CXXFLAGS = -Wall -g -O3 -std=c++11 -pthread -lpthread +CXXFLAGS = -Wall -g -Og -std=c++11 -pthread -lpthread #LDFLAGS= -pthread -lpthread #add for -lpthread diff --git a/Makefile.OpenBSD b/Makefile.OpenBSD index afefb3c..ac460ea 100644 --- a/Makefile.OpenBSD +++ b/Makefile.OpenBSD @@ -3,7 +3,7 @@ prefix=/usr .endif CXX = clang++ -CXXFLAGS = -Wall -g -O3 -std=c++17 +CXXFLAGS = -Wall -g -O3 -std=c++11 all: main.cpp $(CXX) $(CXXFLAGS) -o logfilegen utl.cpp params.cpp macro.cpp vars.cpp tpl.cpp pairfile.cpp logrot.cpp cycle.cpp main.cpp diff --git a/Makefile.clang b/Makefile.clang index 7bc7216..9e1c61c 100644 --- a/Makefile.clang +++ b/Makefile.clang @@ -3,7 +3,7 @@ prefix=/usr endif CXX = clang++ -CXXFLAGS = -Wall -g -O3 -std=c++17 +CXXFLAGS = -Wall -g -O3 -std=c++11 all: main.cpp $(CXX) $(CXXFLAGS) -o logfilegen utl.cpp params.cpp vars.cpp macro.cpp tpl.cpp pairfile.cpp logrot.cpp cycle.cpp main.cpp diff --git a/Makefile.static b/Makefile.static index 01adef5..86670ff 100644 --- a/Makefile.static +++ b/Makefile.static @@ -7,7 +7,7 @@ CXXFLAGS = -Wall -g -O3 -static -static-libstdc++ -static-libgcc all: main.cpp - $(CXX) $(CXXFLAGS) -std=c++17 -o logfilegen utl.cpp params.cpp macro.cpp vars.cpp tpl.cpp pairfile.cpp cycle.cpp logrot.cpp main.cpp + $(CXX) $(CXXFLAGS) -std=c++11 -o logfilegen utl.cpp params.cpp macro.cpp vars.cpp tpl.cpp pairfile.cpp cycle.cpp logrot.cpp main.cpp clean: $(RM) logfilegen diff --git a/NEWS b/NEWS index 8876652..e79c4ed 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1 @@ -+ outdated GCC (< 9.1.0) support (CMake) -* console possibly overflow fixes -* ENV variables now in the UPPER CASE only -* CMake is preferrable way to build logfilegen +This release makes logfilegen possible to build on old compiler versions. Now logfilegen needs C++11 instead of C++17. diff --git a/cycle.cpp b/cycle.cpp index aad8414..42a59a4 100644 --- a/cycle.cpp +++ b/cycle.cpp @@ -675,7 +675,7 @@ void CGenCycleUnrated::loop() auto stop = high_resolution_clock::now(); - auto duration = duration_cast(stop - start); + //auto duration = duration_cast(stop - start); auto duration_s = duration_cast(stop - start); if (params->benchmark) diff --git a/docs/index.md b/docs/index.md index 11d86cf..446b7d0 100644 --- a/docs/index.md +++ b/docs/index.md @@ -13,15 +13,9 @@ Logfilegen is a fast and highly customizable tool to generate common server (ngi ## NEWS -***24 february 2023, 2.1.0*** +***26 february 2023, 2.1.0*** -+ outdated GCC (< 9.1.0) support (CMake) - -* console possibly overflow fixes - -* ENV variables now in the UPPER CASE only - -* CMake is preferrable way to build logfilegen +This release makes logfilegen possible to build on old compiler versions. Now logfilegen needs C++11 instead of C++17. diff --git a/main.cpp b/main.cpp index e805b34..7dd30f1 100644 --- a/main.cpp +++ b/main.cpp @@ -9,6 +9,7 @@ #include #include #include + //#include /* #ifndef __has_include @@ -33,7 +34,7 @@ #ifndef VERSION_NUMBER -#define VERSION_NUMBER "2.1.0" +#define VERSION_NUMBER "2.2.0" #endif diff --git a/utl.cpp b/utl.cpp index f310b1e..5b6caf7 100644 --- a/utl.cpp +++ b/utl.cpp @@ -238,6 +238,28 @@ size_t get_free_space (const string &path) #if defined(_WIN32) || defined(_WIN64) + BOOL fResult; + unsigned __int64 i64FreeBytesToCaller, + i64TotalBytes, + i64FreeBytes; + fResult = GetDiskFreeSpaceEx (path.c_str(), + (PULARGE_INTEGER)&i64FreeBytesToCaller, + (PULARGE_INTEGER)&i64TotalBytes, + (PULARGE_INTEGER)&i64FreeBytes); + if (fResult) + { + result = i64FreeBytesToCaller; + /*printf ("\n\nGetDiskFreeSpaceEx reports\n\n"); + printf ("Available space to caller = %I64u MB\n", + i64FreeBytesToCaller / (1024*1024)); + printf ("Total space = %I64u MB\n", + i64TotalBytes / (1024*1024)); + printf ("Free space on drive = %I64u MB\n", + i64FreeBytes / (1024*1024));*/ + } + } + + #else struct statvfs buf;