Commit 1d4ec3ea authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Added build parameter --with-profiling.

parent 2220c328
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ set(WITH_CUDA_ARCH "auto" CACHE STRING "Build for these CUDA architectures")
option(WITH_OPENMP "Build with OpenMP support" ON)
option(WITH_GMP "Build with GMP support" OFF)
option(WITH_TESTS "Build tests" ON)
option(WITH_PROFILING "Enable code profiling compiler flags" OFF )
option(WITH_COVERAGE "Enable code coverage reports from unit tests" OFF)
option(WITH_EXAMPLES "Compile the 'examples' directory" ON)
option(WITH_TOOLS "Compile the 'src/Tools' directory" ON)
@@ -78,7 +79,7 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
endif()

# set Debug/Release options
set( CMAKE_CXX_FLAGS "-std=c++11 -pthread -Wall -Wno-unused-local-typedefs -Wno-unused-variable -g" )
set( CMAKE_CXX_FLAGS "-std=c++11 -pthread -Wall -Wno-unused-local-typedefs -Wno-unused-variable" )
set( CMAKE_CXX_FLAGS_DEBUG "-g" )
set( CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native -mtune=native -DNDEBUG" )
#set( CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native -mtune=native -DNDEBUG -ftree-vectorizer-verbose=1 -ftree-vectorize -fopt-info-vec-missed -funroll-loops" )
@@ -233,7 +234,7 @@ if( ${WITH_CUDA} )
                endif()
            endif()
        endif()
        set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ; ${CUDA_ARCH} -D_FORCE_INLINES --generate-line-info)
        set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ; ${CUDA_ARCH} -D_FORCE_INLINES )
        # TODO: this is necessary only due to a bug in cmake
        set( CUDA_ADD_LIBRARY_OPTIONS -shared )
    endif()
@@ -247,6 +248,11 @@ if( OPENMP_FOUND AND ${WITH_OPENMP} )
   set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAVE_OPENMP ${OpenMP_CXX_FLAGS}" )
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( HAVE_DCMTK_H "#define HAVE_DCMTK_H 1" )
@@ -464,6 +470,7 @@ message( " WITH_CUDA_ARCH = ${WITH_CUDA_ARCH}" )
message( "   WITH_OPENMP = ${WITH_OPENMP}" )
message( "   WITH_GMP = ${WITH_GMP}" )
message( "   WITH_TESTS = ${WITH_TESTS}" )
message( "   WITH_PROFILING = ${WITH_PROFILING}" )
message( "   WITH_COVERAGE = ${WITH_COVERAGE}" )
message( "   WITH_EXAMPLES = ${WITH_EXAMPLES}" )
message( "   WITH_TOOLS = ${WITH_TOOLS}" )
+4 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ WITH_CUDA_ARCH="auto"
WITH_OPENMP="yes"
WITH_GMP="no"
WITH_TESTS="yes"
WITH_PROFILING="no"
WITH_COVERAGE="no"
WITH_EXAMPLES="yes"
WITH_PYTHON="yes"
@@ -57,6 +58,7 @@ do
        --with-openmp=*                  ) WITH_OPENMP="${option#*=}" ;;
        --with-gmp=*                     ) WITH_GMP="${option#*=}" ;;
        --with-tests=*                   ) WITH_TESTS="${option#*=}" ;;
        --with-profiling=*               ) WITH_PROFILING="${option#*=}" ;;
        --with-coverage=*                ) WITH_COVERAGE="${option#*=}" ;;
        --with-examples=*                ) WITH_EXAMPLES="${option#*=}" ;;
        --with-tools=*                   ) WITH_TOOLS="${option#*=}" ;;
@@ -95,6 +97,7 @@ if [[ ${HELP} == "yes" ]]; then
    echo "   --with-openmp=yes/no                  Enables OpenMP. 'yes' by default."
    echo "   --with-gmp=yes/no                     Enables the wrapper for GNU Multiple Precision Arithmetic Library. 'no' by default."
    echo "   --with-tests=yes/no                   Enables unit tests. 'yes' by default."
    echo "   --with-profiling=yes/no               Enables code profiling compiler falgs. 'no' by default."
    echo "   --with-coverage=yes/no                Enables code coverage reports for unit tests. 'no' by default (lcov is required)."
    echo "   --with-examples=yes/no                Compile the 'examples' directory. 'yes' by default."
    echo "   --with-tools=yes/no                   Compile the 'src/Tools' directory. 'yes' by default."
@@ -165,6 +168,7 @@ cmake_command=(
         -DWITH_OPENMP=${WITH_OPENMP}
         -DWITH_GMP=${WITH_GMP}
         -DWITH_TESTS=${WITH_TESTS}
         -DWITH_PROFILING=${WITH_PROFILING}
         -DWITH_COVERAGE=${WITH_COVERAGE}
         -DWITH_EXAMPLES=${WITH_EXAMPLES}
         -DWITH_TOOLS=${WITH_TOOLS}