Skip to content
Snippets Groups Projects
Commit 596a2e70 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

build script: removed --with-profiling, --build=RelWithDebInfo can be used instead

parent 446b988d
No related branches found
No related tags found
1 merge request!88build script refactoring
...@@ -23,7 +23,6 @@ set(WITH_CUDA_ARCH "auto" CACHE STRING "Build for these CUDA architectures") ...@@ -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_OPENMP "Build with OpenMP support" ON)
option(WITH_MPI "Build with MPI support" ON) option(WITH_MPI "Build with MPI support" ON)
option(WITH_GMP "Build with GMP support" OFF) 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(WITH_COVERAGE "Enable code coverage reports from unit tests" OFF)
option(BUILD_BENCHMARKS "Compile the 'src/Benchmarks' directory" OFF) option(BUILD_BENCHMARKS "Compile the 'src/Benchmarks' directory" OFF)
option(BUILD_EXAMPLES "Compile the 'src/Examples' directory" OFF) option(BUILD_EXAMPLES "Compile the 'src/Examples' directory" OFF)
...@@ -76,6 +75,7 @@ set( CMAKE_CXX_EXTENSIONS OFF ) ...@@ -76,6 +75,7 @@ set( CMAKE_CXX_EXTENSIONS OFF )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -Wall" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -Wall" )
set( CMAKE_CXX_FLAGS_DEBUG "-g" ) set( CMAKE_CXX_FLAGS_DEBUG "-g" )
set( CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" ) 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 # pass -rdynamic only in Debug mode
set( CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "" ) set( CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "" )
set( CMAKE_SHARED_LIBRARY_LINK_C_FLAGS_DEBUG "-rdynamic" ) set( CMAKE_SHARED_LIBRARY_LINK_C_FLAGS_DEBUG "-rdynamic" )
...@@ -211,6 +211,9 @@ if( ${WITH_CUDA} ) ...@@ -211,6 +211,9 @@ if( ${WITH_CUDA} )
endif() endif()
endif() endif()
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ; -DHAVE_CUDA --expt-relaxed-constexpr --expt-extended-lambda --default-stream per-thread) 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 # disable false compiler warnings
# reference for the -Xcudafe --diag_suppress and --display_error_number flags: https://stackoverflow.com/a/54142937 # 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 # 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} ) ...@@ -241,11 +244,6 @@ if( ${WITH_CUDA} )
endif() 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 ) find_package( DCMTK )
if( DCMTK_FOUND ) if( DCMTK_FOUND )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAVE_DCMTK_H" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAVE_DCMTK_H" )
...@@ -373,7 +371,6 @@ message( " WITH_CUDA_ARCH = ${WITH_CUDA_ARCH}" ) ...@@ -373,7 +371,6 @@ message( " WITH_CUDA_ARCH = ${WITH_CUDA_ARCH}" )
message( " WITH_OPENMP = ${WITH_OPENMP}" ) message( " WITH_OPENMP = ${WITH_OPENMP}" )
message( " WITH_MPI = ${WITH_MPI}" ) message( " WITH_MPI = ${WITH_MPI}" )
message( " WITH_GMP = ${WITH_GMP}" ) message( " WITH_GMP = ${WITH_GMP}" )
message( " WITH_PROFILING = ${WITH_PROFILING}" )
message( " WITH_COVERAGE = ${WITH_COVERAGE}" ) message( " WITH_COVERAGE = ${WITH_COVERAGE}" )
message( " BUILD_BENCHMARKS = ${BUILD_BENCHMARKS}" ) message( " BUILD_BENCHMARKS = ${BUILD_BENCHMARKS}" )
message( " BUILD_EXAMPLES = ${BUILD_EXAMPLES}" ) message( " BUILD_EXAMPLES = ${BUILD_EXAMPLES}" )
......
...@@ -6,7 +6,7 @@ set -e ...@@ -6,7 +6,7 @@ set -e
# get the root directory (i.e. the directory where this script is located) # 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 )" ROOT_DIR="$( builtin cd -P "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
BUILD="" BUILD="Release"
BUILD_JOBS="" BUILD_JOBS=""
VERBOSE="" VERBOSE=""
OFFLINE_BUILD="no" OFFLINE_BUILD="no"
...@@ -27,7 +27,6 @@ WITH_CI_FLAGS="no" ...@@ -27,7 +27,6 @@ WITH_CI_FLAGS="no"
# flags affecting only tests # flags affecting only tests
RUN_TESTS="yes" # whether to run tests if they were compiled (coverage script sets it to no) RUN_TESTS="yes" # whether to run tests if they were compiled (coverage script sets it to no)
TESTS_JOBS="4" TESTS_JOBS="4"
WITH_PROFILING="no"
WITH_COVERAGE="no" WITH_COVERAGE="no"
# targets # targets
...@@ -79,7 +78,6 @@ Options affecting all 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-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-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-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: Options for the 'tests' and 'matrix-tests' targets:
--run-tests=yes/no Runs unit tests if they were compiled. '$RUN_TESTS' by default. --run-tests=yes/no Runs unit tests if they were compiled. '$RUN_TESTS' by default.
...@@ -104,6 +102,7 @@ for option in "$@"; do ...@@ -104,6 +102,7 @@ for option in "$@"; do
--verbose ) VERBOSE="VERBOSE=1" ;; --verbose ) VERBOSE="VERBOSE=1" ;;
--offline-build ) OFFLINE_BUILD="yes" ;; --offline-build ) OFFLINE_BUILD="yes" ;;
--install=* ) INSTALL="${option#*=}" ;; --install=* ) INSTALL="${option#*=}" ;;
--install ) INSTALL="yes" ;;
--prefix=* ) PREFIX="${option#*=}" ;; --prefix=* ) PREFIX="${option#*=}" ;;
--cmake=* ) CMAKE="${option#*=}" ;; --cmake=* ) CMAKE="${option#*=}" ;;
--cmake-only=* ) CMAKE_ONLY="${option#*=}" ;; --cmake-only=* ) CMAKE_ONLY="${option#*=}" ;;
...@@ -116,7 +115,6 @@ for option in "$@"; do ...@@ -116,7 +115,6 @@ for option in "$@"; do
--with-gmp=* ) WITH_GMP="${option#*=}" ;; --with-gmp=* ) WITH_GMP="${option#*=}" ;;
--run-tests=* ) RUN_TESTS="${option#*=}" ;; --run-tests=* ) RUN_TESTS="${option#*=}" ;;
--tests-jobs=* ) TESTS_JOBS="${option#*=}" ;; --tests-jobs=* ) TESTS_JOBS="${option#*=}" ;;
--with-profiling=* ) WITH_PROFILING="${option#*=}" ;;
--with-coverage=* ) WITH_COVERAGE="${option#*=}" ;; --with-coverage=* ) WITH_COVERAGE="${option#*=}" ;;
--with-ci-flags=* ) WITH_CI_FLAGS="${option#*=}" ;; --with-ci-flags=* ) WITH_CI_FLAGS="${option#*=}" ;;
-* ) -* )
...@@ -128,6 +126,12 @@ for option in "$@"; do ...@@ -128,6 +126,12 @@ for option in "$@"; do
shift shift
done 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 # handle targets
for target in "$@"; do for target in "$@"; do
case "$target" in case "$target" in
...@@ -199,7 +203,6 @@ cmake_command=( ...@@ -199,7 +203,6 @@ cmake_command=(
-DWITH_OPENMP=${WITH_OPENMP} -DWITH_OPENMP=${WITH_OPENMP}
-DWITH_MPI=${WITH_MPI} -DWITH_MPI=${WITH_MPI}
-DWITH_GMP=${WITH_GMP} -DWITH_GMP=${WITH_GMP}
-DWITH_PROFILING=${WITH_PROFILING}
-DWITH_COVERAGE=${WITH_COVERAGE} -DWITH_COVERAGE=${WITH_COVERAGE}
-DWITH_CI_FLAGS=${WITH_CI_FLAGS} -DWITH_CI_FLAGS=${WITH_CI_FLAGS}
-DBUILD_BENCHMARKS=${BUILD_BENCHMARKS} -DBUILD_BENCHMARKS=${BUILD_BENCHMARKS}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment