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

Rewriting instalation scripts.

parent 330ea8e4
......@@ -5,4 +5,4 @@
/Testing
/CMakeLists.txt.user
/doc/_build
/build
/Build
......@@ -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,51 +140,55 @@ endif()
####
# Check for cppunit
#
FIND_PATH(CPPUNIT_INCLUDE_DIR cppunit/TestCase.h
/usr/local/include
/usr/include
DOC "CppUnit headers."
)
if( WITH_TESTS STREQUAL "yes" )
FIND_PATH(CPPUNIT_INCLUDE_DIR cppunit/TestCase.h
/usr/local/include
/usr/include
DOC "CppUnit headers."
)
####
# With Win32, important to have both
#
if(WIN32)
FIND_LIBRARY(CPPUNIT_LIBRARY cppunit
${CPPUNIT_INCLUDE_DIR}/../lib
/usr/local/lib
/usr/lib)
FIND_LIBRARY(CPPUNIT_DEBUG_LIBRARY cppunitd
${CPPUNIT_INCLUDE_DIR}/../lib
/usr/local/lib
/usr/lib)
else(WIN32)
# On unix system, debug and release have the same name
FIND_LIBRARY(CPPUNIT_LIBRARY cppunit
${CPPUNIT_INCLUDE_DIR}/../lib
/usr/local/lib
/usr/lib)
FIND_LIBRARY(CPPUNIT_DEBUG_LIBRARY cppunit
${CPPUNIT_INCLUDE_DIR}/../lib
/usr/local/lib
/usr/lib)
endif(WIN32)
####
# With Win32, important to have both
#
if(WIN32)
FIND_LIBRARY(CPPUNIT_LIBRARY cppunit
${CPPUNIT_INCLUDE_DIR}/../lib
/usr/local/lib
/usr/lib)
FIND_LIBRARY(CPPUNIT_DEBUG_LIBRARY cppunitd
${CPPUNIT_INCLUDE_DIR}/../lib
/usr/local/lib
/usr/lib)
else(WIN32)
# On unix system, debug and release have the same name
FIND_LIBRARY(CPPUNIT_LIBRARY cppunit
${CPPUNIT_INCLUDE_DIR}/../lib
/usr/local/lib
/usr/lib)
FIND_LIBRARY(CPPUNIT_DEBUG_LIBRARY cppunit
${CPPUNIT_INCLUDE_DIR}/../lib
/usr/local/lib
/usr/lib)
endif(WIN32)
if( ${CPPUNIT_INCLUDE_DIR} STREQUAL "CPPUNIT_INCLUDE_DIR-NOTFOUND" )
message( "CPPUNIT not found." )
set( HAVE_CPPUNIT "//#define HAVE_CPPUNIT" )
else( ${CPPUNIT_INCLUDE_DIR} STREQUAL "CPPUNIT_INCLUDE_DIR-NOTFOUND" )
message( "CPPUNIT headers found -- ${CPPUNIT_INCLUDE_DIR}" )
if(CPPUNIT_LIBRARY)
message( "CPPUNIT library found -- ${CPPUNIT_LIBRARY}" )
set(CPPUNIT_FOUND "YES")
set(CPPUNIT_LIBRARIES ${CPPUNIT_LIBRARY} ${CMAKE_DL_LIBS})
set(CPPUNIT_DEBUG_LIBRARIES ${CPPUNIT_DEBUG_LIBRARY}
${CMAKE_DL_LIBS})
set( HAVE_CPPUNIT "#define HAVE_CPPUNIT" )
endif(CPPUNIT_LIBRARY)
endif( ${CPPUNIT_INCLUDE_DIR} STREQUAL "CPPUNIT_INCLUDE_DIR-NOTFOUND" )
if( ${CPPUNIT_INCLUDE_DIR} STREQUAL "CPPUNIT_INCLUDE_DIR-NOTFOUND" )
message( "CPPUNIT not found." )
set( HAVE_CPPUNIT "//#define HAVE_CPPUNIT" )
else( ${CPPUNIT_INCLUDE_DIR} STREQUAL "CPPUNIT_INCLUDE_DIR-NOTFOUND" )
message( "CPPUNIT headers found -- ${CPPUNIT_INCLUDE_DIR}" )
if(CPPUNIT_LIBRARY)
message( "CPPUNIT library found -- ${CPPUNIT_LIBRARY}" )
set(CPPUNIT_FOUND "YES")
set(CPPUNIT_LIBRARIES ${CPPUNIT_LIBRARY} ${CMAKE_DL_LIBS})
set(CPPUNIT_DEBUG_LIBRARIES ${CPPUNIT_DEBUG_LIBRARY}
${CMAKE_DL_LIBS})
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" )
......
#!/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
#!/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}
#!/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 [ ! -d Debug ];
if test ${BUILD_DEBUG} = "yes";
then
mkdir Debug
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 [ ! -d Release ];
if test ${BUILD_RELEASE} = "yes";
then
mkdir Release
if [ ! -d Release ];
then
mkdir Release
fi
cd Release
../build --root-dir=.. --build=Release ${OPTIONS}
if test $? != 0;
then
exit 1
fi
make install
cd ..
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
exit 0
......@@ -38,7 +38,7 @@ using namespace std;
__STRING( ___tnl__assert_condition ), \
__FILE__, \
__LINE__ ); \
asm("trap;") \
\
}
#else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment