Add Travis CI support

This commit is contained in:
Michał Janiszewski 2017-11-15 20:04:42 +01:00 committed by Chris Marsh
parent c834a2e6d9
commit 95be02d4ce
3 changed files with 47 additions and 4 deletions

41
.travis.yml Normal file
View file

@ -0,0 +1,41 @@
language: cpp
addons:
apt:
sources:
- llvm-toolchain-trusty-5.0
packages:
- clang-format-5.0 # needed for formatting
env:
global:
- CLANG_FORMAT_SUFFIX="-5.0"
matrix:
include:
- os: linux
env: MATRIX_EVAL="CC=gcc-5 && CXX=g++-5"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-5
- os: linux
env: MATRIX_EVAL="CC=clang-4.0 && CXX=clang++-4.0"
addons:
apt:
sources:
- llvm-toolchain-trusty-4.0
packages:
- clang-4.0 # note this is *NOT* the same version as clang-format
# prevent Travis from overwriting our CXX variables
before_install:
- eval "${MATRIX_EVAL}"
script:
- mkdir build
- cd build
- cmake -DCLANG_FORMAT_SUFFIX=$CLANG_FORMAT_SUFFIX --config Release ..
- cmake --build . -- -j2

View file

@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.7.0) cmake_minimum_required (VERSION 3.2.0)
project (DiscordRPC) project (DiscordRPC)
include(GNUInstallDirs) include(GNUInstallDirs)
@ -12,12 +12,13 @@ file(GLOB_RECURSE ALL_SOURCE_FILES
src/*.cpp src/*.h src/*.c src/*.cpp src/*.h src/*.c
) )
find_program(CLANG_FORMAT_CMD clang-format) # Set CLANG_FORMAT_SUFFIX if you are using custom clang-format, e.g. clang-format-5.0
find_program(CLANG_FORMAT_CMD clang-format${CLANG_FORMAT_SUFFIX})
if (CLANG_FORMAT_CMD) if (CLANG_FORMAT_CMD)
add_custom_target( add_custom_target(
clangformat clangformat
COMMAND clang-format COMMAND ${CLANG_FORMAT_CMD}
-i -style=file -fallback-style=none -i -style=file -fallback-style=none
${ALL_SOURCE_FILES} ${ALL_SOURCE_FILES}
DEPENDS DEPENDS

View file

@ -3,6 +3,8 @@ include_directories(${PROJECT_SOURCE_DIR}/include)
option(ENABLE_IO_THREAD "Start up a separate I/O thread, otherwise I'd need to call an update function" ON) option(ENABLE_IO_THREAD "Start up a separate I/O thread, otherwise I'd need to call an update function" ON)
option(USE_STATIC_CRT "Use /MT[d] for dynamic library" OFF) option(USE_STATIC_CRT "Use /MT[d] for dynamic library" OFF)
set(CMAKE_CXX_STANDARD 14)
set(BASE_RPC_SRC set(BASE_RPC_SRC
${PROJECT_SOURCE_DIR}/include/discord-rpc.h ${PROJECT_SOURCE_DIR}/include/discord-rpc.h
discord-rpc.cpp discord-rpc.cpp
@ -83,7 +85,6 @@ if(UNIX)
-Wno-exit-time-destructors # not sure about these -Wno-exit-time-destructors # not sure about these
-Wno-global-constructors -Wno-global-constructors
) )
target_compile_options(discord-rpc PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-std=c++14>)
if (${BUILD_SHARED_LIBS}) if (${BUILD_SHARED_LIBS})
target_compile_options(discord-rpc PRIVATE -fPIC) target_compile_options(discord-rpc PRIVATE -fPIC)