Skip to content

Commit

Permalink
2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
psemiletov committed Feb 26, 2023
1 parent 619d1e0 commit 9347d27
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 45 deletions.
32 changes: 5 additions & 27 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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}\\"")


Expand All @@ -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()



Expand Down Expand Up @@ -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)
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Makefile.OpenBSD
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Makefile.clang
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Makefile.static
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions NEWS
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion cycle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ void CGenCycleUnrated::loop()


auto stop = high_resolution_clock::now();
auto duration = duration_cast<microseconds>(stop - start);
//auto duration = duration_cast<microseconds>(stop - start);
auto duration_s = duration_cast<seconds>(stop - start);

if (params->benchmark)
Expand Down
10 changes: 2 additions & 8 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.



Expand Down
3 changes: 2 additions & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <vector>
#include <iostream>
#include <iomanip>

//#include <filesystem>
/*
#ifndef __has_include
Expand All @@ -33,7 +34,7 @@


#ifndef VERSION_NUMBER
#define VERSION_NUMBER "2.1.0"
#define VERSION_NUMBER "2.2.0"
#endif


Expand Down
22 changes: 22 additions & 0 deletions utl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 9347d27

Please sign in to comment.