widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #11753
[Merge] lp:~widelands-dev/widelands/fix_asan_building into lp:widelands
SirVer has proposed merging lp:~widelands-dev/widelands/fix_asan_building into lp:widelands.
Commit message:
Truly only include ASAN by default in debug builds.
Related to https://bugs.launchpad.net/widelands/+bug/1734843, but does not address the fundamental problem of compile.sh.
Requested reviews:
Widelands Developers (widelands-dev)
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/fix_asan_building/+merge/334364
--
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/fix_asan_building into lp:widelands.
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2017-11-24 14:41:28 +0000
+++ CMakeLists.txt 2017-11-28 09:57:14 +0000
@@ -8,7 +8,6 @@
option(OPTION_GLEW_STATIC "Use static GLEW Library" OFF)
option(OPTION_BUILD_WEBSITE_TOOLS "Build website-related tools" ON)
option(OPTION_BUILD_TRANSLATIONS "Build translations" ON)
-option(OPTION_ASAN "Build with AddressSanitizer" ON)
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
message(FATAL_ERROR "Build directory and source directory must not be the same.")
@@ -38,10 +37,6 @@
message(WARNING "You are using an unsupported compiler! Supported are Clang and GCC.")
endif()
-if(OPTION_ASAN)
- message(STATUS "Using AddressSanitizer http://clang.llvm.org/docs/AddressSanitizer.html")
-endif(OPTION_ASAN)
-
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
if (WIN32)
@@ -98,6 +93,7 @@
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(WL_DEBUG_FLAGS "-g -DDEBUG")
+ option(OPTION_ASAN "Build with AddressSanitizer" ON)
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.2))
message(STATUS "GCC >6.2.0 breaks -03, setting -02")
@@ -106,6 +102,7 @@
set(WL_OPTIMIZE_FLAGS "-O3")
endif ()
set(WL_DEBUG_FLAGS "-DNDEBUG -DNOPARACHUTE")
+ option(OPTION_ASAN "Build with AddressSanitizer" OFF)
elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.2))
message(STATUS "GCC >6.2.0 breaks -03, setting -02")
@@ -114,6 +111,7 @@
set(WL_OPTIMIZE_FLAGS "-O3")
endif ()
set(WL_DEBUG_FLAGS "-DNDEBUG -DNOPARACHUTE")
+ option(OPTION_ASAN "Build with AddressSanitizer" ON)
else()
message(FATAL_ERROR "Unknown CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
endif()
@@ -121,10 +119,13 @@
wl_add_flag(WL_GENERIC_CXX_FLAGS "-std=c++11")
if(OPTION_ASAN)
+ message(STATUS "Using AddressSanitizer http://clang.llvm.org/docs/AddressSanitizer.html")
# See http://clang.llvm.org/docs/AddressSanitizer.html
wl_add_flag(WL_COMPILE_DIAGNOSTICS "-fsanitize=address")
wl_add_flag(WL_COMPILE_DIAGNOSTICS "-fno-omit-frame-pointer")
set (CMAKE_EXE_LINKER_FLAGS "-fsanitize=address" CACHE STRING "Set by widelands CMakeLists.txt" FORCE)
+else()
+ message(STATUS "Not using AddressSanitizer.")
endif(OPTION_ASAN)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
=== modified file 'compile.sh'
--- compile.sh 2017-11-24 21:21:35 +0000
+++ compile.sh 2017-11-28 09:57:14 +0000
@@ -71,7 +71,7 @@
-## Option to avoid building and linking website-related executables.
+## Options to control the build.
BUILD_WEBSITE="ON"
BUILD_TRANSLATIONS="ON"
BUILD_TYPE="Debug"
Follow ups