Remove warnings-as-errors by default
Compiling C++ on various different platforms with as many out of tree dependencies as we have is volatile at best. In order to prevent a third party warning from ruining the build for people who don't care about third party warnings, we remove warnings-as-errors by default. They are still enabled by default on CI.
This commit is contained in:
committed by
username223
parent
44a5d3eed0
commit
5a7fe687d8
+3
-1
@@ -13,6 +13,7 @@ environment:
|
|||||||
LLVM_LOC: '"C:\Program Files\LLVM\bin\"'
|
LLVM_LOC: '"C:\Program Files\LLVM\bin\"'
|
||||||
PYTHON_LOC: '"C:\Python37\"'
|
PYTHON_LOC: '"C:\Python37\"'
|
||||||
BUILD_PACKAGE: "1"
|
BUILD_PACKAGE: "1"
|
||||||
|
OVRAS_WARNINGS_AS_ERRORS: "1"
|
||||||
|
|
||||||
- QT_LOC: '"C:\Qt\5.12\msvc2017_64\bin\"'
|
- QT_LOC: '"C:\Qt\5.12\msvc2017_64\bin\"'
|
||||||
VS_LOC: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat"'
|
VS_LOC: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat"'
|
||||||
@@ -23,6 +24,7 @@ environment:
|
|||||||
PYTHON_LOC: '"C:\Python37\"'
|
PYTHON_LOC: '"C:\Python37\"'
|
||||||
BUILD_PACKAGE: "1"
|
BUILD_PACKAGE: "1"
|
||||||
BUILD_CLANG: '"1"'
|
BUILD_CLANG: '"1"'
|
||||||
|
OVRAS_WARNINGS_AS_ERRORS: "1"
|
||||||
|
|
||||||
|
|
||||||
clone_depth: 1
|
clone_depth: 1
|
||||||
@@ -46,4 +48,4 @@ branches:
|
|||||||
- /docs-*/
|
- /docs-*/
|
||||||
- /do-not-run-ci-*/
|
- /do-not-run-ci-*/
|
||||||
- /only-travis-ci-*/
|
- /only-travis-ci-*/
|
||||||
- /only-circle-ci-*/
|
- /only-circle-ci-*/
|
||||||
|
|||||||
@@ -123,3 +123,7 @@ debugSymbolsAndLogs {
|
|||||||
CONFIG += force_debug_info
|
CONFIG += force_debug_info
|
||||||
DEFINES += ENABLE_DEBUG_LOGGING
|
DEFINES += ENABLE_DEBUG_LOGGING
|
||||||
}
|
}
|
||||||
|
|
||||||
|
warnings_as_errors {
|
||||||
|
message(Warnings as errors enabled.)
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,15 +1,30 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
QMAKE_SPEC='linux-g++'
|
||||||
|
|
||||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||||
PROJECT_DIR=$SCRIPT_DIR/../../
|
PROJECT_DIR=$SCRIPT_DIR/../../
|
||||||
BUILD_DIR=$PROJECT_DIR/build/
|
BUILD_DIR=$PROJECT_DIR/build/
|
||||||
. $SCRIPT_DIR/configure.sh
|
|
||||||
|
if [[ -z $USE_TIDY ]]; then
|
||||||
|
MAKE_COMMAND="make --jobs ${MAKE_JOBS}"
|
||||||
|
CLANG_TIDY=
|
||||||
|
else
|
||||||
|
# Bear replaces the compile database, it does not update it.
|
||||||
|
# If you run 'bear make' and there is nothing to compile, you
|
||||||
|
# will get an empty database.
|
||||||
|
# Clean up the artifacts and run everything together in that case.
|
||||||
|
MAKE_COMMAND='bear make --jobs'
|
||||||
|
QMAKE_SPEC='linux-clang'
|
||||||
|
CLANG_TIDY="$SCRIPT_DIR/run-clang-tidy.sh"
|
||||||
|
fi
|
||||||
|
|
||||||
echo $MAKE_COMMAND
|
echo $MAKE_COMMAND
|
||||||
mkdir -p $BUILD_DIR
|
mkdir -p $BUILD_DIR
|
||||||
cd $BUILD_DIR
|
cd $BUILD_DIR
|
||||||
qmake --version
|
qmake --version
|
||||||
qmake -spec $QMAKE_SPEC $PROJECT_DIR $QMAKE_EXTRAS
|
qmake -spec $QMAKE_SPEC $PROJECT_DIR CONFIG+=warnings_as_errors
|
||||||
$MAKE_COMMAND
|
$MAKE_COMMAND
|
||||||
$CLANG_TIDY
|
$CLANG_TIDY
|
||||||
|
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
if [[ -z $QMAKE_SPEC ]]; then
|
|
||||||
QMAKE_SPEC='linux-g++'
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -z $USE_TIDY ]]; then
|
|
||||||
MAKE_COMMAND="make --jobs ${MAKE_JOBS}"
|
|
||||||
CLANG_TIDY=
|
|
||||||
else
|
|
||||||
# Bear replaces the compile database, it does not update it.
|
|
||||||
# If you run 'bear make' and there is nothing to compile, you
|
|
||||||
# will get an empty database.
|
|
||||||
# Clean up the artifacts and run everything together in that case.
|
|
||||||
MAKE_COMMAND='bear make --jobs'
|
|
||||||
QMAKE_SPEC='linux-clang'
|
|
||||||
CLANG_TIDY="$SCRIPT_DIR/run-clang-tidy.sh"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -n $NO_X11 ]]; then
|
|
||||||
QMAKE_EXTRAS='CONFIG+=noX11'
|
|
||||||
fi
|
|
||||||
if [[ -n $NO_DBUS ]]; then
|
|
||||||
QMAKE_EXTRAS='CONFIG+=noDBUS'
|
|
||||||
fi
|
|
||||||
@@ -48,7 +48,10 @@ QMAKE_CXXFLAGS += -Wmost
|
|||||||
|
|
||||||
QMAKE_CXXFLAGS += -Wpedantic
|
QMAKE_CXXFLAGS += -Wpedantic
|
||||||
|
|
||||||
QMAKE_CXXFLAGS += -Werror
|
warnings_as_errors {
|
||||||
|
QMAKE_CXXFLAGS += -Werror
|
||||||
|
}
|
||||||
|
|
||||||
#All includes from the third-party directory will not warn.
|
#All includes from the third-party directory will not warn.
|
||||||
QMAKE_CXXFLAGS += --system-header-prefix=third-party
|
QMAKE_CXXFLAGS += --system-header-prefix=third-party
|
||||||
QMAKE_CXXFLAGS += --system-header-prefix=qt
|
QMAKE_CXXFLAGS += --system-header-prefix=qt
|
||||||
|
|||||||
@@ -27,7 +27,9 @@ include(clang-gcc-common-switches.pri)
|
|||||||
|
|
||||||
QMAKE_CXXFLAGS += -Wpedantic
|
QMAKE_CXXFLAGS += -Wpedantic
|
||||||
|
|
||||||
QMAKE_CXXFLAGS += -Werror
|
warnings_as_errors {
|
||||||
|
QMAKE_CXXFLAGS += -Werror
|
||||||
|
}
|
||||||
|
|
||||||
# GCC only switches
|
# GCC only switches
|
||||||
QMAKE_CXXFLAGS += -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Wrestrict -Wnull-dereference
|
QMAKE_CXXFLAGS += -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Wrestrict -Wnull-dereference
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
include(common-msvc.pri)
|
include(common-msvc.pri)
|
||||||
|
|
||||||
# Warnings as errors
|
warnings_as_errors {
|
||||||
QMAKE_CXXFLAGS += /WX
|
# Warnings as errors
|
||||||
|
QMAKE_CXXFLAGS += /WX
|
||||||
|
}
|
||||||
|
|
||||||
# Enables Link Time Optimization
|
# Enables Link Time Optimization
|
||||||
QMAKE_CXXFLAGS += /GL
|
QMAKE_CXXFLAGS += /GL
|
||||||
|
|||||||
@@ -139,7 +139,10 @@ def build():
|
|||||||
say(f"{BUILD_DEBUG_VAR_NAME} not defined. Building '{COMPILE_MODE}' version.")
|
say(f"{BUILD_DEBUG_VAR_NAME} not defined. Building '{COMPILE_MODE}' version.")
|
||||||
|
|
||||||
add_line_to_run_bat_file("@ECHO Running qmake:")
|
add_line_to_run_bat_file("@ECHO Running qmake:")
|
||||||
add_line_to_run_bat_file('"' + QMAKE_LOC + '"' + " -spec " + COMPILER + " CONFIG+=X86_64 " + "CONFIG+=" + COMPILE_MODE)
|
if is_env_var_set("OVRAS_WARNINGS_AS_ERRORS"):
|
||||||
|
add_line_to_run_bat_file('"' + QMAKE_LOC + '"' + " -spec " + COMPILER + " CONFIG+=X86_64 " + "CONFIG+=" + COMPILE_MODE + " CONFIG+=warnings_as_errors")
|
||||||
|
else:
|
||||||
|
add_line_to_run_bat_file('"' + QMAKE_LOC + '"' + " -spec " + COMPILER + " CONFIG+=X86_64 " + "CONFIG+=" + COMPILE_MODE)
|
||||||
add_error_handling_line_to_bat_file()
|
add_error_handling_line_to_bat_file()
|
||||||
add_line_to_run_bat_file("@ECHO qmake done.")
|
add_line_to_run_bat_file("@ECHO qmake done.")
|
||||||
|
|
||||||
|
|||||||
@@ -343,6 +343,7 @@ The following values can be appended to the `CONFIG` internal variable in order
|
|||||||
| `noDBUS` | Disables DBUS specific features (control media players). |
|
| `noDBUS` | Disables DBUS specific features (control media players). |
|
||||||
| `noPulse` | Disables PulseAudio specific features (change audio devices). |
|
| `noPulse` | Disables PulseAudio specific features (change audio devices). |
|
||||||
| `debugSymbolsAndLogs` | Enables debug symbols and debug logging calls (while still having release optimizations). |
|
| `debugSymbolsAndLogs` | Enables debug symbols and debug logging calls (while still having release optimizations). |
|
||||||
|
| `warnings_as_errors` | Makes compiler warnings failing errors (not needed unless you're changing the source). |
|
||||||
|
|
||||||
The values are case sensitive.
|
The values are case sensitive.
|
||||||
|
|
||||||
@@ -361,6 +362,11 @@ If you want to disable X11, DBUS and PulseAudio features you would type
|
|||||||
qmake CONFIG+=noX11 CONFIG+=noDBUS CONFIG+=noPulse
|
qmake CONFIG+=noX11 CONFIG+=noDBUS CONFIG+=noPulse
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you want to compile with warnings as errors you would type
|
||||||
|
```bash
|
||||||
|
qmake CONFIG+=warnings_as_errors
|
||||||
|
```
|
||||||
|
|
||||||
The location for `make install` can be configured in the `qmake` step.
|
The location for `make install` can be configured in the `qmake` step.
|
||||||
This is done by setting the `PREFIX` variable.
|
This is done by setting the `PREFIX` variable.
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
Reference in New Issue
Block a user