Browse Source

Various bits of cleanup

master
Jessica James 5 years ago
parent
commit
e0d5ab6a27
  1. 3
      CMakeLists.txt
  2. 4
      build/CMakeLists.txt
  3. 13
      build/Clang/CMakeLists.txt
  4. 2
      src/include/object.hpp
  5. 2
      src/include/parser.hpp
  6. 2
      src/test/CMakeLists.txt
  7. 2
      src/test/thread_pool.cpp

3
CMakeLists.txt

@ -1,8 +1,11 @@
cmake_minimum_required(VERSION 3.8)
project(jessilib)
# Set common constants
set(CMAKE_CXX_STANDARD 17)
set(JESSILIB_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
# Include compiler-specific build configuration
include(build/CMakeLists.txt)
# Setup source files

4
build/CMakeLists.txt

@ -1,6 +1,6 @@
# Include any compiler-specifc settings
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/build/${CMAKE_CXX_COMPILER_ID}")
include("${CMAKE_CURRENT_SOURCE_DIR}/build/${CMAKE_CXX_COMPILER_ID}/CMakeLists.txt")
if (EXISTS "${JESSILIB_ROOT}/build/${CMAKE_CXX_COMPILER_ID}")
include("${JESSILIB_ROOT}/build/${CMAKE_CXX_COMPILER_ID}/CMakeLists.txt")
else()
message(STATUS "No compiler-specific settings set; CMAKE_CXX_COMPILER_ID: ${CMAKE_CXX_COMPILER_ID}")
endif()

13
build/Clang/CMakeLists.txt

@ -0,0 +1,13 @@
# Clang-specific compiler settings
# Enable all/extra warnings
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
# Treat all warnings as errors
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
# Enable address sanitizer on debug
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
# Enable std::filesystem
set(JESSILIB_ADDITOINAL_LIBS "stdc++fs")

2
src/include/object.hpp

@ -402,7 +402,7 @@ public:
}
size_t hash() const {
return std::visit([this](auto&& value) -> size_t {
return std::visit([](auto&& value) -> size_t {
using T = typename std::decay<decltype(value)>::type;
if constexpr (std::is_same<T, null_variant_t>::value) {

2
src/include/parser.hpp

@ -26,6 +26,8 @@ namespace jessilib {
class parser {
public:
virtual ~parser() = default;
/** Interface methods */
/**

2
src/test/CMakeLists.txt

@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.8)
# Setup source files
set(SOURCE_FILES
timer.cpp thread_pool.cpp util.cpp object.cpp parser.cpp config.cpp parsers/json.cpp unicode.cpp)

2
src/test/thread_pool.cpp

@ -57,7 +57,7 @@ TEST(ThreadPoolTest, push) {
thread_pool pool;
repeat (total_iterations) {
pool.push([&iterations, &pool]() {
pool.push([&iterations]() {
++iterations;
});
}

Loading…
Cancel
Save