Add Clang to Travis and treat warnings as errors

The GCC version used by Travis is old and appears not to support all the
warnings we would like to get, so reenable Clang. Additionally make lots
of cleanups to Travis config and make the build a lot faster too.

Also change both Travis and AppVeyor builds to treat warnings as errors,
and include VS2017 in the matrix for AppVeyor. I have also removed
VS2010 because it is ancient at this point.

Updated Premake to alpha12 and fixed the premake build file
appropriately.
This commit is contained in:
Jakob Botsch Nielsen 2018-06-15 23:01:02 +02:00 committed by Jakob Botsch Nielsen
parent c4ad0b2eb4
commit c2d7463a38
5 changed files with 45 additions and 57 deletions

View File

@ -5,4 +5,8 @@ root = true
[*] [*]
indent_size = 4 indent_size = 4
indent_style = tab indent_style = tab
[*.yml]
indent_size = 2
indent_style = space

View File

@ -5,36 +5,22 @@ language: cpp
# Build with gcc and clang. # Build with gcc and clang.
compiler: compiler:
- gcc - gcc
# Disable clang for now since it seems there's a problem using it with fast fp math; it's likely Travis' ancient environment that's at fault. - clang
# - clang
# Build both debug and release configurations, through use of an environment variable in the build matrix. # Build both debug and release configurations, through use of an environment variable in the build matrix.
env: env:
- CONFIGURATION: debug - BUILD_TYPE=debug CMAKE_BUILD_TYPE=Debug
CMAKE_BUILD_TYPE: Debug - BUILD_TYPE=release CMAKE_BUILD_TYPE=Release
- CONFIGURATION: release
CMAKE_BUILD_TYPE: Release addons:
apt:
packages:
- libsdl2-dev
install: install:
# Download and build SDL2 from source. - wget https://github.com/premake/premake-core/releases/download/v5.0.0-alpha12/premake-5.0.0-alpha12-linux.tar.gz -O premake.tar.gz
- mkdir dummyprefix - tar -xf premake.tar.gz
- export PREFIX=$PWD/dummyprefix - rm premake.tar.gz
- export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
- export PATH=$PATH:$PWD/dummyprefix/bin
- wget https://www.libsdl.org/release/SDL2-2.0.4.tar.gz -O SDL2.tar.gz
- tar -xzf SDL2.tar.gz
- cd SDL2-2.0.4
- ./configure --prefix=$PREFIX
- make -j$(nproc)
- make install
- cd ..
# Download and build premake5 from source; the Travis environment doesn't have the right version of glibc6 for the prebuilt binaries to work.
- wget https://github.com/premake/premake-core/releases/download/v5.0.0-alpha6/premake-5.0.0-alpha6-src.zip -O premake.zip
- unzip premake.zip
- cd premake-5.0.0-alpha6/build/gmake.unix
- make config=release
- cd ../../..
- mv premake-5.0.0-alpha6/bin/release/premake5 premake5
# Run premake to generate makefiles. # Run premake to generate makefiles.
# Have to cd into directory and back out since premake5 doesn't appear to accept a directory argument. # Have to cd into directory and back out since premake5 doesn't appear to accept a directory argument.
@ -44,7 +30,7 @@ before_script:
# Run make in the directory containing generated makefiles, on the configuration specified by the environment variable. # Run make in the directory containing generated makefiles, on the configuration specified by the environment variable.
script: script:
- make -C RecastDemo/Build/gmake -j$(nproc) config=$CONFIGURATION - make -C RecastDemo/Build/gmake -j$(nproc) config=${BUILD_TYPE}
- RecastDemo/Bin/Tests - RecastDemo/Bin/Tests
- make -C build -j$(nproc) - make -C build -j$(nproc)
- cd build && ctest - cd build && ctest

View File

@ -1,12 +1,12 @@
file(GLOB SOURCES Source/*.cpp Contrib/fastlz/fastlz.c) file(GLOB SOURCES Source/*.cpp Contrib/fastlz/fastlz.c)
include(cmake/FindSDL2.cmake) LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
find_package(OpenGL REQUIRED) find_package(OpenGL REQUIRED)
find_package(SDL2 REQUIRED) find_package(SDL2 REQUIRED)
include_directories(SYSTEM ${OPENGL_INCLUDE_DIR}) include_directories(SYSTEM ${OPENGL_INCLUDE_DIR})
include_directories(SYSTEM ${SDL2_INCLUDE_DIRS}) include_directories(SYSTEM ${SDL2_INCLUDE_DIR})
include_directories(SYSTEM Contrib/fastlz) include_directories(SYSTEM Contrib/fastlz)
include_directories(SYSTEM Contrib) include_directories(SYSTEM Contrib)
include_directories(../DebugUtils/Include) include_directories(../DebugUtils/Include)

View File

@ -11,16 +11,14 @@ solution "recastnavigation"
"Debug", "Debug",
"Release" "Release"
} }
location (todir) location (todir)
-- extra warnings, no exceptions or rtti floatingpoint "Fast"
flags { symbols "On"
"ExtraWarnings",
"FloatFast",
"Symbols"
}
exceptionhandling "Off" exceptionhandling "Off"
rtti "Off" rtti "Off"
flags { "FatalCompileWarnings" }
-- debug configs -- debug configs
configuration "Debug*" configuration "Debug*"
@ -30,19 +28,20 @@ solution "recastnavigation"
-- release configs -- release configs
configuration "Release*" configuration "Release*"
defines { "NDEBUG" } defines { "NDEBUG" }
flags { "Optimize" } optimize "On"
targetdir ( todir .. "/lib/Release" ) targetdir ( todir .. "/lib/Release" )
configuration "not windows"
warnings "Extra"
-- windows specific -- windows specific
configuration "windows" configuration "windows"
defines { "WIN32", "_WINDOWS", "_CRT_SECURE_NO_WARNINGS", "_HAS_EXCEPTIONS=0" } defines { "WIN32", "_WINDOWS", "_CRT_SECURE_NO_WARNINGS", "_HAS_EXCEPTIONS=0" }
-- warnings "Extra" uses /W4 which is too aggressive for us, so use W3 instead.
-- linux specific -- Disable:
configuration { "linux", "gmake" } -- * C4351: new behavior for array initialization
buildoptions { -- * C4291: no matching operator delete found; we don't use exceptions, so doesn't matter
"-Wall", buildoptions { "/W3", "/wd4351", "/wd4291" }
"-Werror"
}
project "DebugUtils" project "DebugUtils"
language "C++" language "C++"
@ -171,7 +170,6 @@ project "RecastDemo"
configuration { "macosx" } configuration { "macosx" }
kind "ConsoleApp" -- xcode4 failes to run the project if using WindowedApp kind "ConsoleApp" -- xcode4 failes to run the project if using WindowedApp
includedirs { "/Library/Frameworks/SDL2.framework/Headers" } includedirs { "/Library/Frameworks/SDL2.framework/Headers" }
buildoptions { "-Wunused-value -Wshadow -Wreorder -Wsign-compare -Wall" }
links { links {
"OpenGL.framework", "OpenGL.framework",
"SDL2.framework", "SDL2.framework",
@ -248,7 +246,6 @@ project "Tests"
configuration { "macosx" } configuration { "macosx" }
kind "ConsoleApp" kind "ConsoleApp"
includedirs { "/Library/Frameworks/SDL2.framework/Headers" } includedirs { "/Library/Frameworks/SDL2.framework/Headers" }
buildoptions { "-Wunused-value -Wshadow -Wreorder -Wsign-compare -Wall" }
links { links {
"OpenGL.framework", "OpenGL.framework",
"SDL2.framework", "SDL2.framework",

View File

@ -1,17 +1,21 @@
shallow_clone: true shallow_clone: true
os:
- Visual Studio 2015
environment: environment:
matrix: matrix:
- TOOLSET: vs2010 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
- TOOLSET: vs2013 PREMAKE_ACTION: vs2013
- TOOLSET: vs2015 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
PREMAKE_ACTION: vs2015
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
PREMAKE_ACTION: vs2017
configuration:
- Debug
- Release
install: install:
# Download Premake # Download Premake
- ps: Start-FileDownload 'https://github.com/premake/premake-core/releases/download/v5.0.0-alpha7/premake-5.0.0-alpha7-windows.zip' 'premake.zip' - ps: Start-FileDownload 'https://github.com/premake/premake-core/releases/download/v5.0.0-alpha12/premake-5.0.0-alpha12-windows.zip' 'premake.zip'
# Extract it in-place; premake5.exe is at the top level. # Extract it in-place; premake5.exe is at the top level.
- 7z x premake.zip - 7z x premake.zip
@ -23,14 +27,11 @@ install:
- cd RecastDemo\Contrib && 7z x SDL.zip && ren SDL2-2.0.4 SDL && cd ..\.. - cd RecastDemo\Contrib && 7z x SDL.zip && ren SDL2-2.0.4 SDL && cd ..\..
# Generate solution files using premake. # Generate solution files using premake.
- cd RecastDemo && "../premake5.exe" %TOOLSET% && cd .. - cd RecastDemo && "../premake5.exe" %PREMAKE_ACTION% && cd ..
configuration:
- Debug
- Release
build: build:
project: RecastDemo/Build/$(TOOLSET)/recastnavigation.sln project: RecastDemo/Build/$(PREMAKE_ACTION)/recastnavigation.sln
after_test: after_test:
- RecastDemo\Bin\Tests.exe - RecastDemo\Bin\Tests.exe