CMakeLists.txt: add compil option KICAD_STDLIB_LIGHT_DEBUG, useful when KICAD_STDLIB_DEBUG cannot be used.

KICAD_STDLIB_DEBUG option generate intrusive tests and asserts, and on Windows, generate crashed not captured by GDB.
KICAD_STDLIB_LIGHT_DEBUG generate less intrusive tests and asserts.
it adds only -Wp,-D_GLIBCXX_ASSERTIONS and that generate less asserts.

Add also the new build options in dialog about.
This commit is contained in:
jean-pierre charras 2019-08-07 14:51:28 +02:00
parent 5aa48e523d
commit 38fc51c3b6
2 changed files with 35 additions and 1 deletions

View File

@ -108,6 +108,7 @@ option( KICAD_SPICE
"Build KiCad with internal Spice simulator."
ON )
# Not supported by all platforms (for instance mingw)
option( KICAD_SANITIZE
"Build KiCad with sanitizer options. WARNING: Not compatible with gold linker"
OFF )
@ -116,6 +117,10 @@ option( KICAD_STDLIB_DEBUG
"Build KiCad with libstdc++ debug flags enabled."
OFF )
option( KICAD_STDLIB_LIGHT_DEBUG
"Build KiCad with libstdc++ with -Wp,-D_GLIBCXX_ASSERTIONS flag enabled. Not as intrusive as KICAD_STDLIB_DEBUG"
OFF )
option( KICAD_BUILD_PARALLEL_CL_MP
"Build in parallel using the /MP compiler option (default OFF for safety reasons)"
OFF )
@ -329,13 +334,20 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
set( CMAKE_C_FLAGS_DEBUG "-g3 -ggdb3 -DDEBUG" )
set( CMAKE_CXX_FLAGS_DEBUG "-g3 -ggdb3 -DDEBUG -Wno-deprecated-declarations" )
endif()
if( KICAD_SANITIZE )
add_definitions( -DKICAD_SANITIZE )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_SANITIZE_VECTOR -fsanitize=address -fno-optimize-sibling-calls -fsanitize-address-use-after-scope -fno-omit-frame-pointer" )
endif()
if( KICAD_STDLIB_DEBUG )
add_definitions( -DKICAD_STDLIB_DEBUG )
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG" )
elseif( KICAD_STDLIB_LIGHT_DEBUG )
# useless if KICAD_STDLIB_DEBUG is ON.
# this option makes some controls to trap out of bound memory access.
add_definitions( -DKICAD_STDLIB_LIGHT_DEBUG )
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wp,-D_GLIBCXX_ASSERTIONS" )
endif()
if( MINGW )

View File

@ -589,6 +589,28 @@ void DIALOG_ABOUT::buildVersionInfoData( wxString& aMsg, bool aFormatHtml )
#else
aMsg << OFF;
#endif
#ifndef NDEBUG
aMsg << indent4 << "KICAD_STDLIB_DEBUG=";
#ifdef KICAD_STDLIB_DEBUG
aMsg << ON;
#else
aMsg << OFF;
aMsg << indent4 << "KICAD_STDLIB_LIGHT_DEBUG=";
#ifdef KICAD_STDLIB_LIGHT_DEBUG
aMsg << ON;
#else
aMsg << OFF;
#endif
#endif
aMsg << indent4 << "KICAD_SANITIZE=";
#ifdef KICAD_SANITIZE
aMsg << ON;
#else
aMsg << OFF;
#endif
#endif
}