1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

cmake: disable warning as error on default release builds

A new warning introduced by the compiler on a target system should not
break the build on that target.
You can override that behaviour using VILLAS_COMPILE_WARNING_AS_ERROR.

Signed-off-by: Philipp Jungkamp <Philipp.Jungkamp@opal-rt.com>
This commit is contained in:
Philipp Jungkamp 2023-06-22 11:17:53 +02:00
parent cd5a99df67
commit 4224f72ecb
5 changed files with 28 additions and 5 deletions

View file

@ -7,7 +7,8 @@ variables:
DOCKER_IMAGE: registry.git.rwth-aachen.de/acs/public/villas/node
DOCKER_IMAGE_DEV: ${DOCKER_IMAGE}/dev-${DISTRO}
DOCKER_CLI_EXPERIMENTAL: enabled
CMAKE_BUILD_OPTS: "--config Release --parallel 16"
CMAKE_BUILD_OPTS: "--parallel 16"
CMAKE_EXTRA_OPTS: "-DCMAKE_BUILD_TYPE=Release -DVILLAS_COMPILE_WARNING_AS_ERROR=ON"
stages:
- prepare
@ -64,7 +65,8 @@ build:source:
matrix:
- DISTRO: [ fedora, fedora-minimal, debian, rocky, ubuntu ]
- DISTRO: fedora-minimal
CMAKE_EXTRA_OPTS: -DWITH_API=OFF
CMAKE_EXTRA_OPTS: -DVILLAS_COMPILE_WARNING_AS_ERROR=ON
-DWITH_API=OFF
-DWITH_CLIENTS=OFF
-DWITH_CONFIG=OFF
-DWITH_DOC=OFF
@ -183,7 +185,7 @@ pkg:docker:
--target ${TARGET}
--build-arg ARCH=${ARCH}
--build-arg TRIPLET=${TRIPLET}
--build-arg CMAKE_OPTS="${CMAKE_OPTS}"
--build-arg CMAKE_OPTS="${CMAKE_OPTS} ${CMAKE_EXTRA_OPTS}"
--platform ${PLATFORM}
--file ${DOCKER_FILE}
--tag ${DOCKER_IMAGE}:${DOCKER_TAG}-${ARCH} .

View file

@ -54,7 +54,7 @@ include(FindSymbol)
include(CMakeDependentOption)
add_definitions(-D_POSIX_C_SOURCE=200809L -D_GNU_SOURCE)
add_compile_options(-Wall -Wno-unknown-pragmas -Werror -fdiagnostics-color=auto)
add_compile_options(-Wall -Wno-unknown-pragmas -fdiagnostics-color=auto)
# Check OS
check_include_file("sys/eventfd.h" HAS_EVENTFD)
@ -213,12 +213,27 @@ cmake_dependent_option(WITH_NODE_WEBRTC "Build with webrtc node-type"
cmake_dependent_option(WITH_NODE_WEBSOCKET "Build with websocket node-type" ON "WITH_WEB; LIBWEBSOCKETS_FOUND" OFF)
cmake_dependent_option(WITH_NODE_ZEROMQ "Build with zeromq node-type" ON "LIBZMQ_FOUND;NOT WITHOUT_GPL" OFF)
# set a default for the build type
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
set(CMAKE_BUILD_TYPE "Debug")
endif()
# Add more build configurations
include(cmake/config/Debug.cmake)
include(cmake/config/Release.cmake)
include(cmake/config/Coverage.cmake)
include(cmake/config/Profiling.cmake)
if(NOT DEFINED VILLAS_COMPILE_WARNING_AS_ERROR)
set(VILLAS_COMPILE_WARNING_AS_ERROR ON)
endif()
if(VILLAS_COMPILE_WARNING_AS_ERROR)
add_compile_options(-Werror)
else()
add_compile_options(-Wno-error)
endif()
# Get version info and buildid from Git
GetVersion(${PROJECT_SOURCE_DIR} "CMAKE_PROJECT")

View file

@ -4,3 +4,8 @@
# @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
# @license Apache 2.0
###################################################################################
# don't treat warnings as errors on normal release builds
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release" AND NOT DEFINED VILLAS_COMPILE_WARNING_AS_ERROR)
set(VILLAS_COMPILE_WARNING_AS_ERROR OFF)
endif()

View file

@ -69,6 +69,7 @@ ADD cmake/toolchains/debian-${ARCH}.cmake /
ENV PKG_CONFIG_PATH=/usr/lib/${TRIPLET}/pkgconfig:/usr/local/lib/${TRIPLET}/pkgconfig
ENV CMAKE_EXTRA_OPTS="-DCMAKE_TOOLCHAIN_FILE=/debian-${ARCH}.cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH=${PREFIX} \
-DCMAKE_INSTALL_PREFIX=${PREFIX} \
-DCMAKE_INSTALL_LIBDIR=${PREFIX}/lib/${TRIPLET} \

View file

@ -131,7 +131,7 @@
pkgs = pkgsFor system;
shellHook = ''[ -z "$PS1" ] || exec "$SHELL"'';
hardeningDisable = ["all"];
packages = with pkgs; [criterion];
packages = with pkgs; [bashInteractive criterion];
in rec {
default = full;