Commit 6cd93842 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Merge branch 'JK/build' into 'develop'

build script refactoring

See merge request !88
parents a26e636a 596a2e70
Loading
Loading
Loading
Loading
+41 −41
Original line number Diff line number Diff line
@@ -20,15 +20,15 @@ stages:
    WITH_CUDA: "no"
    WITH_CUDA_ARCH: "auto"
    WITH_MPI: "no"
    # configurations
    WITH_TESTS: "no"
    WITH_MATRIX_TESTS: "no"
    # build targets
    BUILD_TESTS: "no"
    BUILD_MATRIX_TESTS: "no"
    WITH_COVERAGE: "no"
    WITH_DOC: "no"
    WITH_BENCHMARKS: "no"
    WITH_EXAMPLES: "no"
    WITH_TOOLS: "no"
    WITH_PYTHON: "no"
    BUILD_DOC: "no"
    BUILD_BENCHMARKS: "no"
    BUILD_EXAMPLES: "no"
    BUILD_TOOLS: "no"
    BUILD_PYTHON: "no"

# base for OpenMP+MPI builds
.openmp_mpi:
@@ -81,18 +81,18 @@ stages:
                -DWITH_MPI=${WITH_MPI}
                -DWITH_CUDA=${WITH_CUDA}
                -DWITH_CUDA_ARCH=${WITH_CUDA_ARCH}
                -DWITH_TESTS=${WITH_TESTS}
                -DWITH_MATRIX_TESTS=${WITH_MATRIX_TESTS}
                -DWITH_DOC=${WITH_DOC}
                -DBUILD_TESTS=${BUILD_TESTS}
                -DBUILD_MATRIX_TESTS=${BUILD_MATRIX_TESTS}
                -DBUILD_DOC=${BUILD_DOC}
                -DWITH_COVERAGE=${WITH_COVERAGE}
                -DWITH_BENCHMARKS=${WITH_BENCHMARKS}
                -DWITH_EXAMPLES=${WITH_EXAMPLES}
                -DWITH_TOOLS=${WITH_TOOLS}
                -DWITH_PYTHON=${WITH_PYTHON}
                -DBUILD_BENCHMARKS=${BUILD_BENCHMARKS}
                -DBUILD_EXAMPLES=${BUILD_EXAMPLES}
                -DBUILD_TOOLS=${BUILD_TOOLS}
                -DBUILD_PYTHON=${BUILD_PYTHON}
                -DWITH_CI_FLAGS=yes
        # "install" implies the "all" target
        - ninja ${NINJAFLAGS} install
        - if [[ ${WITH_TESTS} == "yes" ]] || [[ ${WITH_MATRIX_TESTS} == "yes" ]]; then
        - if [[ ${BUILD_TESTS} == "yes" ]] || [[ ${BUILD_MATRIX_TESTS} == "yes" ]]; then
                ninja test;
          fi
        - popd
@@ -137,7 +137,7 @@ cuda_tests_Debug:
        <<: *default_cmake_flags
        WITH_CUDA: "yes"
        BUILD_TYPE: Debug
        WITH_TESTS: "yes"
        BUILD_TESTS: "yes"

cuda_tests_Release:
    extends: .build_template
@@ -149,7 +149,7 @@ cuda_tests_Release:
        <<: *default_cmake_flags
        WITH_CUDA: "yes"
        BUILD_TYPE: Release
        WITH_TESTS: "yes"
        BUILD_TESTS: "yes"


cuda_matrix_tests_Debug:
@@ -162,7 +162,7 @@ cuda_matrix_tests_Debug:
        <<: *default_cmake_flags
        WITH_CUDA: "yes"
        BUILD_TYPE: Debug
        WITH_MATRIX_TESTS: "yes"
        BUILD_MATRIX_TESTS: "yes"

cuda_matrix_tests_Release:
    extends: .build_template
@@ -174,7 +174,7 @@ cuda_matrix_tests_Release:
        <<: *default_cmake_flags
        WITH_CUDA: "yes"
        BUILD_TYPE: Release
        WITH_MATRIX_TESTS: "yes"
        BUILD_MATRIX_TESTS: "yes"


cuda_examples_Debug:
@@ -187,7 +187,7 @@ cuda_examples_Debug:
        <<: *default_cmake_flags
        WITH_CUDA: "yes"
        BUILD_TYPE: Debug
        WITH_EXAMPLES: "yes"
        BUILD_EXAMPLES: "yes"

cuda_examples_Release:
    extends: .build_template
@@ -199,7 +199,7 @@ cuda_examples_Release:
        <<: *default_cmake_flags
        WITH_CUDA: "yes"
        BUILD_TYPE: Release
        WITH_EXAMPLES: "yes"
        BUILD_EXAMPLES: "yes"


cuda_benchmarks_tools_python_Debug:
@@ -212,9 +212,9 @@ cuda_benchmarks_tools_python_Debug:
        <<: *default_cmake_flags
        WITH_CUDA: "yes"
        BUILD_TYPE: Debug
        WITH_BENCHMARKS: "yes"
        WITH_TOOLS: "yes"
        WITH_PYTHON: "yes"
        BUILD_BENCHMARKS: "yes"
        BUILD_TOOLS: "yes"
        BUILD_PYTHON: "yes"

cuda_benchmarks_tools_python_Release:
    extends: .build_template
@@ -226,9 +226,9 @@ cuda_benchmarks_tools_python_Release:
        <<: *default_cmake_flags
        WITH_CUDA: "yes"
        BUILD_TYPE: Release
        WITH_BENCHMARKS: "yes"
        WITH_TOOLS: "yes"
        WITH_PYTHON: "yes"
        BUILD_BENCHMARKS: "yes"
        BUILD_TOOLS: "yes"
        BUILD_PYTHON: "yes"


cuda_mpi_tests_Debug:
@@ -280,60 +280,60 @@ default_tests_Debug:
    variables:
        <<: *default_cmake_flags
        BUILD_TYPE: Debug
        WITH_TESTS: "yes"
        BUILD_TESTS: "yes"

default_tests_Release:
    extends: .build_template
    variables:
        <<: *default_cmake_flags
        BUILD_TYPE: Release
        WITH_TESTS: "yes"
        BUILD_TESTS: "yes"

default_matrix_tests_Debug:
    extends: .build_template
    variables:
        <<: *default_cmake_flags
        BUILD_TYPE: Debug
        WITH_MATRIX_TESTS: "yes"
        BUILD_MATRIX_TESTS: "yes"

default_matrix_tests_Release:
    extends: .build_template
    variables:
        <<: *default_cmake_flags
        BUILD_TYPE: Release
        WITH_MATRIX_TESTS: "yes"
        BUILD_MATRIX_TESTS: "yes"

default_examples_Debug:
    extends: .build_template
    variables:
        <<: *default_cmake_flags
        BUILD_TYPE: Debug
        WITH_EXAMPLES: "yes"
        BUILD_EXAMPLES: "yes"

default_examples_Release:
    extends: .build_template
    variables:
        <<: *default_cmake_flags
        BUILD_TYPE: Release
        WITH_EXAMPLES: "yes"
        BUILD_EXAMPLES: "yes"

default_benchmarks_tools_python_Debug:
    extends: .build_template
    variables:
        <<: *default_cmake_flags
        BUILD_TYPE: Debug
        WITH_BENCHMARKS: "yes"
        WITH_TOOLS: "yes"
        WITH_PYTHON: "yes"
        BUILD_BENCHMARKS: "yes"
        BUILD_TOOLS: "yes"
        BUILD_PYTHON: "yes"

default_benchmarks_tools_python_Release:
    extends: .build_template
    variables:
        <<: *default_cmake_flags
        BUILD_TYPE: Release
        WITH_BENCHMARKS: "yes"
        WITH_TOOLS: "yes"
        WITH_PYTHON: "yes"
        BUILD_BENCHMARKS: "yes"
        BUILD_TOOLS: "yes"
        BUILD_PYTHON: "yes"


mpi_tests_Debug:
@@ -472,7 +472,7 @@ documentation examples:
        WITH_CUDA: "yes"
        BUILD_TYPE: Debug
        # build output snippets for documentation
        WITH_DOC: "yes"
        BUILD_DOC: "yes"
    only:
        changes:
            - Documentation/**/*
+20 −22
Original line number Diff line number Diff line
@@ -23,15 +23,14 @@ 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_TESTS "Build tests" ON)
option(WITH_MATRIX_TESTS "Build tests for matrices" 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 'src/Examples' directory" ON)
option(WITH_TOOLS "Compile the 'src/Tools' directory" ON)
option(WITH_BENCHMARKS "Compile the 'src/Benchmarks' directory" ON)
option(WITH_PYTHON "Compile the Python bindings" ON)
option(WITH_DOC "Build examples included in the documentation" ON)
option(BUILD_BENCHMARKS "Compile the 'src/Benchmarks' directory" OFF)
option(BUILD_EXAMPLES "Compile the 'src/Examples' directory" OFF)
option(BUILD_TOOLS "Compile the 'src/Tools' directory" OFF)
option(BUILD_TESTS "Build tests" OFF)
option(BUILD_MATRIX_TESTS "Build tests for matrix formats" OFF)
option(BUILD_PYTHON "Compile the Python bindings" OFF)
option(BUILD_DOC "Build examples included in the documentation" OFF)

# install paths relative to the cmake's prefix
set( TNL_TARGET_INCLUDE_DIRECTORY "include/TNL" )
@@ -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" )
@@ -155,7 +155,7 @@ endif()
link_libraries( stdc++fs )

# gtest has to be built before we add the MPI flags
if( ${WITH_TESTS} OR ${WITH_MATRIX_TESTS} )
if( ${BUILD_TESTS} OR ${BUILD_MATRIX_TESTS} )
   enable_testing()

   # build gtest libs
@@ -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" )
@@ -330,7 +328,7 @@ include_directories( src/3rdparty )
add_subdirectory( src )

# Add subdirectories for examples included in the documentation
if( ${WITH_DOC} )
if( ${BUILD_DOC} )
   set( TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH "${CMAKE_SOURCE_DIR}/Documentation/output_snippets" )
   file(MAKE_DIRECTORY ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH})
   add_subdirectory( Documentation/Examples )
@@ -373,14 +371,14 @@ message( " WITH_CUDA_ARCH = ${WITH_CUDA_ARCH}" )
message( "   WITH_OPENMP = ${WITH_OPENMP}" )
message( "   WITH_MPI = ${WITH_MPI}" )
message( "   WITH_GMP = ${WITH_GMP}" )
message( "   WITH_TESTS = ${WITH_TESTS}" )
message( "   WITH_MATRIX_TESTS = ${WITH_MATRIX_TESTS}" )
message( "   WITH_PROFILING = ${WITH_PROFILING}" )
message( "   WITH_COVERAGE = ${WITH_COVERAGE}" )
message( "   WITH_EXAMPLES = ${WITH_EXAMPLES}" )
message( "   WITH_TOOLS = ${WITH_TOOLS}" )
message( "   WITH_BENCHMARKS = ${WITH_BENCHMARKS}" )
message( "   WITH_PYTHON = ${WITH_PYTHON}" )
message( "   BUILD_BENCHMARKS = ${BUILD_BENCHMARKS}" )
message( "   BUILD_EXAMPLES = ${BUILD_EXAMPLES}" )
message( "   BUILD_TOOLS = ${BUILD_TOOLS}" )
message( "   BUILD_TESTS = ${BUILD_TESTS}" )
message( "   BUILD_MATRIX_TESTS = ${BUILD_MATRIX_TESTS}" )
message( "   BUILD_PYTHON = ${BUILD_PYTHON}" )
message( "   BUILD_DOC = ${BUILD_DOC}" )
# Print compiler options
message( "-- Compiler options:" )
message( "   CMAKE_CXX_FLAGS = ${CMAKE_CXX_FLAGS}" )
+138 −84
Original line number Diff line number Diff line
@@ -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"
@@ -22,53 +22,79 @@ WITH_CUDA="yes"
WITH_CUDA_ARCH="auto"
WITH_OPENMP="yes"
WITH_GMP="no"
WITH_TESTS="yes"
WITH_MATRIX_TESTS="yes"
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"
WITH_DOC="yes"
WITH_EXAMPLES="yes"
WITH_PYTHON="yes"
WITH_TOOLS="yes"
WITH_BENCHMARKS="yes"
WITH_CI_FLAGS="no"

# targets
BUILD_BENCHMARKS="no"
BUILD_EXAMPLES="no"
BUILD_PYTHON="no"
BUILD_TOOLS="no"
BUILD_TESTS="no"
BUILD_MATRIX_TESTS="no"
BUILD_DOC="no"

function print_usage()
{
    cat << EOF
usage: $0 [options] [target ...]

By default, the script does not select any target. Build targets available for
selection are listed below. If the --install option is used, the TNL header
files as well as the selected targets will be installed into the directory
specified by the --prefix option.

Targets:
    all             Special target which includes all other targets.
    benchmarks      Compile the 'src/Benchmarks' directory.
    examples        Compile the 'src/Examples' directory.
    tools           Compile the 'src/Tools' directory.
    tests           Compile unit tests in the 'src/UnitTests' directory (except
                    tests for matrix formats, which have a separate target).
    matrix-tests    Compile unit tests for matrix formats.
    python          Compile the Python bindings.
    doc             Generate the documentation.

General options:
    --help                                Write this help list and exit.
    --verbose                             Enables verbose build.
    --install=yes/no                      Enables the installation of TNL files. '$INSTALL' by default.
    --prefix=PATH                         Prefix for the installation directory. '$HOME/local' by default.

Options affecting all targets:
    --offline-build=yes/no                Disables online updates during the build. '$OFFLINE_BUILD' by default.
    --build=Debug/Release                 Build type.
    --build-jobs=NUM                      Number of processes to be used for the build. It is set to the number of available CPU cores by default.
    --cmake=CMAKE                         Path to the cmake command. '$CMAKE' by default.
    --cmake-only=yes/no                   Run only the cmake command, don't actually build anything. '$CMAKE_ONLY' by default.
    --compiler=gcc/clang/icc              Selects the compiler to use. '$COMPILER' by default.
    --dcmtk-dir=PATH                      Path to the DCMTK (Dicom Toolkit) root dir. '$DCMTK_DIR' by default.
    --with-mpi=yes/no                     Enables MPI. '$WITH_MPI' by default (OpenMPI required).
    --with-cuda=yes/no                    Enables CUDA. '$WITH_CUDA' by default (CUDA Toolkit is required).
    --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.

Options for the 'tests' and 'matrix-tests' targets:
    --run-tests=yes/no                    Runs unit tests if they were compiled. '$RUN_TESTS' by default.
    --tests-jobs=NUM                      Number of processes to be used for the unit tests. It is $TEST_JOBS by default.
    --with-coverage=yes/no                Enables code coverage reports for unit tests (lcov is required). '$WITH_COVERAGE' by default.
EOF
}

# handle --help first
for option in "$@"; do
    if [[ "$option" == "--help" ]]; then
      echo "TNL build options:"
      echo ""
      echo "   --help                                Write this help list and exit."
      echo "   --build=Debug/Release                 Build type."
      echo "   --build-jobs=NUM                      Number of processes to be used for the build. It is set to the number of available CPU cores by default."
      echo "   --verbose                             Enables verbose build."
      echo "   --offline-build=yes/no                Disables online updates during the build. '$OFFLINE_BUILD' by default."
      echo "   --install=yes/no                      Enables the installation of TNL files. '$INSTALL' by default."
      echo "   --prefix=PATH                         Prefix for the installation directory. '$HOME/local' by default."
      echo "   --cmake=CMAKE                         Path to the cmake command. '$CMAKE' by default."
      echo "   --cmake-only=yes/no                   Run only the cmake command, don't actually build anything. '$CMAKE_ONLY' by default."
      echo "   --compiler=gcc/clang/icc              Selects the compiler to use. '$COMPILER' by default."
      echo "   --dcmtk-dir=PATH                      Path to the DCMTK (Dicom Toolkit) root dir. '$DCMTK_DIR' by default."
      echo "   --with-mpi=yes/no                     Enables MPI. '$WITH_MPI' by default (OpenMPI required)."
      echo "   --with-cuda=yes/no                    Enables CUDA. '$WITH_CUDA' by default (CUDA Toolkit is required)."
      echo "   --with-cuda-arch=all/auto/3.0/3.5/... Chooses CUDA architecture. '$WITH_CUDA_ARCH' by default."
      echo "   --with-openmp=yes/no                  Enables OpenMP. '$WITH_OPENMP' by default."
      echo "   --with-gmp=yes/no                     Enables the wrapper for GNU Multiple Precision Arithmetic Library. '$WITH_GMP' by default."
      echo "   --with-tests=yes/no                   Enables compilation of unit tests. '$WITH_TESTS' by default."
      echo "   --run-tests=yes/no                    Runs unit tests if they were compiled. '$RUN_TESTS' by default."
      echo "   --tests-jobs=NUM                      Number of processes to be used for the unit tests. It is $TEST_JOBS by default."
      echo "   --with-profiling=yes/no               Enables code profiling compiler flags. '$WITH_PROFILING' by default."
      echo "   --with-coverage=yes/no                Enables code coverage reports for unit tests (lcov is required). '$WITH_COVERAGE' by default."
      echo "   --with-doc=yes/no                     Generate the documentation. '$WITH_DOC' by default."
      echo "   --with-examples=yes/no                Compile the 'src/Examples' directory. '$WITH_EXAMPLES' by default."
      echo "   --with-python=yes/no                  Compile the Python bindings. '$WITH_PYTHON' by default."
      echo "   --with-tools=yes/no                   Compile the 'src/Tools' directory. '$WITH_TOOLS' by default."
      echo "   --with-benchmarks=yes/no              Compile the 'src/Benchmarks' directory. '$WITH_BENCHMARKS' by default."
        print_usage
        exit 1
    fi
done

# handle options
for option in "$@"; do
    case "$option" in
        --build=*             ) BUILD="${option#*=}" ;;
@@ -76,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#*=}" ;;
@@ -86,22 +113,50 @@ for option in "$@"; do
        --with-cuda-arch=*    ) WITH_CUDA_ARCH="${option#*=}";;
        --with-openmp=*       ) WITH_OPENMP="${option#*=}" ;;
        --with-gmp=*          ) WITH_GMP="${option#*=}" ;;
      --with-tests=*                   ) WITH_TESTS="${option#*=}" ;;
      --with-matrix-tests=*            ) WITH_MATRIX_TESTS="${option#*=}" ;;
        --run-tests=*         ) RUN_TESTS="${option#*=}" ;;
        --tests-jobs=*        ) TESTS_JOBS="${option#*=}" ;;
      --with-profiling=*               ) WITH_PROFILING="${option#*=}" ;;
        --with-coverage=*     ) WITH_COVERAGE="${option#*=}" ;;
      --with-doc=*                     ) WITH_DOC="${option#*=}" ;;
      --with-examples=*                ) WITH_EXAMPLES="${option#*=}" ;;
      --with-tools=*                   ) WITH_TOOLS="${option#*=}" ;;
      --with-benchmarks=*              ) WITH_BENCHMARKS="${option#*=}" ;;
      --with-python=*                  ) WITH_PYTHON="${option#*=}" ;;
        --with-ci-flags=*     ) WITH_CI_FLAGS="${option#*=}" ;;
        -*                    )
            echo "Unknown option $option. Use --help for more information." >&2
            exit 1
            ;;
        *) break ;;
    esac
    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
        all)
            BUILD_BENCHMARKS="yes"
            BUILD_EXAMPLES="yes"
            BUILD_TOOLS="yes"
            BUILD_TESTS="yes"
            BUILD_MATRIX_TESTS="yes"
            BUILD_PYTHON="yes"
            BUILD_DOC="yes"
            ;;
        benchmarks)     BUILD_BENCHMARKS="yes" ;;
        examples)       BUILD_EXAMPLES="yes" ;;
        tools)          BUILD_TOOLS="yes" ;;
        tests)          BUILD_TESTS="yes" ;;
        matrix-tests)   BUILD_MATRIX_TESTS="yes" ;;
        python)         BUILD_PYTHON="yes" ;;
        doc)            BUILD_DOC="yes" ;;
        *)
         echo "Unknown option ${option}. Use --help for more information." >&2
            echo "Unknown target $target. The available targets are: all, benchmarks, examples, tools, tests, matrix-tests, python, doc." >&2
            echo "Use --help for more information." >&2
            exit 1
    esac
    shift
done

if [[ "$COMPILER" == "gcc" ]]; then
@@ -141,23 +196,22 @@ cmake_command=(
         -G "${generator}"
         -DCMAKE_BUILD_TYPE=${BUILD}
         -DCMAKE_INSTALL_PREFIX=${PREFIX}
         -DDCMTK_DIR=${DCMTK_DIR}
         -DOFFLINE_BUILD=${OFFLINE_BUILD}
         -DWITH_CUDA=${WITH_CUDA}
         -DWITH_CUDA_ARCH=${WITH_CUDA_ARCH}
         -DWITH_OPENMP=${WITH_OPENMP}
         -DWITH_MPI=${WITH_MPI}
         -DWITH_GMP=${WITH_GMP}
         -DWITH_TESTS=${WITH_TESTS}
         -DWITH_MATRIX_TESTS=${WITH_MATRIX_TESTS}
         -DWITH_PROFILING=${WITH_PROFILING}
         -DWITH_COVERAGE=${WITH_COVERAGE}
         -DWITH_DOC=${WITH_DOC}
         -DWITH_EXAMPLES=${WITH_EXAMPLES}
         -DWITH_TOOLS=${WITH_TOOLS}
         -DWITH_PYTHON=${WITH_PYTHON}
         -DWITH_BENCHMARKS=${WITH_BENCHMARKS}
         -DWITH_CI_FLAGS=${WITH_CI_FLAGS}
         -DDCMTK_DIR=${DCMTK_DIR}
         -DBUILD_BENCHMARKS=${BUILD_BENCHMARKS}
         -DBUILD_EXAMPLES=${BUILD_EXAMPLES}
         -DBUILD_TOOLS=${BUILD_TOOLS}
         -DBUILD_TESTS=${BUILD_TESTS}
         -DBUILD_MATRIX_TESTS=${BUILD_MATRIX_TESTS}
         -DBUILD_PYTHON=${BUILD_PYTHON}
         -DBUILD_DOC=${BUILD_DOC}
)

# Skip running cmake if it was already run and the cmake command is the same.
@@ -224,11 +278,11 @@ if ! $make ${VERBOSE} $make_target; then
   exit 1
fi

if [[ ${WITH_DOC} == "yes" ]]; then
if [[ ${BUILD_DOC} == "yes" ]]; then
   "$ROOT_DIR/Documentation/build" --prefix="$PREFIX"
fi

if [[ ${WITH_TESTS} == "yes" ]] || [[ ${WITH_MATRIX_TESTS} == "yes" ]]; then
if [[ ${BUILD_TESTS} == "yes" ]] || [[ ${BUILD_MATRIX_TESTS} == "yes" ]]; then
   if [[ ${RUN_TESTS} == "yes" ]]; then
      OMP_NUM_THREADS=${TESTS_JOBS} CTEST_PARALLEL_LEVEL=${TESTS_JOBS} CTEST_OUTPUT_ON_FAILURE=1 $make test
   fi
+13 −28
Original line number Diff line number Diff line
@@ -56,38 +56,23 @@ fi


PREFIX=${HOME}/.local
for option in "$@"
do
for option in "$@"; do
    case $option in
        --prefix=*) PREFIX="${option#*=}" ;;
    esac
done


TNL_TEST=`which tnl-bindir`
if [[ ! "$PATH" =~ "$PREFIX/bin" ]]; then
    cat << EOF

WARNING !!!

if test x${TNL_TEST} = x;
then
    echo ""
    echo "WARNING !!!"
    echo ""
    echo "Your system does not see TNL which was installed right now."
    echo "You need to add it to your system variables PATH and LD_LIBRARY_PATH."
    echo "Add the following to your .bashrc file:"
    echo ""
Your system does not see TNL which was installed right now.
You need to add it to your system variables PATH and LD_LIBRARY_PATH.
Add the following to your .bashrc file:

    echo "if test x\${PATH} = x;"
    echo "then"
    echo "   PATH=${PREFIX}/bin"
    echo "else"
    echo "   PATH=\${PATH}:${PREFIX}/bin"
    echo "fi"
    echo "if test x\${LD_LIBRARY_PATH} = x;"
    echo "then"
    echo "   LD_LIBRARY_PATH=${PREFIX}/lib"
    echo "else"
    echo "   LD_LIBRARY_PATH=\${LD_LIBRARY_PATH}:${PREFIX}/lib"
    echo "fi"
    echo "export PATH"
    echo "export LD_LIBRARY_PATH"
export PATH="\${PATH}:${PREFIX}/bin"
export LD_LIBRARY_PATH="\${LD_LIBRARY_PATH}:${PREFIX}/lib"
EOF
fi
+1 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@ install( DIRECTORY async mpark Leksys TYPE INCLUDE
         MESSAGE_NEVER
         FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp" )

if( ${WITH_PYTHON} )
if( ${BUILD_PYTHON} )
   install( DIRECTORY cctbx TYPE INCLUDE
            MESSAGE_NEVER
            FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp" )
Loading