Commit 0b72a556 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Merge branch 'develop' of geraldine.fjfi.cvut.cz:/local/projects/tnl/tnl into develop

parents 9c90e08f 1fa8fa8c
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -30,10 +30,14 @@ stages:
#        - export NUM_CORES=$(grep "core id" /proc/cpuinfo | wc -l)
#       # all pyhsical cores
        - export NUM_CORES=$(grep "core id" /proc/cpuinfo | sort -u | wc -l)
        - export MAKEFLAGS="-l$(echo 1.5*$NUM_CORES | bc) -j$NUM_CORES"
        # ninja does not have -l
#        - export MAKEFLAGS="-l$(echo 1.5*$NUM_CORES | bc) -j$NUM_CORES"
        - export NINJAFLAGS="-j$NUM_CORES"
        - export CTEST_OUTPUT_ON_FAILURE=1
        - mkdir -p "./builddir/$CI_JOB_NAME"
        - pushd "./builddir/$CI_JOB_NAME"
        - cmake ../..
                -G Ninja
                -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
                -DCMAKE_INSTALL_PREFIX=$(pwd)/${BUILD_TYPE}_install_prefix
                -DWITH_OPENMP=${WITH_OPENMP}
@@ -43,9 +47,12 @@ stages:
                -DWITH_TESTS=${WITH_TESTS}
                -DWITH_COVERAGE=${WITH_COVERAGE}
                -DWITH_EXAMPLES=${WITH_EXAMPLES}
        - make
        - make test CTEST_OUTPUT_ON_FAILURE=1
        - make install
#        - make
#        - make test
#        - make install
        - ninja ${NINJAFLAGS}
        - ninja test
        - ninja install
        - popd
    variables:
        <<: *default_cmake_flags
+11 −8
Original line number Diff line number Diff line
@@ -97,8 +97,8 @@ if( CXX_COMPILER_NAME MATCHES "icpc" )
endif()

# force colorized output in continuous integration
if( DEFINED ENV{CI_JOB_NAME} )
   message(STATUS "Continuous integration detected -- forcing compilers to produce colorized output.")
if( DEFINED ENV{CI_JOB_NAME} OR ${CMAKE_GENERATOR} STREQUAL "Ninja" )
   message(STATUS "Continuous integration or Ninja detected -- forcing compilers to produce colorized output.")
   if( CXX_COMPILER_NAME MATCHES "clang" )
      set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics" )
   else()
@@ -405,15 +405,18 @@ INCLUDE_DIRECTORIES( src )
INCLUDE_DIRECTORIES( ${PROJECT_BUILD_PATH} )
LINK_DIRECTORIES( ${LIBRARY_OUTPUT_PATH} )

#Pokracujeme dalsimi podadresari
add_subdirectory( src )
add_subdirectory( share )
if( WITH_TESTS STREQUAL "yes" )
    add_subdirectory( tests )
endif( WITH_TESTS STREQUAL "yes" )
# Add all subdirectories
# Note that it is important to start building examples as soon as possible,
# because they take the longest time and other stuff can be pipelined before
# they are finished (at least with Ninja).
if( WITH_EXAMPLES STREQUAL "yes" )
   add_subdirectory( examples )
endif( WITH_EXAMPLES STREQUAL "yes" )
if( WITH_TESTS STREQUAL "yes" )
    add_subdirectory( tests )
endif( WITH_TESTS STREQUAL "yes" )
add_subdirectory( src )
add_subdirectory( share )

set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Template Numerical Library")
set(CPACK_PACKAGE_VENDOR "MMG")
+64 −42
Original line number Diff line number Diff line
#!/bin/bash

set -e

TARGET=TNL
PREFIX=${HOME}/.local
INSTALL="no"
@@ -78,8 +80,7 @@ do
    esac
done

if test ${HELP} = "yes";
then
if [[ ${HELP} == "yes" ]]; then
    echo "TNL build options:"
    echo ""
    echo "   --build=Debug/Release                 Build type."
@@ -107,31 +108,48 @@ then
    exit 1
fi

if test ${WITH_CLANG} = "yes";
then
if [[ ${WITH_CLANG} == "yes" ]]; then
   export CXX=clang++
   export CC=clang
fi

if test ${WITH_MPI} = "yes";
then
    if ! [ -x  "$(command -v mpic++)" ]; then
if [[ ${WITH_MPI} == "yes" ]]; then
    if [[ ! -x  "$(command -v mpic++)" ]]; then
       echo "Warning:mpic++ is not installed on this system. MPI support is turned off." 
    else
       # instruct OpenMPI to use the original compiler
       # reference: https://www.open-mpi.org/faq/?category=mpi-apps#override-wrappers-after-v1.0
       # FIXME: this does not work with CUDA_HOST_COMPILER=mpic++
#       if [ -n "$CXX" ]; then
#          export OMPI_CXX="$CXX"
#       fi
       export CXX=mpic++
       export CUDA_HOST_COMPILER=mpic++
    fi
    if ! [ -x  "$(command -v mpicc)" ]; then
    if [[ ! -x  "$(command -v mpicc)" ]]; then
       echo "Warning: mpicc is not installed on this system." 
    else
       # instruct OpenMPI to use the original compiler
       # reference: https://www.open-mpi.org/faq/?category=mpi-apps#override-wrappers-after-v1.0
#       if [ -n "$CC" ]; then
#          export OMPI_CC="$CC"
#       fi
       export CC=mpicc
    fi
fi

if hash ninja 2>/dev/null; then
   generator=Ninja
   make=ninja
   check_file="build.ninja"
else
   generator="Unix Makefiles"
   make=make
   check_file="Makefile"
fi

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

${CMAKE} ${ROOT_DIR} \
cmake_command="${CMAKE} ${ROOT_DIR} \
         -G ${generator} \
         -DCMAKE_BUILD_TYPE=${BUILD} \
         -DCMAKE_INSTALL_PREFIX=${PREFIX} \
         -DOFFLINE_BUILD=${OFFLINE_BUILD} \
@@ -152,18 +170,27 @@ ${CMAKE} ${ROOT_DIR} \
         -DINSTANTIATE_LONG_DOUBLE=${INSTANTIATE_LONG_DOUBLE} \
         -DINSTANTIATE_INT=${INSTANTIATE_INT} \
         -DINSTANTIATE_LONG_INT=${INSTANTIATE_LONG_INT} \
         -DOPTIMIZED_VECTOR_HOST_OPERATIONS=${OPTIMIZED_VECTOR_HOST_OPERATIONS}
         -DOPTIMIZED_VECTOR_HOST_OPERATIONS=${OPTIMIZED_VECTOR_HOST_OPERATIONS}"

if test $? != 0; then
    echo "Error: cmake exited with error code."
    exit 1
# Skip running cmake if it was already run and the cmake command is the same.
# The build system (e.g. make) will call it automatically if necessary (e.g.
# when some CMakeLists.txt changes).
if [[ -f ".cmake_command" ]]; then
   last_cmake_command=$(cat ".cmake_command" 2>/dev/null)
else
   last_cmake_command=""
fi
if [[ ! -f "$check_file" ]] || [[ "$last_cmake_command" != "$cmake_command" ]]; then
   echo "Configuring ${BUILD} $TARGET ..."
   $cmake_command
   echo -n "$cmake_command" > ".cmake_command"
fi

if test ${CMAKE_ONLY} = "yes";
then
if [[ ${CMAKE_ONLY} == "yes" ]]; then
   exit 0
fi

if [[ "$make" == "make" ]]; then
   if [[ -n ${BUILD_JOBS} ]]; then
      # override $MAKEFLAGS from parent environment
      export MAKEFLAGS=-j${BUILD_JOBS}
@@ -172,6 +199,12 @@ elif [[ -z ${MAKEFLAGS} ]]; then
      BUILD_JOBS=$(grep "core id" /proc/cpuinfo | sort -u | wc -l)
      export MAKEFLAGS=-j${BUILD_JOBS}
   fi
else
   if [[ -z ${BUILD_JOBS} ]]; then
      BUILD_JOBS=$(grep "core id" /proc/cpuinfo | sort -u | wc -l)
   fi
   make="$make -j$BUILD_JOBS"
fi

if [[ -n ${BUILD_JOBS} ]]; then
   echo "Building ${BUILD} $TARGET using $BUILD_JOBS processors ..."
@@ -187,19 +220,8 @@ else
   make_target="all"
fi

make ${VERBOSE} $make_target
if test $? != 0; then
    echo "Error: Build process failed."
    exit 1
fi
$make ${VERBOSE} $make_target


if test ${WITH_TESTS} = "yes";
then
    make test CTEST_OUTPUT_ON_FAILURE=1
    if test $? != 0; then
        echo "Error: Some test did not pass successfuly."
    fi
if [[ ${WITH_TESTS} == "yes" ]]; then
   CTEST_OUTPUT_ON_FAILURE=1 $make test
fi

exit 0
+4 −4
Original line number Diff line number Diff line
if( ${WITH_PYTHON} )
   ADD_SUBDIRECTORY( Python )
endif()

ADD_SUBDIRECTORY( TNL )

if( ${WITH_TOOLS} )
@@ -11,3 +7,7 @@ endif()
if( ${WITH_TESTS} )
   ADD_SUBDIRECTORY( UnitTests )
endif()

if( ${WITH_PYTHON} )
   ADD_SUBDIRECTORY( Python )
endif()
+19 −16
Original line number Diff line number Diff line
@@ -59,19 +59,22 @@ ADD_TEST( MeshEntityTest ${EXECUTABLE_OUTPUT_PATH}/MeshEntityTest${CMAKE_EXECUTA
#   SET( VTK_COMMON_LIBRARIES vtkCommonCore ; vtkIOLegacy )
#endif( VTK_FOUND )

# Mesh cannot be compiled by nvcc < 9 due to bugs in the compiler
if( ${BUILD_CUDA} AND ${CUDA_VERSION_MAJOR} GREATER_EQUAL 9 )
   CUDA_ADD_EXECUTABLE( MeshReaderTest MeshReaderTest.cu
                        OPTIONS ${CXX_TESTS_FLAGS} )
   TARGET_LINK_LIBRARIES( MeshReaderTest
                           ${GTEST_BOTH_LIBRARIES}
                           ${VTK_COMMON_LIBRARIES}
                           tnl )
else()
   ADD_EXECUTABLE( MeshReaderTest MeshReaderTest.cpp )
   TARGET_COMPILE_OPTIONS( MeshReaderTest PRIVATE ${CXX_TESTS_FLAGS} )
   TARGET_LINK_LIBRARIES( MeshReaderTest
                           ${GTEST_BOTH_LIBRARIES}
                           ${VTK_COMMON_LIBRARIES}
                           tnl )
endif()
## MeshReaderTest is not a unit test so we disable it, because it takes
## a long time to compile.
##
## Mesh cannot be compiled by nvcc < 9 due to bugs in the compiler
#if( ${BUILD_CUDA} AND ${CUDA_VERSION_MAJOR} GREATER_EQUAL 9 )
#   CUDA_ADD_EXECUTABLE( MeshReaderTest MeshReaderTest.cu
#                        OPTIONS ${CXX_TESTS_FLAGS} )
#   TARGET_LINK_LIBRARIES( MeshReaderTest
#                           ${GTEST_BOTH_LIBRARIES}
#                           ${VTK_COMMON_LIBRARIES}
#                           tnl )
#else()
#   ADD_EXECUTABLE( MeshReaderTest MeshReaderTest.cpp )
#   TARGET_COMPILE_OPTIONS( MeshReaderTest PRIVATE ${CXX_TESTS_FLAGS} )
#   TARGET_LINK_LIBRARIES( MeshReaderTest
#                           ${GTEST_BOTH_LIBRARIES}
#                           ${VTK_COMMON_LIBRARIES}
#                           tnl )
#endif()