mirror of
https://gitlab.com/libtiff/libtiff.git
synced 2026-01-18 13:41:17 +01:00
ci: Build CMake builds with extra-warnings
* Split extra-warnings into extra-warnings and broken-warnings * extra-warnings initially only uses -pedantic -Wextra * Warnings will be moved from broken-warnings to extra-warnings once the CI builds have proved them safe to use
This commit is contained in:
@@ -21,7 +21,7 @@ basic-build-fork:
|
||||
script:
|
||||
- sh build/gitlab-ci cmake "Unix Makefiles" Debug static
|
||||
|
||||
basic-build-main:
|
||||
basic-build:
|
||||
stage: pre-build
|
||||
rules:
|
||||
- if: '$CI_PROJECT_PATH == "libtiff/libtiff"'
|
||||
|
||||
@@ -45,7 +45,7 @@ cmake_build()
|
||||
fi
|
||||
mkdir cmake-build
|
||||
cd cmake-build
|
||||
opts="-Dfatal-warnings=ON"
|
||||
opts="-Dfatal-warnings=ON -Dextra-warnings=ON -Dcxx-compat-warnings=ON"
|
||||
para3=`echo "$3" | sed 's/./\L&/g'`
|
||||
if [ "$para3" = "static" ]; then
|
||||
opts2="-DBUILD_SHARED_LIBS:BOOL=OFF"
|
||||
@@ -55,7 +55,7 @@ cmake_build()
|
||||
opts2=""
|
||||
fi
|
||||
echo "Running cmake -G "$1" -DCMAKE_UNITY_BUILD=ON -DCMAKE_BUILD_TYPE="$2" -DCMAKE_INSTALL_PREFIX=../cmake-install ${opts} ${opts2} .."
|
||||
cmake -G "$1" -DCMAKE_UNITY_BUILD=ON -DCMAKE_BUILD_TYPE="$2" -DCMAKE_INSTALL_PREFIX=../cmake-install -DCMAKE_C_FLAGS="-Wall -Wextra -Werror" -Dcxx-compat-warnings=ON ${opts} ${opts2} ..
|
||||
cmake -G "$1" -DCMAKE_UNITY_BUILD=ON -DCMAKE_BUILD_TYPE="$2" -DCMAKE_INSTALL_PREFIX=../cmake-install ${opts} ${opts2} ..
|
||||
$COVERITY_BUILD cmake --build .
|
||||
cmake --build . --target install
|
||||
ctest -V
|
||||
|
||||
@@ -51,7 +51,7 @@ cmake --version
|
||||
gcc --version || { echo "gcc not found in Cygwin"; exit 1; }
|
||||
|
||||
# Configure CMake options
|
||||
CMAKE_OPTS="-Dfatal-warnings=ON"
|
||||
CMAKE_OPTS="-Dfatal-warnings=ON -Dextra-warnings=ON -Dcxx-compat-warnings=ON"
|
||||
CMAKE_OPTS="$CMAKE_OPTS -DCMAKE_UNITY_BUILD=ON"
|
||||
CMAKE_OPTS="$CMAKE_OPTS -DCMAKE_C_FLAGS=-Wall -Wextra -Werror"
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ cmake --version
|
||||
gcc --version || { echo "gcc not found in MinGW"; exit 1; }
|
||||
|
||||
# Configure CMake options
|
||||
CMAKE_OPTS="-Dfatal-warnings=ON"
|
||||
CMAKE_OPTS="-Dfatal-warnings=ON -Dextra-warnings=ON -Dcxx-compat-warnings=ON"
|
||||
CMAKE_OPTS="$CMAKE_OPTS -DCMAKE_UNITY_BUILD=ON"
|
||||
CMAKE_OPTS="$CMAKE_OPTS -DCMAKE_C_FLAGS=-Wall -Wextra -Werror"
|
||||
|
||||
|
||||
@@ -210,7 +210,8 @@ function Invoke-CMakeConfigure {
|
||||
"-DCMAKE_INSTALL_PREFIX=$InstallDir",
|
||||
"-DCMAKE_UNITY_BUILD=ON",
|
||||
"-Dfatal-warnings=ON",
|
||||
"-Dextra-warnings=ON"
|
||||
"-Dextra-warnings=ON",
|
||||
"-Dcxx-compat-warnings=ON"
|
||||
)
|
||||
|
||||
# Add vcpkg toolchain if available
|
||||
@@ -235,9 +236,6 @@ function Invoke-CMakeConfigure {
|
||||
$cmakeArgs += "-DBUILD_SHARED_LIBS=ON"
|
||||
}
|
||||
|
||||
# Add MSVC-specific warning flags
|
||||
$cmakeArgs += "-DCMAKE_C_FLAGS=/W4 /WX"
|
||||
|
||||
$cmakeArgs += $SourceDir
|
||||
|
||||
Write-Host "Running: cmake $($cmakeArgs -join ' ')"
|
||||
|
||||
@@ -29,9 +29,17 @@ include(CheckCCompilerFlag)
|
||||
|
||||
# These are annoyingly verbose, produce false positives or don't work
|
||||
# nicely with all supported compiler versions, so are disabled unless
|
||||
# explicitly enabled.
|
||||
# explicitly enabled. These warnings are expected to be clean for
|
||||
# CI builds when combined with fatal-warnings.
|
||||
option(extra-warnings "Enable extra compiler warnings" OFF)
|
||||
|
||||
# These are annoyingly verbose, produce false positives or don't work
|
||||
# nicely with all supported compiler versions, so are disabled unless
|
||||
# explicitly enabled. Not used in CI builds because it cannot be
|
||||
# guaranteed that the builds will be warning-free and so cannot be
|
||||
# combined with fatal-warnings without breaking the builds.
|
||||
option(broken-warnings "Enable compiler warnings which will warn erroneously or are broken on some platforms" OFF)
|
||||
|
||||
# This will cause the compiler to fail when an error occurs.
|
||||
option(fatal-warnings "Compiler warnings are errors" OFF)
|
||||
|
||||
@@ -71,6 +79,10 @@ if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR
|
||||
list(APPEND test_flags
|
||||
-pedantic
|
||||
-Wextra
|
||||
)
|
||||
endif()
|
||||
if(broken-warnings)
|
||||
list(APPEND test_flags
|
||||
-Wformat
|
||||
-Wformat-overflow
|
||||
-Wformat-nonliteral
|
||||
|
||||
Reference in New Issue
Block a user