mirror of
https://github.com/gabime/spdlog.git
synced 2024-11-15 16:35:45 +08:00
Modify travis-ci, fix issues
Added: * Release/Debug job for gcc 7 and clang 3.5 * Debug asan gcc 7 job * Debug tsan gcc 7 job * Disabled extensions * Added a spdlog::spdlog alias for tests Removed: * Valgrind workaround, the current version is 3.10.1 * install_libcxx * Makefiles Fixed: * examples build * multisink build Workarounds: * gcc7 with tsan and asan needs gold linker, otherwise build fails becase of unrecognized option '--push-state'
This commit is contained in:
parent
85a2bf1c17
commit
7e32ccbd8f
202
.travis.yml
202
.travis.yml
@ -1,91 +1,111 @@
|
|||||||
# Adapted from various sources, including:
|
# Adapted from various sources, including:
|
||||||
# - Louis Dionne's Hana: https://github.com/ldionne/hana
|
# - Louis Dionne's Hana: https://github.com/ldionne/hana
|
||||||
# - Paul Fultz II's FIT: https://github.com/pfultz2/Fit
|
# - Paul Fultz II's FIT: https://github.com/pfultz2/Fit
|
||||||
# - Eric Niebler's range-v3: https://github.com/ericniebler/range-v3
|
# - Eric Niebler's range-v3: https://github.com/ericniebler/range-v3
|
||||||
language: cpp
|
language: cpp
|
||||||
|
|
||||||
# Test matrix:
|
addons: &gcc48
|
||||||
# - Build matrix per compiler: C++11/C++14 + Debug/Release
|
apt:
|
||||||
# - Optionally: AddressSanitizer (ASAN)
|
packages:
|
||||||
# - Valgrind: all release builds are also tested with valgrind
|
- g++-4.8
|
||||||
# - clang 3.4, 3.5, 3.6, trunk
|
- valgrind
|
||||||
# - Note: 3.4 and trunk are tested with/without ASAN,
|
sources:
|
||||||
# the rest is only tested with ASAN=On.
|
- ubuntu-toolchain-r-test
|
||||||
# - gcc 4.9, 5.0
|
|
||||||
#
|
addons: &gcc49
|
||||||
matrix:
|
apt:
|
||||||
include:
|
packages:
|
||||||
|
- g++-4.9
|
||||||
# Test gcc-4.8: C++11, Build=Debug/Release, ASAN=Off
|
- valgrind
|
||||||
- env: GCC_VERSION=4.8 BUILD_TYPE=Debug CPP=11 ASAN=Off LIBCXX=Off
|
sources:
|
||||||
os: linux
|
- ubuntu-toolchain-r-test
|
||||||
addons: &gcc48
|
|
||||||
apt:
|
addons: &gcc7
|
||||||
packages:
|
apt:
|
||||||
- g++-4.8
|
packages:
|
||||||
- valgrind
|
- g++-7
|
||||||
sources:
|
- valgrind
|
||||||
- ubuntu-toolchain-r-test
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
- env: GCC_VERSION=4.8 BUILD_TYPE=Release CPP=11 ASAN=Off LIBCXX=Off
|
|
||||||
os: linux
|
addons: &clang35
|
||||||
addons: *gcc48
|
apt:
|
||||||
|
packages:
|
||||||
# Test gcc-4.9: C++11, Build=Debug/Release, ASAN=Off
|
- clang-3.5
|
||||||
- env: GCC_VERSION=4.9 BUILD_TYPE=Debug CPP=11 ASAN=Off LIBCXX=Off
|
- valgrind
|
||||||
os: linux
|
sources:
|
||||||
addons: &gcc49
|
- ubuntu-toolchain-r-test
|
||||||
apt:
|
- llvm-toolchain-precise-3.5
|
||||||
packages:
|
|
||||||
- g++-4.9
|
matrix:
|
||||||
- valgrind
|
include:
|
||||||
sources:
|
# Test gcc-4.8: C++11, Build=Debug/Release
|
||||||
- ubuntu-toolchain-r-test
|
- env: GCC_VERSION=4.8 BUILD_TYPE=Debug CPP=11
|
||||||
|
os: linux
|
||||||
- env: GCC_VERSION=4.9 BUILD_TYPE=Release CPP=11 ASAN=Off LIBCXX=Off
|
addons: *gcc48
|
||||||
os: linux
|
|
||||||
addons: *gcc49
|
- env: GCC_VERSION=4.8 BUILD_TYPE=Release CPP=11
|
||||||
|
os: linux
|
||||||
# Install dependencies
|
addons: *gcc48
|
||||||
before_install:
|
|
||||||
- export CHECKOUT_PATH=`pwd`;
|
# Test gcc-4.9: C++11, Build=Debug/Release
|
||||||
- if [ -n "$GCC_VERSION" ]; then export CXX="g++-${GCC_VERSION}" CC="gcc-${GCC_VERSION}"; fi
|
- env: GCC_VERSION=4.9 BUILD_TYPE=Debug CPP=11
|
||||||
- if [ -n "$CLANG_VERSION" ]; then export CXX="clang++-${CLANG_VERSION}" CC="clang-${CLANG_VERSION}"; fi
|
os: linux
|
||||||
- if [ "$CLANG_VERSION" == "3.4" ]; then export CXX="/usr/local/clang-3.4/bin/clang++" CC="/usr/local/clang-3.4/bin/clang"; fi
|
addons: *gcc49
|
||||||
- which $CXX
|
|
||||||
- which $CC
|
- env: GCC_VERSION=4.9 BUILD_TYPE=Release CPP=11
|
||||||
- which valgrind
|
os: linux
|
||||||
- if [ -n "$CLANG_VERSION" ]; then sudo CXX=$CXX CC=$CC ./tests/install_libcxx.sh; fi
|
addons: *gcc49
|
||||||
|
|
||||||
install:
|
# Test gcc-7: C++11, Build=Debug/Release
|
||||||
- cd $CHECKOUT_PATH
|
- env: GCC_VERSION=7 BUILD_TYPE=Debug CPP=11
|
||||||
|
os: linux
|
||||||
# Workaround for valgrind bug: https://bugs.kde.org/show_bug.cgi?id=326469.
|
addons: *gcc7
|
||||||
# It is fixed in valgrind 3.10 so this won't be necessary if someone
|
|
||||||
# replaces the current valgrind (3.7) with valgrind-3.10
|
- env: GCC_VERSION=7 BUILD_TYPE=Release CPP=11
|
||||||
- sed -i 's/march=native/msse4.2/' example/Makefile
|
os: linux
|
||||||
|
addons: *gcc7
|
||||||
- if [ ! -d build ]; then mkdir build; fi
|
|
||||||
- export CXX_FLAGS="-I${CHECKOUT_PATH}/include"
|
# Test clang-3.5: C++11, Build=Debug/Release
|
||||||
- export CXX_LINKER_FLAGS=""
|
- env: CLANG_VERSION=3.5 BUILD_TYPE=Debug CPP=11
|
||||||
- if [ -z "$BUILD_TYPE" ]; then export BUILD_TYPE=Release; fi
|
os: linux
|
||||||
- if [ "$ASAN" == "On"]; then export CXX_FLAGS="${CXX_FLAGS} -fsanitize=address,undefined,integer -fno-omit-frame-pointer -fno-sanitize=unsigned-integer-overflow"; fi
|
addons: *clang35
|
||||||
- if [ -n "$CLANG_VERSION" ]; then CXX_FLAGS="${CXX_FLAGS} -D__extern_always_inline=inline"; fi
|
|
||||||
- if [ "$LIBCXX" == "On" ]; then CXX_FLAGS="${CXX_FLAGS} -stdlib=libc++ -I/usr/include/c++/v1/"; fi
|
- env: CLANG_VERSION=3.5 BUILD_TYPE=Release CPP=11
|
||||||
- if [ "$LIBCXX" == "On" ]; then CXX_LINKER_FLAGS="${CXX_FLAGS} -L/usr/lib/ -lc++"; fi
|
os: linux
|
||||||
- CXX_FLAGS="${CXX_FLAGS} -std=c++${CPP}"
|
addons: *clang35
|
||||||
|
|
||||||
# Build examples
|
# Test gcc-7: C++11, Build=Debug, ASAN=On
|
||||||
- cd example
|
- env: GCC_VERSION=7 BUILD_TYPE=Debug CPP=11 ASAN=On
|
||||||
- if [ "$BUILD_TYPE" == "Release" ]; then make rebuild CXXFLAGS="${CXX_FLAGS} ${CXX_LINKER_FLAGS}" VERBOSE=1; export BIN=example; fi
|
os: linux
|
||||||
- if [ "$BUILD_TYPE" == "Debug" ]; then make rebuild debug CXXFLAGS="${CXX_FLAGS} ${CXX_LINKER_FLAGS}" VERBOSE=1; export BIN=example-debug; fi
|
addons: *gcc7
|
||||||
|
|
||||||
|
# Test gcc-7: C++11, Build=Debug, TSAN=On
|
||||||
script:
|
- env: GCC_VERSION=7 BUILD_TYPE=Debug CPP=11 TSAN=On
|
||||||
- ./"${BIN}"
|
os: linux
|
||||||
- valgrind --trace-children=yes --leak-check=full ./"${BIN}"
|
addons: *gcc7
|
||||||
- cd $CHECKOUT_PATH/tests; make rebuild; ./tests
|
|
||||||
- cd $CHECKOUT_PATH/tests; STYLE=printf make rebuild; ./tests
|
before_install:
|
||||||
|
- if [ -n "$GCC_VERSION" ]; then export CXX="g++-${GCC_VERSION}" CC="gcc-${GCC_VERSION}"; fi
|
||||||
notifications:
|
- if [ -n "$CLANG_VERSION" ]; then export CXX="clang++-${CLANG_VERSION}" CC="clang-${CLANG_VERSION}"; fi
|
||||||
email: false
|
- which $CXX
|
||||||
|
- which $CC
|
||||||
|
- which valgrind
|
||||||
|
- $CXX --version
|
||||||
|
- cmake --version
|
||||||
|
- valgrind --version
|
||||||
|
|
||||||
|
install:
|
||||||
|
- if [ "$ASAN" == "On" ]; then export CXX_FLAGS="${CXX_FLAGS} -fsanitize=address,undefined -fno-omit-frame-pointer -fno-sanitize=signed-integer-overflow -fuse-ld=gold"; fi
|
||||||
|
- if [ "$TSAN" == "On" ]; then export CXX_FLAGS="${CXX_FLAGS} -fsanitize=thread -fno-omit-frame-pointer -fuse-ld=gold"; fi
|
||||||
|
- cd ${TRAVIS_BUILD_DIR}
|
||||||
|
- mkdir -p build && cd build
|
||||||
|
- cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_CXX_STANDARD=$CPP -DCMAKE_CXX_FLAGS="${CXX_FLAGS}" -DSPDLOG_BUILD_EXAMPLES=ON --warn-uninitialized
|
||||||
|
- VERBOSE=1 make -j2
|
||||||
|
|
||||||
|
script:
|
||||||
|
- if [ "$ASAN" != "On" ] && [ "$TSAN" != "On" ]; then CTEST_FLAGS="-DExperimentalMemCheck"; fi
|
||||||
|
- ctest -j2 -VV $CTEST_FLAGS
|
||||||
|
|
||||||
|
notifications:
|
||||||
|
email: false
|
||||||
|
@ -14,6 +14,7 @@ include(GNUInstallDirs)
|
|||||||
#---------------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------------
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
|
|
||||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||||
set(CMAKE_CXX_FLAGS "-Wall -O3 ${CMAKE_CXX_FLAGS}")
|
set(CMAKE_CXX_FLAGS "-Wall -O3 ${CMAKE_CXX_FLAGS}")
|
||||||
@ -23,6 +24,7 @@ endif()
|
|||||||
# spdlog target
|
# spdlog target
|
||||||
#---------------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------------
|
||||||
add_library(spdlog INTERFACE)
|
add_library(spdlog INTERFACE)
|
||||||
|
add_library(spdlog::spdlog ALIAS spdlog)
|
||||||
|
|
||||||
option(SPDLOG_BUILD_EXAMPLES "Build examples" OFF)
|
option(SPDLOG_BUILD_EXAMPLES "Build examples" OFF)
|
||||||
cmake_dependent_option(SPDLOG_BUILD_TESTING
|
cmake_dependent_option(SPDLOG_BUILD_TESTING
|
||||||
|
@ -24,10 +24,7 @@
|
|||||||
cmake_minimum_required(VERSION 3.1)
|
cmake_minimum_required(VERSION 3.1)
|
||||||
project(SpdlogExamples CXX)
|
project(SpdlogExamples CXX)
|
||||||
|
|
||||||
if(TARGET spdlog)
|
if(NOT TARGET spdlog)
|
||||||
# Part of the main project
|
|
||||||
add_library(spdlog::spdlog ALIAS spdlog)
|
|
||||||
else()
|
|
||||||
# Stand-alone build
|
# Stand-alone build
|
||||||
find_package(spdlog CONFIG REQUIRED)
|
find_package(spdlog CONFIG REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
@ -37,13 +34,10 @@ find_package(Threads REQUIRED)
|
|||||||
add_executable(example example.cpp)
|
add_executable(example example.cpp)
|
||||||
target_link_libraries(example spdlog::spdlog Threads::Threads)
|
target_link_libraries(example spdlog::spdlog Threads::Threads)
|
||||||
|
|
||||||
add_executable(benchmark bench.cpp)
|
|
||||||
target_link_libraries(benchmark spdlog::spdlog Threads::Threads)
|
|
||||||
|
|
||||||
add_executable(multisink multisink.cpp)
|
add_executable(multisink multisink.cpp)
|
||||||
target_link_libraries(multisink spdlog::spdlog Threads::Threads)
|
target_link_libraries(multisink spdlog::spdlog Threads::Threads)
|
||||||
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/logs")
|
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/logs")
|
||||||
add_test(NAME RunExample COMMAND example)
|
add_test(NAME example COMMAND example)
|
||||||
add_test(NAME RunBenchmark COMMAND benchmark)
|
add_test(NAME multisink COMMAND multisink)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include "spdlog/sinks/file_sinks.h"
|
#include "spdlog/sinks/basic_file_sink.h"
|
||||||
#include "spdlog/sinks/stdout_sinks.h"
|
#include "spdlog/sinks/stdout_sinks.h"
|
||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -18,7 +18,7 @@ set(SPDLOG_UTESTS_SOURCES
|
|||||||
|
|
||||||
add_executable(${PROJECT_NAME} ${SPDLOG_UTESTS_SOURCES})
|
add_executable(${PROJECT_NAME} ${SPDLOG_UTESTS_SOURCES})
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE Threads::Threads)
|
target_link_libraries(${PROJECT_NAME} PRIVATE Threads::Threads)
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE spdlog)
|
target_link_libraries(${PROJECT_NAME} PRIVATE spdlog::spdlog)
|
||||||
|
|
||||||
add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME})
|
add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME})
|
||||||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/logs")
|
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/logs")
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
CXX ?= g++
|
|
||||||
CXXFLAGS = -Wall -pedantic -std=c++11 -pthread -O3 -I../include -fmax-errors=1
|
|
||||||
LDPFALGS = -pthread
|
|
||||||
|
|
||||||
CPP_FILES := $(wildcard *.cpp)
|
|
||||||
OBJ_FILES := $(addprefix ./,$(notdir $(CPP_FILES:.cpp=.o)))
|
|
||||||
|
|
||||||
|
|
||||||
tests: $(OBJ_FILES)
|
|
||||||
$(CXX) $(CXXFLAGS) $(LDPFALGS) -o $@ $^
|
|
||||||
mkdir -p logs
|
|
||||||
|
|
||||||
%.o: %.cpp
|
|
||||||
$(CXX) $(CXXFLAGS) -c -o $@ $<
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f tests *.o logs/*.txt
|
|
||||||
|
|
||||||
rebuild: clean tests
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# Install libc++ under travis
|
|
||||||
|
|
||||||
svn --quiet co http://llvm.org/svn/llvm-project/libcxx/trunk libcxx
|
|
||||||
mkdir libcxx/build
|
|
||||||
(cd libcxx/build && cmake .. -DLIBCXX_CXX_ABI=libstdc++ -DLIBCXX_CXX_ABI_INCLUDE_PATHS="/usr/include/c++/4.6;/usr/include/c++/4.6/x86_64-linux-gnu")
|
|
||||||
make -C libcxx/build cxx -j2
|
|
||||||
sudo cp libcxx/build/lib/libc++.so.1.0 /usr/lib/
|
|
||||||
sudo cp -r libcxx/build/include/c++/v1 /usr/include/c++/v1/
|
|
||||||
sudo ln -sf /usr/lib/libc++.so.1.0 /usr/lib/libc++.so
|
|
||||||
sudo ln -sf /usr/lib/libc++.so.1.0 /usr/lib/libc++.so.1
|
|
Loading…
Reference in New Issue
Block a user