Attention une mise à jour du serveur va être effectuée le lundi 17 mai entre 13h et 13h30. Cette mise à jour va générer une interruption du service de quelques minutes.

Commit 6ce08af3 authored by LACHAT Cedric's avatar LACHAT Cedric

Get last version of multigrid (which worked), Wed Oct 26 16:07:38 2016 +0000...

Get last version of multigrid (which worked), Wed Oct 26 16:07:38 2016 +0000 (local commit 7beddad5a4b)
parents
########################
# Main configuration #
########################
if (DEFINED ENV{JENKINS})
set(CMAKE_BUILD_TYPE $ENV{BUILD} CACHE STRING "toto" FORCE)
endif ()
cmake_minimum_required(VERSION 2.6.4)
if (NOT DEFINED FORTRAN_INTERFACE)
endif ()
if (FORTRAN_INTERFACE)
endif ()
if ((NOT DEFINED FORTRAN_INTERFACE) OR (FORTRAN_INTERFACE))
project(PAMPA C Fortran CXX)
else ()
project(PAMPA C CXX)
endif ()
# Add CTest
enable_testing()
# Add modules
include(CMakeDependentOption)
include(CheckSymbolExists)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeScripts)
set(CMAKE_Fortran_MODULE_DIRECTORY ${PROJECT_BINARY_DIR}/MOD)
# Define some variables which will be fill in with ccmake or cmake-gui
set(VALGRIND_EXE "/usr/bin/valgrind" CACHE TYPE "Valgrind with its path")
set(VALGRIND_ARGS "" CACHE TYPE "Valgrind arguments")
mark_as_advanced(VALGRIND_EXE VALGRIND_ARGS)
option(FORTRAN_INTERFACE "Build fortran interface to use PaMPA in fortran programs" OFF)
if (FORTRAN_INTERFACE)
add_definitions (-DNOT_DOXYGEN)
endif ()
# Temporary, to remove old configuration
if (DEFINED COMMON_PTHREAD)
unset (PTHREAD CACHE)
unset (COMMON_PTHREAD CACHE)
unset (PAMPA_PTHREAD CACHE)
endif ()
set (PTHREAD_LIST "None;IO;Comm;All")
set (PTHREAD "All" CACHE STRING "Pthread use level: possible values ${PTHREAD_LIST}")
set_property (CACHE PTHREAD PROPERTY STRINGS ${PTHREAD_LIST})
list (FIND PTHREAD_LIST ${PTHREAD} FND)
if (${FND} EQUAL -1)
message (FATAL_ERROR "Value for PTHREAD is not correct, you have to choose one item in the following list ${PTHREAD_LIST}")
endif ()
# Temporary, to remove old configuration
if (DEFINED COMM_MANUAL)
unset (COMM_MANUAL CACHE)
unset (COMM_TYPE CACHE)
endif ()
set (COMM_TYPE_LIST "Automatic;Point-to-point;Collective")
set (COMM_TYPE "Automatic" CACHE STRING "Communication type chosen to exhange data between subdomains: possible values ${COMM_TYPE_LIST}")
set_property (CACHE COMM_TYPE PROPERTY STRINGS ${COMM_TYPE_LIST})
list (FIND COMM_TYPE_LIST ${COMM_TYPE} FND)
if (${FND} EQUAL -1)
message (FATAL_ERROR "Value for COMM_TYPE is not correct, you have to choose one item in the following list ${COMM_TYPE_LIST}")
endif ()
if (COMM_TYPE STREQUAL "Point-to-point")
add_definitions (-DPAMPA_COMM_PTOP)
elseif (COMM_TYPE STREQUAL "Collective")
add_definitions (-DPAMPA_COMM_COLL)
endif ()
option (NETLOC "Netloc" ON)
if (NETLOC)
add_definitions (-DNETLOC)
set (NETLOC_HOME "" CACHE PATH "NETLOC home directory")
#find_package (NETLOC REQUIRED)
set (NETLOC_INCLUDE_DIR "")
set (NETLOC_LIBRARY "")
include_directories(${NETLOC_INCLUDE_DIR})
endif ()
option(PAMPA_RENAME "Rename internal function names" ON)
if (PAMPA_RENAME)
add_definitions (-DPAMPA_RENAME)
endif ()
option(PAMPA_ADAPT "Adapt functions" OFF)
if (PAMPA_ADAPT)
add_definitions (-DPAMPA_ADAPT)
endif ()
option(PAMPA_MULTILEVEL "Multilevel meshes" OFF)
option(COMMON_MEMORY_TRACE "Rename internal function names" OFF)
if (COMMON_MEMORY_TRACE)
add_definitions (-DCOMMON_MEMORY_TRACE)
endif ()
cmake_dependent_option(COMMON_MEMORY_USER_FILE "User file (defined as char PAMPA_memFilename[]) for memory logs" ON "COMMON_MEMORY_TRACE" OFF)
if (COMMON_MEMORY_USER_FILE)
add_definitions (-DCOMMON_MEMORY_USER_FILE)
endif ()
option(SAMPLES "Build samples" OFF)
if (SAMPLES)
set (SAMPLE_TYPE_LIST "All;Compounds;Units")
set (SAMPLE_TYPE "All" CACHE STRING "Choose which categories of samples: possible values ${SAMPLE_TYPE_LIST}")
set_property (CACHE SAMPLE_TYPE PROPERTY STRINGS ${SAMPLE_TYPE_LIST})
list (FIND SAMPLE_TYPE_LIST ${SAMPLE_TYPE} FND)
if (${FND} EQUAL -1)
message (FATAL_ERROR "Value for SAMPLE_TYPE is not correct, you have to choose one item in the following list ${SAMPLE_TYPE_LIST}")
endif ()
set (SAMPLE_PREFIX "pampa")
endif ()
option(PAMPA_BUILD_DOC "Build documentation for PaMPA" OFF)
option(PAMPA_BUILD_ALONE "Build PaMPA in one build folder" OFF)
mark_as_advanced(PAMPA_BUILD_DOC PAMPA_BUILD_ALONE)
#######################
# Find some libraries #
#######################
if (COMMON_COMPRESSION)
# BZIP2
find_package (BZip2)
message (STATUS "bzip2: ${BZIP2_FOUND}")
if (BZIP2_FOUND)
add_definitions (-DCOMMON_FILE_COMPRESS_BZ2)
include_directories(${BZIP2_INCLUDE_DIR})
#list (APPEND PAMPA_DEPENDENCIES ${BZIP2_LIBRARIES})
list (APPEND PAMPA_DEPENDENCIES ${BZIP2_LIBRARY} ${BZIP2_LIBRARIES})
endif (BZIP2_FOUND)
endif (COMMON_COMPRESSION)
# MMG3D4
option (PAMPA_MMG3D4 "Build PaMPA-MMG3D4 library" OFF)
cmake_dependent_option(PAMPA_MMG3D4_SCOTCH "If MMG3D4 is built with Scotch" ON "PAMPA_MMG3D4" OFF)
if (PAMPA_MMG3D4)
add_definitions (-DMMG3D4)
set (MMG3D4_HOME ${MMG3D4_HOME-INT} CACHE PATH "MMG3D4 home directory")
set (MMG3D4_LIBNAME ${MMG3D4_LIBNAME-INT} CACHE STRING "MMG3D4 library name")
find_package (MMG3D4 REQUIRED)
set(CMAKE_REQUIRED_INCLUDES ${MMG3D4_INCLUDE_DIR})
##set (CMAKE_REQUIRED_DEFINITIONS -DMMG3D4_REQUIRED)
#set (HAVE_MMG3D4_H "HAVE_MMG3D4_H")
#check_symbol_exists (MMG3D4_REQUIRED libmmg3d4.h HAVE_MMG3D4_H)
#if (NOT HAVE_MMG3D4_H)
# message (FATAL_ERROR " MMG3D4 wat not compiled with MMG3D4_REQUIRED option")
#endif ()
else ()
unset (MMG3D4_HOME CACHE)
unset (MMG3D4_LIBNAME CACHE)
endif ()
# MMG3D5
option (PAMPA_MMG3D5 "Build PaMPA-MMG3D5 library" OFF)
cmake_dependent_option(PAMPA_MMG3D5_SCOTCH "If MMG3D5 is built with Scotch" ON "PAMPA_MMG3D5" OFF)
if (PAMPA_MMG3D5)
add_definitions (-DMMG3D5)
set (MMG3D5_HOME ${MMG3D5_HOME-INT} CACHE PATH "MMG3D5 home directory")
set (MMG3D5_LIBNAME ${MMG3D5_LIBNAME-INT} CACHE STRING "MMG3D5 library name")
find_package (MMG3D5 REQUIRED)
else ()
unset (MMG3D5_HOME CACHE)
unset (MMG3D5_LIBNAME CACHE)
endif ()
# MMG3D
option (PAMPA_MMG3D "Build PaMPA-MMG3D library" OFF)
cmake_dependent_option(PAMPA_MMG3D_SCOTCH "If MMG3D is built with Scotch" ON "PAMPA_MMG3D" OFF)
if (PAMPA_MMG3D)
add_definitions (-DMMG3D)
set (MMG3D_HOME ${MMG3D_HOME-INT} CACHE PATH "MMG3D home directory")
set (MMG3D_LIBNAME ${MMG3D_LIBNAME-INT} CACHE STRING "MMG3D library name")
find_package (MMG3D REQUIRED)
else ()
unset (MMG3D_HOME CACHE)
unset (MMG3D_LIBNAME CACHE)
endif ()
# MSHINT
option (PAMPA_MSHINT "Build PaMPA-MSHINT library" OFF)
if (PAMPA_MSHINT)
add_definitions (-DMSHINT)
set (MSHINT_HOME ${MSHINT_HOME-INT} CACHE PATH "MSHINT home directory")
set (MSHINT_LIBNAME ${MSHINT_LIBNAME-INT} CACHE STRING "MSHINT library name")
find_package (MSHINT REQUIRED)
set (LIBMESH5_HOME ${LIBMESH5_HOME-INT} CACHE PATH "LIBMESH5 home directory")
set (LIBMESH5_LIBNAME ${LIBMESH5_LIBNAME-INT} CACHE STRING "LIBMESH5 library name")
find_package (LIBMESH5 REQUIRED)
else ()
unset (MSHINT_HOME CACHE)
unset (MSHINT_LIBNAME CACHE)
unset (LIBMESH5_HOME CACHE)
unset (LIBMESH5_LIBNAME CACHE)
endif ()
# TETGEN
option (PAMPA_TETGEN "Build PaMPA-TETGEN library" OFF)
if (PAMPA_TETGEN)
add_definitions (-DTETGEN -DTETLIBRARY)
set (TETGEN_HOME ${TETGEN_HOME-INT} CACHE PATH "TETGEN home directory")
set (TETGEN_LIBNAME ${TETGEN_LIBNAME-INT} CACHE STRING "TETGEN library name")
find_package (TETGEN REQUIRED)
set(CMAKE_REQUIRED_INCLUDES ${TETGEN_INCLUDE_DIR})
else ()
unset (TETGEN_HOME CACHE)
unset (TETGEN_LIBNAME CACHE)
endif ()
# AEROSOL
option (PAMPA_AEROSOL "Build PaMPA-AEROSOL library" OFF)
if (PAMPA_AEROSOL)
add_definitions (-DAEROSOL)
set (AEROSOL_HOME ${AEROSOL_HOME-INT} CACHE PATH "AEROSOL home directory")
find_package (AEROSOL REQUIRED)
else ()
unset (AEROSOL_HOME CACHE)
endif ()
# PT-Scotch
option (PTSCOTCH "Build PaMPA with PT-Scotch dependencies" ON)
if (PTSCOTCH)
add_definitions (-DPTSCOTCH)
set(PTSCOTCH_HOME "" CACHE PATH "PT-Scotch home directory")
find_package(PTSCOTCH REQUIRED)
include_directories(${PTSCOTCH_INCLUDE_DIR})
else ()
unset (PTSCOTCH_HOME CACHE)
endif ()
# MPI
set(MPI_COMPILER mpicc)
find_package(MPI REQUIRED)
include_directories(${MPI_INCLUDE_PATH})
if (MPI_C_LIBRARIES)
list (APPEND PAMPA_DEPENDENCIES ${MPI_C_LIBRARIES} m)
else ()
list (APPEND PAMPA_DEPENDENCIES ${MPI_LIBRARIES} m)
endif ()
if (PAMPA_BUILD_ALONE)
include_directories(${PAMPA_SOURCE_DIR}/include)
endif ()
# Pthread
if (NOT PTHREAD STREQUAL "None")
find_package(Threads REQUIRED)
if (NOT CMAKE_USE_PTHREADS_INIT) # if pthread was not found
message (FATAL_ERROR "Pthread are not available")
endif()
if (PTHREAD STREQUAL "IO" OR PTHREAD STREQUAL "All")
add_definitions(-DCOMMON_PTHREAD)
endif ()
if (PTHREAD STREQUAL "Comm" OR PTHREAD STREQUAL "All")
add_definitions(-DPAMPA_PTHREAD)
endif ()
list (APPEND PAMPA_DEPENDENCIES ${CMAKE_THREAD_LIBS_INIT})
endif ()
# Define PaMPA version
set(PAMPA_VERSION "1")
set(PAMPA_RELEASE "0")
set(PAMPA_PATCHLEVEL "0")
# Add some flags
add_definitions(-DPAMPA_VERSION=${PAMPA_VERSION} -DPAMPA_RELEASE=${PAMPA_RELEASE}
-DPAMPA_PATCHLEVEL=${PAMPA_PATCHLEVEL} -Drestrict=__restrict)
# Check CMake version
if (${CMAKE_VERSION} VERSION_LESS 2.8.4)
set (OLD_CMAKE 1)
endif ()
set (LIBRARY_OUTPUT_DIRECTORY ${PAMPA_SOURCE_DIR}/pampa_lib)
# SCM Version Option
option (SCM_VERSIONS "Get SCM Versions for softwares" OFF)
if (SCM_VERSIONS)
add_definitions(-DSCM_VERSIONS)
if (PTSCOTCH)
set(SCM_PTSCOTCH_HOME "" CACHE PATH "SCM PT-Scotch path")
list(APPEND VERSIONS_EXT_ARGS
PTSCOTCH:${SCM_PTSCOTCH_HOME}:${PTSCOTCH_LIBRARY},${SCOTCH_LIBRARY},${PTSCOTCH_EXTRA_LIBRARY})
list(APPEND VERSIONS_EXT_DEPS
${PTSCOTCH_LIBRARY} ${SCOTCH_LIBRARY} ${PTSCOTCH_EXTRA_LIBRARY})
endif ()
if (PAMPA_MMG3D4)
set(SCM_MMG3D4_HOME "" CACHE PATH "SCM MMG3D4 path")
list(APPEND VERSIONS_EXT_ARGS
MMG3D4:${SCM_MMG3D4_HOME}:${MMG3D4_LIBRARY})
list(APPEND VERSIONS_EXT_DEPS
${MMG3D4_LIBRARY})
endif ()
if (PAMPA_MMG3D5)
set(SCM_MMG3D5_HOME "" CACHE PATH "SCM MMG3D5 path")
list(APPEND VERSIONS_EXT_ARGS
MMG3D5:${SCM_MMG3D5_HOME}:${MMG3D5_LIBRARY})
list(APPEND VERSIONS_EXT_DEPS
${MMG3D5_LIBRARY})
endif ()
if (PAMPA_MMG3D)
set(SCM_MMG3D_HOME "" CACHE PATH "SCM MMG3D path")
list(APPEND VERSIONS_EXT_ARGS
MMG3D:${SCM_MMG3D_HOME}:${MMG3D_LIBRARY})
list(APPEND VERSIONS_EXT_DEPS
${MMG3D_LIBRARY})
endif ()
if (PAMPA_AEROSOL)
set(SCM_AEROSOL_HOME "" CACHE PATH "SCM Aerosol path")
list(APPEND VERSIONS_EXT_ARGS
AEROSOL:${SCM_AEROSOL_HOME}:${AEROSOL_COMMON_LIBRARY},${AEROSOL_MESH_LIBRARY},${AEROSOL_IO_LIBRARY})
list(APPEND VERSIONS_EXT_DEPS
${AEROSOL_COMMON_LIBRARY} ${AEROSOL_MESH_LIBRARY} ${AEROSOL_IO_LIBRARY})
endif ()
endif ()
option(COMMON_COMPRESSION "Build with founded compression libraries (CMake will search automatically which are availables" ON)
########################
# tests #
########################
if (CMAKE_VERSION VERSION_GREATER "2.8.11")
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test2.c "
#include <stdio.h>
#include <stdlib.h>
#ifdef EXT
extern
#endif
inline void f() {
}
")
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test.c "
#include <stdio.h>
#include <stdlib.h>
int main() {
f();
return 0;
}
")
try_compile(TEST_INLINE ${CMAKE_CURRENT_BINARY_DIR}/test
SOURCES ${CMAKE_CURRENT_BINARY_DIR}/test.c ${CMAKE_CURRENT_BINARY_DIR}/test2.c
)
if (NOT TEST_INLINE)
try_compile(TEST_INLINE ${CMAKE_CURRENT_BINARY_DIR}/test2
SOURCES ${CMAKE_CURRENT_BINARY_DIR}/test.c ${CMAKE_CURRENT_BINARY_DIR}/test2.c
COMPILE_DEFINITIONS -DEXT
)
if (NOT TEST_INLINE)
message (FATAL_ERROR "internal error")
else ()
add_definitions (-DPAMPA_WORD_EXTERN)
endif ()
endif ()
else (CMAKE_VERSION VERSION_GREATER "2.8.11")
if (CMAKE_C_COMPILER MATCHES "gcc") # XXX Is-it just for gcc?
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test.c "
#include <stdio.h>
#include <stdlib.h>
extern
inline void f() {
}
int main() {
f();
return 0;
}
")
try_compile(TEST_INLINE ${CMAKE_CURRENT_BINARY_DIR}/test
${CMAKE_CURRENT_BINARY_DIR}/test.c
)
if (TEST_INLINE)
add_definitions (-DPAMPA_WORD_EXTERN)
endif ()
endif (CMAKE_C_COMPILER MATCHES "gcc")
endif (CMAKE_VERSION VERSION_GREATER "2.8.11")
########################
# libpampa #
########################
add_subdirectory(${PAMPA_SOURCE_DIR}/src/libpampa)
# Add dependency on PT-Scotch
if (PTSCOTCH)
list (APPEND PAMPA_DEPENDENCIES ${PTSCOTCH_LIBRARY})
list (APPEND PAMPA_DEPENDENCIES ${SCOTCH_LIBRARY})
list (APPEND PAMPA_DEPENDENCIES ${PTSCOTCH_EXTRA_LIBRARY})
endif ()
########################
# libpampa-mmg3d4 #
########################
if (PAMPA_MMG3D4)
add_subdirectory (${PAMPA_SOURCE_DIR}/src/remeshers/mmg3d/libpampa-mmg3d4)
endif ()
########################
# libpampa-mmg3d5 #
########################
if (PAMPA_MMG3D5)
add_subdirectory (${PAMPA_SOURCE_DIR}/src/remeshers/mmg3d/libpampa-mmg3d5)
endif ()
########################
# libpampa-mmg3d #
########################
if (PAMPA_MMG3D)
add_subdirectory (${PAMPA_SOURCE_DIR}/src/remeshers/mmg3d/libpampa-mmg3d)
endif ()
########################
# libpampa-mshint #
########################
if (PAMPA_MSHINT)
add_subdirectory (${PAMPA_SOURCE_DIR}/src/interpolators/mshint/libpampa-mshint)
endif ()
########################
# libpampa-tetgen #
########################
if (PAMPA_TETGEN)
add_subdirectory (${PAMPA_SOURCE_DIR}/src/remeshers/tetgen/libpampa-tetgen)
endif ()
##########################
# libpampa-aerosol #
##########################
if (PAMPA_AEROSOL)
# Add dependency on Aerosol
include_directories (${AEROSOL_INCLUDE_DIR})
find_package(LibXml2 REQUIRED)
include_directories( ${LIBXML2_INCLUDE_DIR} )
list (APPEND AEROSOL_DEPENDENCIES ${AEROSOL_COMMON_LIBRARY} ${AEROSOL_MESH_LIBRARY} ${AEROSOL_IO_LIBRARY} ${LIBXML2_LIBRARIES})
add_subdirectory (${PAMPA_SOURCE_DIR}/src/libpampa-aerosol)
endif ()
########################
# samples #
########################
if (SAMPLES)
add_subdirectory(${PAMPA_SOURCE_DIR}/src/samples)
endif ()
########################
# executables #
########################
add_subdirectory(${PAMPA_SOURCE_DIR}/src/pampa)
########################
# tests #
########################
# Add target on Unix
if(UNIX)
add_custom_target(all_and_test COMMAND make all COMMAND ctest --force-new-ctest-process --output-on-failure)
endif(UNIX)
########################
# real clean #
########################
if(UNIX)
if (PAMPA_BUILD_ALONE)
add_custom_target(realclean
COMMAND make clean
COMMAND ${CMAKE_COMMAND} -E remove ${PAMPA_SOURCE_DIR}/include/*
COMMAND ${CMAKE_COMMAND} -E remove ${PAMPA_SOURCE_DIR}/lib/*
)
else ()
add_custom_target(realclean
COMMAND make clean
)
endif ()
endif(UNIX)
########################
# install #
########################
install(FILES ${PTSCOTCH_INCLUDE_DIR}/ptscotch.h DESTINATION include)
install(FILES ${PTSCOTCH_LIBRARY} ${PTSCOTCH_EXTRA_LIBRARY} DESTINATION lib)
########################
# uninstall #
########################
# uninstall target
configure_file(
"${PAMPA_SOURCE_DIR}/src/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
########################
# documentation #
########################
if (PAMPA_BUILD_DOC)
if (EXISTS ${PAMPA_SOURCE_DIR}/docs/CMakeLists.txt)
add_subdirectory(${PAMPA_SOURCE_DIR}/docs)
endif()
endif ()
if (NOT ${AEROSOL_PATH} STREQUAL ${AEROSOL_HOME})
set (AEROSOL_IO_LIBRARY "NOTFOUND")
set (AEROSOL_MESH_LIBRARY "NOTFOUND")
set (AEROSOL_COMMON_LIBRARY "NOTFOUND")
set (AEROSOL_INCLUDE_DIR "NOTFOUND")
endif ()
set (AEROSOL_PATH ${AEROSOL_HOME} CACHE INTERNAL "")
find_path (AEROSOL_INCLUDE_DIR common/Defines.hpp HINTS ${AEROSOL_PATH} PATH_SUFFIXES include)
find_library (AEROSOL_IO_LIBRARY NAMES IO HINTS ${AEROSOL_PATH} PATH_SUFFIXES lib)
find_library (AEROSOL_MESH_LIBRARY NAMES Mesh HINTS ${AEROSOL_PATH} PATH_SUFFIXES lib)
find_library (AEROSOL_COMMON_LIBRARY NAMES Common HINTS ${AEROSOL_PATH} PATH_SUFFIXES lib)
if (AEROSOL_INCLUDE_DIR AND AEROSOL_IO_LIBRARY AND AEROSOL_MESH_LIBRARY AND AEROSOL_COMMON_LIBRARY)
set (AEROSOL_FOUND TRUE)
endif ()
if (AEROSOL_FOUND)
if (NOT AEROSOL_FIND_QUIETLY)
message (STATUS "Found AEROSOL : ${AEROSOL_IO_LIBRARY}")
endif (NOT AEROSOL_FIND_QUIETLY)
else (AEROSOL_FOUND)
if (AEROSOL_FIND_REQUIRED)
message (FATAL_ERROR "Could not find AEROSOL. You have to define variable AEROSOL_HOME")
endif (AEROSOL_FIND_REQUIRED)
endif (AEROSOL_FOUND)