mirror of
https://github.com/gabime/spdlog.git
synced 2024-11-15 08:25:43 +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:
|
||||
# - Louis Dionne's Hana: https://github.com/ldionne/hana
|
||||
# - Paul Fultz II's FIT: https://github.com/pfultz2/Fit
|
||||
# - Eric Niebler's range-v3: https://github.com/ericniebler/range-v3
|
||||
language: cpp
|
||||
|
||||
# Test matrix:
|
||||
# - Build matrix per compiler: C++11/C++14 + Debug/Release
|
||||
# - Optionally: AddressSanitizer (ASAN)
|
||||
# - Valgrind: all release builds are also tested with valgrind
|
||||
# - clang 3.4, 3.5, 3.6, trunk
|
||||
# - Note: 3.4 and trunk are tested with/without ASAN,
|
||||
# the rest is only tested with ASAN=On.
|
||||
# - gcc 4.9, 5.0
|
||||
#
|
||||
matrix:
|
||||
include:
|
||||
|
||||
# Test gcc-4.8: C++11, Build=Debug/Release, ASAN=Off
|
||||
- env: GCC_VERSION=4.8 BUILD_TYPE=Debug CPP=11 ASAN=Off LIBCXX=Off
|
||||
os: linux
|
||||
addons: &gcc48
|
||||
apt:
|
||||
packages:
|
||||
- g++-4.8
|
||||
- valgrind
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- env: GCC_VERSION=4.8 BUILD_TYPE=Release CPP=11 ASAN=Off LIBCXX=Off
|
||||
os: linux
|
||||
addons: *gcc48
|
||||
|
||||
# Test gcc-4.9: C++11, Build=Debug/Release, ASAN=Off
|
||||
- env: GCC_VERSION=4.9 BUILD_TYPE=Debug CPP=11 ASAN=Off LIBCXX=Off
|
||||
os: linux
|
||||
addons: &gcc49
|
||||
apt:
|
||||
packages:
|
||||
- g++-4.9
|
||||
- valgrind
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- env: GCC_VERSION=4.9 BUILD_TYPE=Release CPP=11 ASAN=Off LIBCXX=Off
|
||||
os: linux
|
||||
addons: *gcc49
|
||||
|
||||
# Install dependencies
|
||||
before_install:
|
||||
- export CHECKOUT_PATH=`pwd`;
|
||||
- if [ -n "$GCC_VERSION" ]; then export CXX="g++-${GCC_VERSION}" CC="gcc-${GCC_VERSION}"; fi
|
||||
- if [ -n "$CLANG_VERSION" ]; then export CXX="clang++-${CLANG_VERSION}" CC="clang-${CLANG_VERSION}"; fi
|
||||
- if [ "$CLANG_VERSION" == "3.4" ]; then export CXX="/usr/local/clang-3.4/bin/clang++" CC="/usr/local/clang-3.4/bin/clang"; fi
|
||||
- which $CXX
|
||||
- which $CC
|
||||
- which valgrind
|
||||
- if [ -n "$CLANG_VERSION" ]; then sudo CXX=$CXX CC=$CC ./tests/install_libcxx.sh; fi
|
||||
|
||||
install:
|
||||
- cd $CHECKOUT_PATH
|
||||
|
||||
# Workaround for valgrind bug: https://bugs.kde.org/show_bug.cgi?id=326469.
|
||||
# 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
|
||||
- sed -i 's/march=native/msse4.2/' example/Makefile
|
||||
|
||||
- if [ ! -d build ]; then mkdir build; fi
|
||||
- export CXX_FLAGS="-I${CHECKOUT_PATH}/include"
|
||||
- export CXX_LINKER_FLAGS=""
|
||||
- if [ -z "$BUILD_TYPE" ]; then export BUILD_TYPE=Release; fi
|
||||
- if [ "$ASAN" == "On"]; then export CXX_FLAGS="${CXX_FLAGS} -fsanitize=address,undefined,integer -fno-omit-frame-pointer -fno-sanitize=unsigned-integer-overflow"; fi
|
||||
- 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
|
||||
- if [ "$LIBCXX" == "On" ]; then CXX_LINKER_FLAGS="${CXX_FLAGS} -L/usr/lib/ -lc++"; fi
|
||||
- CXX_FLAGS="${CXX_FLAGS} -std=c++${CPP}"
|
||||
|
||||
# Build examples
|
||||
- cd example
|
||||
- if [ "$BUILD_TYPE" == "Release" ]; then make rebuild CXXFLAGS="${CXX_FLAGS} ${CXX_LINKER_FLAGS}" VERBOSE=1; export BIN=example; fi
|
||||
- if [ "$BUILD_TYPE" == "Debug" ]; then make rebuild debug CXXFLAGS="${CXX_FLAGS} ${CXX_LINKER_FLAGS}" VERBOSE=1; export BIN=example-debug; fi
|
||||
|
||||
|
||||
script:
|
||||
- ./"${BIN}"
|
||||
- valgrind --trace-children=yes --leak-check=full ./"${BIN}"
|
||||
- cd $CHECKOUT_PATH/tests; make rebuild; ./tests
|
||||
- cd $CHECKOUT_PATH/tests; STYLE=printf make rebuild; ./tests
|
||||
|
||||
notifications:
|
||||
email: false
|
||||
# Adapted from various sources, including:
|
||||
# - Louis Dionne's Hana: https://github.com/ldionne/hana
|
||||
# - Paul Fultz II's FIT: https://github.com/pfultz2/Fit
|
||||
# - Eric Niebler's range-v3: https://github.com/ericniebler/range-v3
|
||||
language: cpp
|
||||
|
||||
addons: &gcc48
|
||||
apt:
|
||||
packages:
|
||||
- g++-4.8
|
||||
- valgrind
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
addons: &gcc49
|
||||
apt:
|
||||
packages:
|
||||
- g++-4.9
|
||||
- valgrind
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
addons: &gcc7
|
||||
apt:
|
||||
packages:
|
||||
- g++-7
|
||||
- valgrind
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
addons: &clang35
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.5
|
||||
- valgrind
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.5
|
||||
|
||||
matrix:
|
||||
include:
|
||||
# Test gcc-4.8: C++11, Build=Debug/Release
|
||||
- env: GCC_VERSION=4.8 BUILD_TYPE=Debug CPP=11
|
||||
os: linux
|
||||
addons: *gcc48
|
||||
|
||||
- env: GCC_VERSION=4.8 BUILD_TYPE=Release CPP=11
|
||||
os: linux
|
||||
addons: *gcc48
|
||||
|
||||
# Test gcc-4.9: C++11, Build=Debug/Release
|
||||
- env: GCC_VERSION=4.9 BUILD_TYPE=Debug CPP=11
|
||||
os: linux
|
||||
addons: *gcc49
|
||||
|
||||
- env: GCC_VERSION=4.9 BUILD_TYPE=Release CPP=11
|
||||
os: linux
|
||||
addons: *gcc49
|
||||
|
||||
# Test gcc-7: C++11, Build=Debug/Release
|
||||
- env: GCC_VERSION=7 BUILD_TYPE=Debug CPP=11
|
||||
os: linux
|
||||
addons: *gcc7
|
||||
|
||||
- env: GCC_VERSION=7 BUILD_TYPE=Release CPP=11
|
||||
os: linux
|
||||
addons: *gcc7
|
||||
|
||||
# Test clang-3.5: C++11, Build=Debug/Release
|
||||
- env: CLANG_VERSION=3.5 BUILD_TYPE=Debug CPP=11
|
||||
os: linux
|
||||
addons: *clang35
|
||||
|
||||
- env: CLANG_VERSION=3.5 BUILD_TYPE=Release CPP=11
|
||||
os: linux
|
||||
addons: *clang35
|
||||
|
||||
# Test gcc-7: C++11, Build=Debug, ASAN=On
|
||||
- env: GCC_VERSION=7 BUILD_TYPE=Debug CPP=11 ASAN=On
|
||||
os: linux
|
||||
addons: *gcc7
|
||||
|
||||
# Test gcc-7: C++11, Build=Debug, TSAN=On
|
||||
- env: GCC_VERSION=7 BUILD_TYPE=Debug CPP=11 TSAN=On
|
||||
os: linux
|
||||
addons: *gcc7
|
||||
|
||||
before_install:
|
||||
- if [ -n "$GCC_VERSION" ]; then export CXX="g++-${GCC_VERSION}" CC="gcc-${GCC_VERSION}"; fi
|
||||
- if [ -n "$CLANG_VERSION" ]; then export CXX="clang++-${CLANG_VERSION}" CC="clang-${CLANG_VERSION}"; fi
|
||||
- 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_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||
set(CMAKE_CXX_FLAGS "-Wall -O3 ${CMAKE_CXX_FLAGS}")
|
||||
@ -23,6 +24,7 @@ endif()
|
||||
# spdlog target
|
||||
#---------------------------------------------------------------------------------------
|
||||
add_library(spdlog INTERFACE)
|
||||
add_library(spdlog::spdlog ALIAS spdlog)
|
||||
|
||||
option(SPDLOG_BUILD_EXAMPLES "Build examples" OFF)
|
||||
cmake_dependent_option(SPDLOG_BUILD_TESTING
|
||||
|
@ -24,10 +24,7 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
project(SpdlogExamples CXX)
|
||||
|
||||
if(TARGET spdlog)
|
||||
# Part of the main project
|
||||
add_library(spdlog::spdlog ALIAS spdlog)
|
||||
else()
|
||||
if(NOT TARGET spdlog)
|
||||
# Stand-alone build
|
||||
find_package(spdlog CONFIG REQUIRED)
|
||||
endif()
|
||||
@ -37,13 +34,10 @@ find_package(Threads REQUIRED)
|
||||
add_executable(example example.cpp)
|
||||
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)
|
||||
target_link_libraries(multisink spdlog::spdlog Threads::Threads)
|
||||
|
||||
enable_testing()
|
||||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/logs")
|
||||
add_test(NAME RunExample COMMAND example)
|
||||
add_test(NAME RunBenchmark COMMAND benchmark)
|
||||
add_test(NAME example COMMAND example)
|
||||
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/spdlog.h"
|
||||
#include <iostream>
|
||||
|
@ -18,7 +18,7 @@ set(SPDLOG_UTESTS_SOURCES
|
||||
|
||||
add_executable(${PROJECT_NAME} ${SPDLOG_UTESTS_SOURCES})
|
||||
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})
|
||||
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