Skip to content
Snippets Groups Projects
Select Git revision
  • 44351756e5e76fca0ece9b8e9744a702ee56ca21
  • develop default protected
  • feature/kinetic-schemes
  • feature/reconstruction
  • feature/local-dt-fsi
  • feature/composite-scheme-sources
  • feature/composite-scheme-other-fluxes
  • feature/serraille
  • feature/variational-hydro
  • feature/composite-scheme
  • hyperplastic
  • feature/polynomials
  • feature/gks
  • feature/implicit-solver-o2
  • feature/coupling_module
  • feature/implicit-solver
  • feature/merge-local-dt-fsi
  • master protected
  • feature/escobar-smoother
  • feature/hypoelasticity-clean
  • feature/hypoelasticity
  • v0.5.0 protected
  • v0.4.1 protected
  • v0.4.0 protected
  • v0.3.0 protected
  • v0.2.0 protected
  • v0.1.0 protected
  • Kidder
  • v0.0.4 protected
  • v0.0.3 protected
  • v0.0.2 protected
  • v0 protected
  • v0.0.1 protected
33 results

CMakeLists.txt

Blame
  • CMakeLists.txt 3.87 KiB
    cmake_minimum_required (VERSION 3.4)
    
    # CMake utils
    list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
    
    # Forbids in-source builds
    include(CheckNotInSources)
    
    #------------------------------------------------------
    #----------------- Main configuration -----------------
    #------------------------------------------------------
    
    project (Pastis
      VERSION 0.0.4)
    
    #------------------------------------------------------
    
    set(PASTIS_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
    set(PASTIS_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}")
    
    # Default build type is RelWIthDebInfo
    if(NOT CMAKE_BUILD_TYPE)
      set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
          "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
          FORCE)
    endif(NOT CMAKE_BUILD_TYPE)
    
    #------------------------------------------------------
    
    # Checks if compiler version is compatible with Pastis sources
    set(GNU_CXX_MIN_VERSION "7.0.0")
    set(CLANG_CXX_MIN_VERSION "5.0.0")
    
    # Pastis default compiler flags
    set(PASTIS_CXX_FLAGS "${PASTIS_CXX_FLAGS} -Wall")
    
    if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
      if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "${GNU_CXX_MIN_VERSION}")
        message(FATAL_ERROR "Pastis build requires at least g++-${GNU_CXX_MIN_VERSION}")
      endif()
    elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
      if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "${CLANG_CXX_MIN_VERSION}")
        message(FATAL_ERROR "Pastis build requires at least llvm/clang ++-${CLANG_CXX_MIN_VERSION}")
      endif()
      set(PASTIS_CXX_FLAGS "${PASTIS_CXX_FLAGS} -Wsign-compare -Wunused -Wunused-member-function -Wunused-private-field")
    endif()
    
    
    #------------------------------------------------------
    
    # setting Kokkos defaults to OpenMP when available
    include(FindOpenMP)
    if(${OPENMP_FOUND})
      set(KOKKOS_ENABLE_OPENMP ON CACHE BOOL "")
    endif()
    
    # Kokkso compiler flags
    add_subdirectory(${PASTIS_SOURCE_DIR}/packages/kokkos)
    include_directories(${Kokkos_INCLUDE_DIRS_RET})
    include(GetKokkosCompilerFlags)
    
    # sets Kokkos debug flags when non release build
    if (CMAKE_BUILD_TYPE MATCHES "Release")
      set (KOKKOS_ENABLE_DEBUG OFF)
    else()
      set (KOKKOS_ENABLE_DEBUG ON)
    endif()
    
    # C++ 17 flags
    if(${CMAKE_VERSION} VERSION_LESS "3.8.0")