From f1f9045f4b530ce1538830507a05a7ec9d7fd766 Mon Sep 17 00:00:00 2001 From: Pcornat Date: Tue, 16 Feb 2021 19:07:45 +0100 Subject: [PATCH] Added a log system and options to it. --- .gitmodules | 3 +++ CMakeLists.txt | 15 +++++++++++++-- README.md | 13 +++++++++++++ external/spdlog | 1 + 4 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 .gitmodules create mode 160000 external/spdlog diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..6c66587 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "external/spdlog"] + path = external/spdlog + url = https://github.com/gabime/spdlog.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 6b26fb0..52edc57 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,13 +6,24 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_COMPILER_LAUNCHER ccache) +# options for spdlog +set(SPDLOG_ENABLE_PCH ON CACHE BOOL "Build static or shared library using precompiled header to speed up compilation time") +set(SPDLOG_BUILD_WARNINGS ON CACHE BOOL "Enable compiler warnings") +set(SPDLOG_FMT_EXTERNAL ON CACHE BOOL "Use external fmt library instead of bundled") +set(SPDLOG_PREVENT_CHILD_FD ON CACHE BOOL "Prevent from child processes to inherit log file descriptors") +set(SPDLOG_NO_THREAD_ID ON CACHE BOOL "prevent spdlog from querying the thread id on each log call if thread id is not needed") +set(SPDLOG_NO_TLS ON CACHE BOOL "prevent spdlog from using thread local storage") + +add_subdirectory(external/spdlog) +# end + find_package(Boost REQUIRED COMPONENTS system) find_package(OpenSSL REQUIRED) find_package(OpenMP REQUIRED) include_directories(${Boost_INCLUDE_DIR} ${OpenSSL_INCLUDE_DIR}) set(COMPILE_DEFINITIONS - $<$:_GLIBCXX_DEBUG> + $<$:_LIBCPP_DEBUG> BOOST_ASIO_NO_DEPRECATED BOOST_ASIO_NO_TS_EXECUTORS #[[_FORTIFY_SOURCE=2]] @@ -66,4 +77,4 @@ target_precompile_headers(GeminiServer PRIVATE ${HEADERS}) target_compile_definitions(GeminiServer PRIVATE ${COMPILE_DEFINITIONS}) target_compile_options(GeminiServer PRIVATE ${COMPILE_FLAGS}) target_link_options(GeminiServer ${LINKER_OPTIONS}) -target_link_libraries(GeminiServer ${LINKER_FLAGS}) \ No newline at end of file +target_link_libraries(GeminiServer ${LINKER_FLAGS} spdlog::spdlog) \ No newline at end of file diff --git a/README.md b/README.md index 7899467..9e15a25 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,19 @@ What we want is a high performance server using asynchrony at first, and then ma The configuration of the server is made through a JSON file `config.json`. The JSON parser is [simdjson](https://github.com/simdjson/simdjson) directly integrated in our source code. +### Structure of the file +- content + - path : string, folder to the content of your site. +- cache + - enable_cache: bool, to enable cache of files or not + - cache_size : unsigned int, the maximum size in bytes to put in cache +- ssl + - pem_path : string + - cert_path : string + +## Dependencies +It uses a bundled version of `spdlog` as a git submodule, but it does not use the `fmt` lib that is inside `spdlog`. + ## Documentation The doc of the code is made with [doxygen](https://www.doxygen.nl/), the `Doxyfile` is at the root of the repo. diff --git a/external/spdlog b/external/spdlog new file mode 160000 index 0000000..42c5eb5 --- /dev/null +++ b/external/spdlog @@ -0,0 +1 @@ +Subproject commit 42c5eb59c9a44e4fafa4c5dae95ecd8269df5f35