1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

fix(build): disable Werror by default, keep enabled on CI

To allow for easier building with different compilers on user systems. Keep
strict checks on CI to make sure new warnings aren't ignored.
This commit is contained in:
Anthony Bilinski 2020-04-12 01:34:31 -07:00
parent 6e2ac12d84
commit 9888bc2d80
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
6 changed files with 26 additions and 6 deletions

View File

@ -167,6 +167,7 @@ build_qtox() {
-DSMILEYS=DISABLED \ -DSMILEYS=DISABLED \
-DENABLE_STATUSNOTIFIER=False \ -DENABLE_STATUSNOTIFIER=False \
-DENABLE_GTK_SYSTRAY=False \ -DENABLE_GTK_SYSTRAY=False \
-DSTRICT_OPTIONS=ON \
-DSPELL_CHECK=OFF -DSPELL_CHECK=OFF
bdir bdir
@ -175,7 +176,9 @@ build_qtox() {
rm -rf "$BUILDDIR" rm -rf "$BUILDDIR"
echo '*** BUILDING "FULL" VERSION ***' echo '*** BUILDING "FULL" VERSION ***'
cmake -H. -B"$BUILDDIR" -DUPDATE_CHECK=ON cmake -H. -B"$BUILDDIR" \
-DUPDATE_CHECK=ON \
-DSTRICT_OPTIONS=ON
bdir bdir
} }

View File

@ -30,6 +30,7 @@ option(SPELL_CHECK "Enable spell cheching support" ON)
option(SVGZ_ICON "Compress the SVG icon of qTox" ON) option(SVGZ_ICON "Compress the SVG icon of qTox" ON)
option(ASAN "Compile with AddressSanitizer" OFF) option(ASAN "Compile with AddressSanitizer" OFF)
option(DESKTOP_NOTIFICATIONS "Use snorenotify for desktop notifications" OFF) option(DESKTOP_NOTIFICATIONS "Use snorenotify for desktop notifications" OFF)
option(STRICT_OPTIONS "Enable strict compile options, used by CI" OFF)
# process generated files if cmake >= 3.10 # process generated files if cmake >= 3.10
if(POLICY CMP0071) if(POLICY CMP0071)
@ -84,12 +85,16 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
set(POSITION_INDEPENDENT_CODE True) set(POSITION_INDEPENDENT_CODE True)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wstrict-overflow") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wstrict-overflow")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wstrict-aliasing") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wstrict-aliasing")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
# Extra-strict compile options that we don't want to subject all users to by default
if (STRICT_OPTIONS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
endif()
# avoid timestamps in binary for reproducible builds, not added until GCC 4.9 # avoid timestamps in binary for reproducible builds, not added until GCC 4.9
include(CheckCXXCompilerFlag) include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG(-Wdate-time COMPILER_SUPPORTS_WDATE_TIME) CHECK_CXX_COMPILER_FLAG(-Wdate-time COMPILER_SUPPORTS_WDATE_TIME)
if(COMPILER_SUPPORTS_WDATE_TIME) if (COMPILER_SUPPORTS_WDATE_TIME)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wdate-time") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wdate-time")
endif() endif()

View File

@ -107,6 +107,7 @@ cd _build
# need to build with -DDESKTOP_NOTIFICATIONS=True for snorenotify # need to build with -DDESKTOP_NOTIFICATIONS=True for snorenotify
cmake -DDESKTOP_NOTIFICATIONS=True \ cmake -DDESKTOP_NOTIFICATIONS=True \
-DUPDATE_CHECK=True \ -DUPDATE_CHECK=True \
-DSTRICT_OPTIONS=True \
../ ../
make make

View File

@ -133,7 +133,10 @@
{ {
"name": "qTox", "name": "qTox",
"buildsystem": "cmake-ninja", "buildsystem": "cmake-ninja",
"config-opts": ["-DSVGZ_ICON=OFF"], "config-opts": [
"-DSVGZ_ICON=OFF",
"-DSTRICT_OPTIONS=ON"
],
"sources": [ "sources": [
{ {
"type": "dir", "type": "dir",
@ -143,4 +146,3 @@
} }
] ]
} }

View File

@ -262,7 +262,14 @@ build() {
fcho "Now working in ${PWD}" fcho "Now working in ${PWD}"
fcho "Starting cmake ..." fcho "Starting cmake ..."
export CMAKE_PREFIX_PATH=$(brew --prefix qt5) export CMAKE_PREFIX_PATH=$(brew --prefix qt5)
cmake -H$QTOX_DIR -B. -DUPDATE_CHECK=ON -DSPELL_CHECK=OFF
if [[ $TRAVIS = true ]]
then
STRICT_OPTIONS="ON"
else
STRICT_OPTIONS="OFF"
fi
cmake -H$QTOX_DIR -B. -DUPDATE_CHECK=ON -DSPELL_CHECK=OFF -DSTRICT_OPTIONS="${STRICT_OPTIONS}"
make -j$(sysctl -n hw.ncpu) make -j$(sysctl -n hw.ncpu)
} }

View File

@ -977,6 +977,7 @@ then
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DSPELL_CHECK=OFF \ -DSPELL_CHECK=OFF \
-DUPDATE_CHECK=ON \ -DUPDATE_CHECK=ON \
-DSTRICT_OPTIONS=ON \
.. ..
elif [[ "$BUILD_TYPE" == "debug" ]] elif [[ "$BUILD_TYPE" == "debug" ]]
then then
@ -984,6 +985,7 @@ then
-DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_BUILD_TYPE=Debug \
-DSPELL_CHECK=OFF \ -DSPELL_CHECK=OFF \
-DUPDATE_CHECK=ON \ -DUPDATE_CHECK=ON \
-DSTRICT_OPTIONS=ON \
.. ..
fi fi