diff --git a/CMakeLists.txt b/CMakeLists.txt index 09bf1b2a6f505e32fa1025ae3edd86864fd403c8..1d4c8677f28d38da07c8010539f66de211e38f02 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,6 @@ set(WITH_CUDA_ARCH "auto" CACHE STRING "Build for these CUDA architectures") option(WITH_OPENMP "Build with OpenMP support" ON) option(WITH_MPI "Build with MPI support" ON) option(WITH_GMP "Build with GMP support" OFF) -option(WITH_PROFILING "Enable code profiling compiler flags" OFF ) option(WITH_COVERAGE "Enable code coverage reports from unit tests" OFF) option(BUILD_BENCHMARKS "Compile the 'src/Benchmarks' directory" OFF) option(BUILD_EXAMPLES "Compile the 'src/Examples' directory" OFF) @@ -76,6 +75,7 @@ set( CMAKE_CXX_EXTENSIONS OFF ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -Wall" ) set( CMAKE_CXX_FLAGS_DEBUG "-g" ) set( CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" ) +set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_DEBUG}" ) # pass -rdynamic only in Debug mode set( CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "" ) set( CMAKE_SHARED_LIBRARY_LINK_C_FLAGS_DEBUG "-rdynamic" ) @@ -211,6 +211,9 @@ if( ${WITH_CUDA} ) endif() endif() set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ; -DHAVE_CUDA --expt-relaxed-constexpr --expt-extended-lambda --default-stream per-thread) + if( CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo" ) + set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ; --generate-line-info) + endif() # disable false compiler warnings # reference for the -Xcudafe --diag_suppress and --display_error_number flags: https://stackoverflow.com/a/54142937 # incomplete list of tokens: http://www.ssl.berkeley.edu/~jimm/grizzly_docs/SSL/opt/intel/cc/9.0/lib/locale/en_US/mcpcom.msg @@ -241,11 +244,6 @@ if( ${WITH_CUDA} ) endif() -if( ${WITH_PROFILING} ) - set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g" ) - set( CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --generate-line-info") -endif() - find_package( DCMTK ) if( DCMTK_FOUND ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAVE_DCMTK_H" ) @@ -373,7 +371,6 @@ message( " WITH_CUDA_ARCH = ${WITH_CUDA_ARCH}" ) message( " WITH_OPENMP = ${WITH_OPENMP}" ) message( " WITH_MPI = ${WITH_MPI}" ) message( " WITH_GMP = ${WITH_GMP}" ) -message( " WITH_PROFILING = ${WITH_PROFILING}" ) message( " WITH_COVERAGE = ${WITH_COVERAGE}" ) message( " BUILD_BENCHMARKS = ${BUILD_BENCHMARKS}" ) message( " BUILD_EXAMPLES = ${BUILD_EXAMPLES}" ) diff --git a/build b/build index 3a15ac51076d96ef07da853bdd87f0c26da57819..3e7f11c58ed28bd96b521d849646d633912abc5e 100755 --- a/build +++ b/build @@ -6,7 +6,7 @@ set -e # get the root directory (i.e. the directory where this script is located) ROOT_DIR="$( builtin cd -P "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -BUILD="" +BUILD="Release" BUILD_JOBS="" VERBOSE="" OFFLINE_BUILD="no" @@ -27,7 +27,6 @@ WITH_CI_FLAGS="no" # flags affecting only tests RUN_TESTS="yes" # whether to run tests if they were compiled (coverage script sets it to no) TESTS_JOBS="4" -WITH_PROFILING="no" WITH_COVERAGE="no" # targets @@ -79,7 +78,6 @@ Options affecting all targets: --with-cuda-arch=all/auto/3.0/3.5/... Chooses CUDA architecture. '$WITH_CUDA_ARCH' by default. --with-openmp=yes/no Enables OpenMP. '$WITH_OPENMP' by default. --with-gmp=yes/no Enables the wrapper for GNU Multiple Precision Arithmetic Library. '$WITH_GMP' by default. - --with-profiling=yes/no Enables code profiling compiler flags. '$WITH_PROFILING' by default. Options for the 'tests' and 'matrix-tests' targets: --run-tests=yes/no Runs unit tests if they were compiled. '$RUN_TESTS' by default. @@ -104,6 +102,7 @@ for option in "$@"; do --verbose ) VERBOSE="VERBOSE=1" ;; --offline-build ) OFFLINE_BUILD="yes" ;; --install=* ) INSTALL="${option#*=}" ;; + --install ) INSTALL="yes" ;; --prefix=* ) PREFIX="${option#*=}" ;; --cmake=* ) CMAKE="${option#*=}" ;; --cmake-only=* ) CMAKE_ONLY="${option#*=}" ;; @@ -116,7 +115,6 @@ for option in "$@"; do --with-gmp=* ) WITH_GMP="${option#*=}" ;; --run-tests=* ) RUN_TESTS="${option#*=}" ;; --tests-jobs=* ) TESTS_JOBS="${option#*=}" ;; - --with-profiling=* ) WITH_PROFILING="${option#*=}" ;; --with-coverage=* ) WITH_COVERAGE="${option#*=}" ;; --with-ci-flags=* ) WITH_CI_FLAGS="${option#*=}" ;; -* ) @@ -128,6 +126,12 @@ for option in "$@"; do shift done +# check the build type +if [[ ! "Release Debug RelWithDebInfo" =~ "$BUILD" ]]; then + echo "Unknown build type: $BUILD. The available build types are: Release, Debug, RelWithDebInfo." >&2 + exit 1 +fi + # handle targets for target in "$@"; do case "$target" in @@ -199,7 +203,6 @@ cmake_command=( -DWITH_OPENMP=${WITH_OPENMP} -DWITH_MPI=${WITH_MPI} -DWITH_GMP=${WITH_GMP} - -DWITH_PROFILING=${WITH_PROFILING} -DWITH_COVERAGE=${WITH_COVERAGE} -DWITH_CI_FLAGS=${WITH_CI_FLAGS} -DBUILD_BENCHMARKS=${BUILD_BENCHMARKS}