mirror of
https://github.com/apache/arrow.git
synced 2026-10-28 16:47:19 +08:00
ARROW-4336: Change the default BUILD_WARNING_LEVEL to CHECKIN
The goal of this change is to minimize the time waiting at CI for any warning errors. The default was PRODUCTION. This also does a minor cleanup of some C++ files such that compilation succeeds in EVERYTHING compile mode.
This commit is contained in:
1 parent
442ced05fd
commit
ccaf9dd74c
1 file changed
+27
-16
@@ -38,6 +38,12 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
# shared libraries
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
# if no build build type is specified, default to debug builds
|
||||
if (NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Debug)
|
||||
endif(NOT CMAKE_BUILD_TYPE)
|
||||
string (TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE)
|
||||
|
||||
# compiler flags that are common across debug/release builds
|
||||
if (WIN32)
|
||||
# TODO(wesm): Change usages of C runtime functions that MSVC says are
|
||||
@@ -71,10 +77,10 @@ if (WIN32)
|
||||
|
||||
if (ARROW_USE_STATIC_CRT)
|
||||
foreach (c_flag CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG
|
||||
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_C_FLAGS CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_DEBUG
|
||||
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
|
||||
string(REPLACE "/MD" "-MT" ${c_flag} "${${c_flag}}")
|
||||
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_C_FLAGS CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_DEBUG
|
||||
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
|
||||
string(REPLACE "/MD" "-MT" ${c_flag} "${${c_flag}}")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
@@ -86,16 +92,26 @@ else()
|
||||
set(CXX_COMMON_FLAGS "")
|
||||
endif()
|
||||
|
||||
# Build warning level (CHECKIN, EVERYTHING, etc.)
|
||||
# BUILD_WARNING_LEVEL add warning/error compiler flags. The possible values are
|
||||
# - RELEASE: `-Werror` is not provide, thus warning do not halt the build.
|
||||
# - CHECKIN: Imply `-Werror -Wall` and some other warnings.
|
||||
# - EVERYTHING: Like `CHECKIN`, but possible extra flags depending on the
|
||||
# compiler, including `-Wextra`, `-Weverything`, `-pedantic`.
|
||||
# This is the most aggressive warning level.
|
||||
|
||||
# if no build warning level is specified, default to development warning level
|
||||
# Defaults BUILD_WARNING_LEVEL to `CHECKIN`, unless CMAKE_BUILD_TYPE is
|
||||
# `RELEASE`, then it will default to `PRODUCTION`. The goal of defaulting to
|
||||
# `CHECKIN` is to avoid friction with long response time from CI.
|
||||
if (NOT BUILD_WARNING_LEVEL)
|
||||
set(BUILD_WARNING_LEVEL Production)
|
||||
if ("{CMAKE_BUILD_TYPE}" STREQUAL "RELEASE")
|
||||
set(BUILD_WARNING_LEVEL PRODUCTION)
|
||||
else()
|
||||
set(BUILD_WARNING_LEVEL CHECKIN)
|
||||
endif("{CMAKE_BUILD_TYPE}" STREQUAL "RELEASE")
|
||||
endif(NOT BUILD_WARNING_LEVEL)
|
||||
string(TOUPPER ${BUILD_WARNING_LEVEL} BUILD_WARNING_LEVEL)
|
||||
|
||||
string(TOUPPER ${BUILD_WARNING_LEVEL} UPPERCASE_BUILD_WARNING_LEVEL)
|
||||
|
||||
if ("${UPPERCASE_BUILD_WARNING_LEVEL}" STREQUAL "CHECKIN")
|
||||
if ("${BUILD_WARNING_LEVEL}" STREQUAL "CHECKIN")
|
||||
# Pre-checkin builds
|
||||
if ("${COMPILER_FAMILY}" STREQUAL "msvc")
|
||||
string(REPLACE "/W3" "" CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS}")
|
||||
@@ -144,7 +160,7 @@ if ("${UPPERCASE_BUILD_WARNING_LEVEL}" STREQUAL "CHECKIN")
|
||||
else()
|
||||
message(FATAL_ERROR "Unknown compiler. Version info:\n${COMPILER_VERSION_FULL}")
|
||||
endif()
|
||||
elseif ("${UPPERCASE_BUILD_WARNING_LEVEL}" STREQUAL "EVERYTHING")
|
||||
elseif ("${BUILD_WARNING_LEVEL}" STREQUAL "EVERYTHING")
|
||||
# Pedantic builds for fixing warnings
|
||||
if ("${COMPILER_FAMILY}" STREQUAL "msvc")
|
||||
string(REPLACE "/W3" "" CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS}")
|
||||
@@ -361,12 +377,7 @@ set(C_FLAGS_PROFILE_BUILD "${CXX_FLAGS_RELEASE} -fprofile-use")
|
||||
set(CXX_FLAGS_PROFILE_GEN "${CXX_FLAGS_RELEASE} -fprofile-generate")
|
||||
set(CXX_FLAGS_PROFILE_BUILD "${CXX_FLAGS_RELEASE} -fprofile-use")
|
||||
|
||||
# if no build build type is specified, default to debug builds
|
||||
if (NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Debug)
|
||||
endif(NOT CMAKE_BUILD_TYPE)
|
||||
|
||||
string (TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE)
|
||||
|
||||
# Set compile flags based on the build type.
|
||||
message("Configured for ${CMAKE_BUILD_TYPE} build (set with cmake -DCMAKE_BUILD_TYPE={release,debug,...})")
|
||||
|
||||
Reference in new issue
Block a user