Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #6640 Option to disable warnings as error #6737

Merged
merged 2 commits into from
May 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ usage()
echo "[-dbg] Build debug library only (default)"
echo "[-opt] Build optimized library only (default)"
echo "[-edge] Build edge of x64. Turns off opt and dbg"
echo "[-disable-werror] Disable compilation with warnings as error"
echo "[-nocmake] Skip CMake call"
echo "[-noctest] Skip unit tests"
echo "[-with-static-boost <boost> Build binaries using static linking of boost from specified boost install"
Expand Down Expand Up @@ -89,6 +90,7 @@ noctest=0
static_boost=""
ertbsp=""
ertfw=""
werror=1
cmake_flags="-DCMAKE_EXPORT_COMPILE_COMMANDS=ON"

while [ $# -gt 0 ]; do
Expand Down Expand Up @@ -134,6 +136,10 @@ while [ $# -gt 0 ]; do
noctest=1
shift
;;
-disable-werror|--disable-werror)
werror=0
shift
;;
-j)
shift
jcore=$1
Expand Down Expand Up @@ -196,6 +202,11 @@ debug_dir=${DEBUG_DIR:-Debug}
release_dir=${REL_DIR:-Release}
edge_dir=${EDGE_DIR:-Edge}

# By default compile with warnings as errors.
# Update every time CMake is generating makefiles.
# Disable with '-disable-werror' option.
cmake_flags+=" -DXRT_ENABLE_WERROR=$werror"

here=$PWD
cd $BUILDDIR

Expand Down
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ endif()

if ( ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" )
set(XRT_WARN_OPTS
-Wall -Werror
-Wall
-Wno-mismatched-tags
-Wno-unused-const-variable
-Wno-unused-private-field
Expand All @@ -45,7 +45,7 @@ if ( ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" )
-Wno-overloaded-virtual
)
else()
set(XRT_WARN_OPTS -Wall -Werror )
set(XRT_WARN_OPTS -Wall)
endif()

if (DEFINED ENV{XRT_NATIVE_BUILD})
Expand Down
5 changes: 4 additions & 1 deletion src/runtime_src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ endif()

add_compile_options("-fPIC")

# TODO CL_TARGET_OPENCL_VERSION is not defined..
if (XRT_ENABLE_WERROR)
list(APPEND XRT_WARN_OPTS "-Werror")
endif(XRT_ENABLE_WERROR)

if (${XRT_NATIVE_BUILD} STREQUAL "yes")
add_compile_options( ${XRT_WARN_OPTS} )
endif()
Expand Down