Merge pull request #708 from andlaus/do_not_strip_by_default

build system: do not separate the debugging symbols by default
This commit is contained in:
Atgeirr Flø Rasmussen 2015-03-26 12:39:42 +01:00
commit b199d2b61b
6 changed files with 26 additions and 11 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})
# queue this executable to be stripped if (STRIP_DEBUGGING_SYMBOLS)
strip_debug_symbols (${${opm}_TARGET} ${opm}_DEBUG) # queue this executable to be stripped
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})
strip_debug_symbols (${_sat_NAME} _sat_DEBUG) if (STRIP_DEBUGGING_SYMBOLS)
list (APPEND ${satellite}_DEBUG ${_sat_DEBUG}) strip_debug_symbols (${_sat_NAME} _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

@ -18,12 +18,10 @@ if (CXX_COMPAT_GCC)
# default debug level, if not specified by the user # default debug level, if not specified by the user
set_default_option (CXX _dbg_flag "-ggdb3" "(^|\ )-g") set_default_option (CXX _dbg_flag "-ggdb3" "(^|\ )-g")
# add debug symbols to *all* targets, regardless. there WILL come a # add debug symbols to *all* targets if the build mode is either "Debug" or "RelWithDebInfo"
# time when you need to find a bug which only manifests itself in a
# release target on a production system!
if (_dbg_flag) if (_dbg_flag)
message (STATUS "Generating debug symbols: ${_dbg_flag}") message (STATUS "Generating debug symbols: ${_dbg_flag}")
add_options (ALL_LANGUAGES ALL_BUILDS "${_dbg_flag}") add_options (ALL_LANGUAGES "Debug;RelWithDebInfo" "${_dbg_flag}")
endif (_dbg_flag) endif (_dbg_flag)
# extracting the debug info is done by a separate utility in the GNU # extracting the debug info is done by a separate utility in the GNU

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}"

2
debian/rules vendored
View File

@ -20,7 +20,7 @@ override_dh_auto_build:
# consider using -DUSE_VERSIONED_DIR=ON if backporting # consider using -DUSE_VERSIONED_DIR=ON if backporting
override_dh_auto_configure: override_dh_auto_configure:
dh_auto_configure --buildsystem=cmake -- -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_DOCDIR=share/doc/libopm-core1 -DWHOLE_PROG_OPTIM=ON -DUSE_RUNPATH=OFF dh_auto_configure --buildsystem=cmake -- -DCMAKE_BUILD_TYPE=RelWithDebInfo -DSTRIP_DEBUGGING_SYMBOLS=ON -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_DOCDIR=share/doc/libopm-core1 -DWHOLE_PROG_OPTIM=ON -DUSE_RUNPATH=OFF
override_dh_auto_install: override_dh_auto_install:
dh_auto_install -- install-html dh_auto_install -- install-html

View File

@ -81,7 +81,7 @@ This package contains the debug symbols for opm-core
# consider using -DUSE_VERSIONED_DIR=ON if backporting # consider using -DUSE_VERSIONED_DIR=ON if backporting
%build %build
cmake28 -DBUILD_SHARED_LIBS=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%{_prefix} -DCMAKE_INSTALL_DOCDIR=share/doc/%{name}-%{version} -DUSE_RUNPATH=OFF %{?el5:-DCMAKE_CXX_COMPILER=g++44 -DCMAKE_C_COMPILER=gcc44 -DBOOST_LIBRARYDIR=%{_libdir}/boost141 -DBOOST_INCLUDEDIR=/usr/include/boost141} cmake28 -DBUILD_SHARED_LIBS=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DSTRIP_DEBUGGING_SYMBOLS=ON -DCMAKE_INSTALL_PREFIX=%{_prefix} -DCMAKE_INSTALL_DOCDIR=share/doc/%{name}-%{version} -DUSE_RUNPATH=OFF %{?el5:-DCMAKE_CXX_COMPILER=g++44 -DCMAKE_C_COMPILER=gcc44 -DBOOST_LIBRARYDIR=%{_libdir}/boost141 -DBOOST_INCLUDEDIR=/usr/include/boost141}
make make
%install %install