Commit 698dfcec authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Rewriting instalation scripts.

parent 330ea8e4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -5,4 +5,4 @@
/Testing
/CMakeLists.txt.user
/doc/_build
/build
/Build
+48 −46
Original line number Diff line number Diff line
@@ -85,7 +85,8 @@ if( WITH_CUDA STREQUAL "yes" )
      AddCompilerFlag( "-std=gnu++0x" )         
    endif( CUDA_FOUND )
else( WITH_CUDA STREQUAL "yes" )
   AddCompilerFlag( "-std=gnu++0x -ftree-vectorizer-verbose=1" )       
   #AddCompilerFlag( "-std=gnu++0x -ftree-vectorizer-verbose=1" )       
   AddCompilerFlag( "-std=gnu++0x" )       
endif( WITH_CUDA STREQUAL "yes" )    

####
@@ -139,6 +140,7 @@ endif()
####
# Check for cppunit
#
if( WITH_TESTS STREQUAL "yes" )
    FIND_PATH(CPPUNIT_INCLUDE_DIR cppunit/TestCase.h
      /usr/local/include
      /usr/include
@@ -184,6 +186,9 @@ else( ${CPPUNIT_INCLUDE_DIR} STREQUAL "CPPUNIT_INCLUDE_DIR-NOTFOUND" )
       set( HAVE_CPPUNIT "#define HAVE_CPPUNIT" )
      endif(CPPUNIT_LIBRARY)
    endif( ${CPPUNIT_INCLUDE_DIR} STREQUAL "CPPUNIT_INCLUDE_DIR-NOTFOUND" )
    ENABLE_TESTING()
    INCLUDE( Dart )
endif( WITH_TESTS STREQUAL "yes" )

#if( BUILD_MPI )
#   FIND_PATH( PETSC_INCLUDE_DIR petsc.h
@@ -210,9 +215,6 @@ endif( ${CPPUNIT_INCLUDE_DIR} STREQUAL "CPPUNIT_INCLUDE_DIR-NOTFOUND" )
#   endif()
#endif()


ENABLE_TESTING()
INCLUDE( Dart )
set( CXX_TEST_FLAGS "-fprofile-arcs -ftest-coverage" )
set( LD_TEST_FLAGS "-lgcov -coverage" )

build

0 → 100755
+76 −0
Original line number Diff line number Diff line
#!/bin/bash

TARGET=TNL
PREFIX=${HOME}/local
WITH_CUDA="yes"
WITH_TESTS="yes"
WITH_TEMPLATE_INSTANTIATION="yes"
CMAKE="cmake"
CMAKE_ONLY="no"
HELP="no"
VERBOSE=""
ROOT_DIR="."
BUILD_JOBS=`grep -c processor /proc/cpuinfo`

for option in "$@"
do
    case $option in
        --prefix=*                     ) PREFIX="${option#*=}" ;;
        --build=*                      ) BUILD="${option#*=}" ;;
        --with-tests=*                 ) WITH_TESTS="${option#*=}" ;;
        --with-cuda=*                  ) WITH_CUDA="${option#*=}" ;;
        --with-templates-instantiation ) WITH_TEMPLATE_INSTANTIATION="${option#*=}" ;;
        --with-cmake=*                 ) CMAKE="${option#*=}" ;;
        --build-jobs=*                 ) BUILD_JOBS="${option#*=}" ;;
        --cmake-only=*                 ) CMAKE_ONLY="${option#*=}" ;;
        --verbose                      ) VERBOSE="VERBOSE=1" ;;
        --root-dir=*                   ) ROOT_DIR="${option#*=}" ;;
        --help                         ) HELP="yes" ;;
        *                              ) 
           echo "Unknown option ${option}. Use --help for more information."
           exit 1 ;;
    esac
done

if test ${HELP} = "yes";
then
    echo "TNL build options:"
    echo ""
    echo "   --prefix=PATH                         Prefix for the installation directory. ${HOME}/local by default."
    echo "   --build=Debug/Release                 Build type."
    echo "   --with-tests=yes/no                   Enable unit tests. 'yes' by default (libcppunit-dev is required)."
    echo "   --with-cuda=yes/no                    Enable CUDA. 'yes' by default (CUDA Toolkit is required)."
    echo "   --with-templates-instantiation=yes/no Some TNL templates are precompiled during the build. 'yes' by default."
    echo "   --with-cmake=CMAKE                    Path to cmake. 'cmake' by default."
    echo "   --build-jobs=NUM                      Number of processes to be used for the build. It is set to a number of CPU cores by default."
    echo "   --verbose                             It enables verbose build."
    echo "   --root-dir=PATH                       Path to the TNL source code root dir."
    echo "   --help                                Write this help."
    exit 1
fi

echo "Configuring ${BUILD} $TARGET ..."

${CMAKE} ${ROOT_DIR} \
         -DCMAKE_BUILD_TYPE=${BUILD} \
         -DCMAKE_INSTALL_PREFIX=${PREFIX} \
         -DWITH_CUDA=${WITH_CUDA} \
         -DWITH_TESTS=${WITH_TESTS} \
         -DPETSC_DIR=${PETSC_DIR} \
         -DWITH_TEMPLATE_INSTANTIATION=${WITH_TEMPLATE_INSTANTIATION}

if test ${CMAKE_ONLY} = "yes";
then
    exit 1
fi

echo "Building ${BUILD} $TARGET using $BUILD_JOBS processors ..."

make -j${BUILD_JOBS} ${VERBOSE}

if test WITH_TESTS = "yes";
then
    make -j${BUILD_JOBS} test
fi

exit 0
 No newline at end of file

configure

deleted100755 → 0
+0 −15
Original line number Diff line number Diff line
#!/bin/bash

TARGET=TNL
INSTALL_PREFIX=${HOME}/local
WITH_CUDA=yes
TEMPLATE_EXPLICIT_INSTANTIATION=yes
VERBOSE="VERBOSE=1"

CMAKE="cmake"
${CMAKE} .. -DCMAKE_BUILD_TYPE=Debug \
            -DCMAKE_INSTALL_PREFIX=${HOME}/local \
            -DWITH_CUDA=${WITH_CUDA} \
            -DPETSC_DIR=${PETSC_DIR} \
            -DWITH_TEMPLATE_EXPLICIT_INSTANTIATION=${TEMPLATE_EXPLICIT_INSTANTIATION}
+39 −33
Original line number Diff line number Diff line
#!/bin/bash

TARGET=TNL
INSTALL_PREFIX=${HOME}/local
WITH_CUDA=yes
TEMPLATE_EXPLICIT_INSTANTIATION=yes
VERBOSE="VERBOSE=1"
BUILD_DEBUG="yes"
BUILD_RELEASE="yes"

CMAKE="cmake"
CPUS=`grep -c processor /proc/cpuinfo`
#CPUS="1"
OPTIONS=""

for option in "$@"
do
    case $option in
        --no-debug                    ) BUILD_DEBUG="no" ;;
        --no-release                  ) BUILD_RELEASE="no" ;;        
        *                             ) OPTIONS="${OPTIONS} ${option}" ;;
    esac
done

echo "Building $TARGET using $CPUS processors."

if test ${BUILD_DEBUG} = "yes";
then
    if [ ! -d Debug ];
    then
       mkdir Debug
    fi
    cd Debug
    ../build --root-dir=.. --build=Debug ${OPTIONS}
    if test $? != 0;
    then
       exit 1
    fi
    make install
    cd ..
fi

if test ${BUILD_RELEASE} = "yes";
then
    if [ ! -d Release ];
    then
       mkdir Release
    fi

cd Debug
${CMAKE} .. -DCMAKE_BUILD_TYPE=Debug \
            -DCMAKE_INSTALL_PREFIX=${HOME}/local \
            -DWITH_CUDA=${WITH_CUDA} \
            -DPETSC_DIR=${PETSC_DIR} \
            -DWITH_TEMPLATE_EXPLICIT_INSTANTIATION=${TEMPLATE_EXPLICIT_INSTANTIATION}
make -j${CPUS} ${VERBOSE}
make -j${CPUS} test
make -j${CPUS} install

cd ../Release
${CMAKE} .. -DCMAKE_INSTALL_PREFIX=${HOME}/local \
            -DWITH_CUDA=${WITH_CUDA} \
            -DPETSC_DIR=${PETSC_DIR} \
            -DWITH_TEMPLATE_EXPLICIT_INSTANTIATION=${TEMPLATE_EXPLICIT_INSTANTIATION}
make -j${CPUS} ${VERBOSE}
make -j${CPUS} test
make -j${CPUS} install
    cd Release
    ../build --root-dir=.. --build=Release ${OPTIONS}
    if test $? != 0;
    then
        exit 1
    fi
    make install
    cd ..
fi
exit 0
Loading