build system: do not separate the debugging symbols by default

the reason is that the tools for profiling and for coverage analysis
(i.e., gprof and gcov) have trouble with this and crash. if you want
this to be enabled for whatever reason, use the cmake flag
-DSTRIP_DEBUGGING_SYMBOLS=ON or pass configure the
--enable-strip-debug option.
This commit is contained in:
Andreas Lauser 2014-12-16 13:33:04 +01:00
parent 0fc5e7a3bc
commit 6c0088919a
3 changed files with 22 additions and 5 deletions

View File

@ -1,5 +1,7 @@
# - Compile main library target # - Compile main library target
option (STRIP_DEBUGGING_SYMBOLS "use separate files for the executable code and the debugging symbols" OFF)
macro (opm_compile opm) macro (opm_compile opm)
# some CMake properties do not do list expansion # some CMake properties do not do list expansion
string (REPLACE ";" " " ${opm}_LINKER_FLAGS_STR "${${opm}_LINKER_FLAGS}") string (REPLACE ";" " " ${opm}_LINKER_FLAGS_STR "${${opm}_LINKER_FLAGS}")
@ -28,8 +30,10 @@ macro (opm_compile opm)
) )
target_link_libraries (${${opm}_TARGET} ${${opm}_LIBRARIES}) target_link_libraries (${${opm}_TARGET} ${${opm}_LIBRARIES})
if (STRIP_DEBUGGING_SYMBOLS)
# queue this executable to be stripped # queue this executable to be stripped
strip_debug_symbols (${${opm}_TARGET} ${opm}_DEBUG) strip_debug_symbols (${${opm}_TARGET} ${opm}_DEBUG)
endif()
else (${opm}_SOURCES) else (${opm}_SOURCES)
# unset this variable to signal that no library is generated # unset this variable to signal that no library is generated
set (${opm}_TARGET) set (${opm}_TARGET)

View File

@ -70,8 +70,10 @@ macro (opm_compile_satellites opm satellite excl_all test_regexp)
set (_test_lib "") set (_test_lib "")
endif (NOT "${test_regexp}" STREQUAL "") endif (NOT "${test_regexp}" STREQUAL "")
target_link_libraries (${_sat_NAME} ${${opm}_TARGET} ${${opm}_LIBRARIES} ${_test_lib}) target_link_libraries (${_sat_NAME} ${${opm}_TARGET} ${${opm}_LIBRARIES} ${_test_lib})
if (STRIP_DEBUGGING_SYMBOLS)
strip_debug_symbols (${_sat_NAME} _sat_DEBUG) strip_debug_symbols (${_sat_NAME} _sat_DEBUG)
list (APPEND ${satellite}_DEBUG ${_sat_DEBUG}) list (APPEND ${satellite}_DEBUG ${_sat_DEBUG})
endif()
# variable with regular expression doubles as a flag for # variable with regular expression doubles as a flag for
# whether tests should be setup or not # whether tests should be setup or not

View File

@ -21,6 +21,7 @@ Optional Features:
[default=no] [default=no]
--disable-runpath do not use RUNPATH in installed library [default=yes] --disable-runpath do not use RUNPATH in installed library [default=yes]
--enable-lto use whole program optimization [default=no] --enable-lto use whole program optimization [default=no]
--enable-strip-debug separate the executable code and the debugging symbols [default=no]
--disable-tests do not compile and enable unit tests [default=yes] --disable-tests do not compile and enable unit tests [default=yes]
--disable-examples do not compile example programs [default=yes] --disable-examples do not compile example programs [default=yes]
--disable-pch do not use precompiled headers (if buggy compiler) --disable-pch do not use precompiled headers (if buggy compiler)
@ -123,6 +124,8 @@ silent_rules=
debug_loc= debug_loc=
#use_lto=" -DWHOLE_PROG_OPTIM=OFF" #use_lto=" -DWHOLE_PROG_OPTIM=OFF"
use_lto= use_lto=
#strip_debug=" -DSTRIP_DEBUGGING_SYMBOLS=OFF"
strip_debug=
#use_runpath=" -DUSE_RUNPATH=OFF" #use_runpath=" -DUSE_RUNPATH=OFF"
use_runpath= use_runpath=
#use_tests=" -DBUILD_TESTING=ON" #use_tests=" -DBUILD_TESTING=ON"
@ -314,6 +317,10 @@ for OPT in "$@"; do
use_lto=" -DWHOLE_PROG_OPTIM=OFF" use_lto=" -DWHOLE_PROG_OPTIM=OFF"
pkgname="" pkgname=""
;; ;;
strip-debug )
strip_debug=" -DSTRIP_DEBUGGING_SYMBOLS=OFF"
pkgname=""
;;
openmp) openmp)
use_openmp=" -DUSE_OPENMP=OFF" use_openmp=" -DUSE_OPENMP=OFF"
pkgname="" pkgname=""
@ -397,6 +404,10 @@ for OPT in "$@"; do
use_lto=" -DWHOLE_PROG_OPTIM=ON" use_lto=" -DWHOLE_PROG_OPTIM=ON"
shared="" shared=""
;; ;;
strip-debug )
strip_debug=" -DSTRIP_DEBUGGING_SYMBOLS=ON"
pkgname=""
;;
tests) tests)
use_tests=" -DBUILD_TESTING=ON" use_tests=" -DBUILD_TESTING=ON"
pkgname="" pkgname=""
@ -534,7 +545,7 @@ elif test "$c_compiler$c_opts$cxx_compiler$cxx_opts$fort_compiler$fort_opts" !=
fi fi
# pass everything on to CMake # pass everything on to CMake
CMDLINE="${ENVVARS}${CMAKE_COMMAND} \"${srcdir}\" ${use_ninja}\"-DCMAKE_INSTALL_PREFIX=$prefix\"${buildtype}${pch_use}${silent_rules}${debug_loc}${use_openmp}${use_mpi}${use_lto}${use_runpath}${use_tests}${use_samples}${use_underscoring}${c_compiler}${c_opts}${cxx_compiler}${cxx_opts}${fort_compiler}${fort_opts}${boost_opts}${buildname}${site} ${FEATURES}" CMDLINE="${ENVVARS}${CMAKE_COMMAND} \"${srcdir}\" ${use_ninja}\"-DCMAKE_INSTALL_PREFIX=$prefix\"${buildtype}${pch_use}${silent_rules}${debug_loc}${use_openmp}${use_mpi}${use_lto}${strip_debug}${use_runpath}${use_tests}${use_samples}${use_underscoring}${c_compiler}${c_opts}${cxx_compiler}${cxx_opts}${fort_compiler}${fort_opts}${boost_opts}${buildname}${site} ${FEATURES}"
echo --- calling CMake --- echo --- calling CMake ---
echo "${CMDLINE}" echo "${CMDLINE}"
eval exec "${CMDLINE}" eval exec "${CMDLINE}"