diff --git a/.gitmodules b/.gitmodules index b371272de..3e89e65e4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,18 +1,15 @@ [submodule "extra_packages/extra-materials"] path = extra_packages/extra-materials url = git@lsmssrv1.epfl.ch:akantu-extra-materials.git [submodule "extra_packages/igfem"] path = extra_packages/igfem url = git@lsmssrv1.epfl.ch:akantu-igfem.git [submodule "extra_packages/parallel-cohesive-element"] path = extra_packages/parallel-cohesive-element url = git@lsmssrv1.epfl.ch:akantu-parallel-cohesive.git -[submodule "extra_packages/traction-at-split-node-contact"] - path = extra_packages/traction-at-split-node-contact - url = git@lsmssrv1.epfl.ch:akantu-traction-at-split-node-contact.git [submodule "extra_packages/students-extra-package"] path = extra_packages/students-extra-package url = git@lsmssrv1.epfl.ch:students-extra-package.git [submodule "extra_packages/phase-field"] path = extra_packages/phase-field url = git@lsmssrv1.epfl.ch:akantu-phase-field.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 883cb33a6..7706eb866 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,194 +1,194 @@ #=============================================================================== # @file CMakeLists.txt # # @author Guillaume Anciaux # @author Nicolas Richart # # @date creation: Mon Jun 14 2010 # @date last modification: Mon Jan 18 2016 # # @brief main configuration file # # @section LICENSE # # Copyright (©) 2010-2012, 2014, 2015 EPFL (Ecole Polytechnique Fédérale de # Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des # Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # # @section DESCRIPTION #------------------------------------------------------------------------------- # _ _ # | | | | # __ _| | ____ _ _ __ | |_ _ _ # / _` | |/ / _` | '_ \| __| | | | # | (_| | < (_| | | | | |_| |_| | # \__,_|_|\_\__,_|_| |_|\__|\__,_| # #=============================================================================== #=============================================================================== # CMake Project #=============================================================================== cmake_minimum_required(VERSION 2.8.12) # add this options before PROJECT keyword set(CMAKE_DISABLE_SOURCE_CHANGES ON) set(CMAKE_DISABLE_IN_SOURCE_BUILD ON) project(Akantu) enable_language(CXX) #=============================================================================== # Misc. config for cmake #=============================================================================== set(AKANTU_CMAKE_DIR "${PROJECT_SOURCE_DIR}/cmake") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/Modules") set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries.") mark_as_advanced(BUILD_SHARED_LIBS) if(NOT AKANTU_TARGETS_EXPORT) set(AKANTU_TARGETS_EXPORT AkantuLibraryDepends) endif() include(CMakeVersionGenerator) include(CMakePackagesSystem) include(CMakeFlagsHandling) include(AkantuPackagesSystem) include(AkantuMacros) #cmake_activate_debug_message() #=============================================================================== # Version Number #=============================================================================== # AKANTU version number. An even minor number corresponds to releases. set(AKANTU_MAJOR_VERSION 2) set(AKANTU_MINOR_VERSION 3) set(AKANTU_PATCH_VERSION 0) define_project_version() #=============================================================================== # Options #=============================================================================== # Debug set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -DAKANTU_NDEBUG" CACHE STRING "Flags used by the compiler during release builds" FORCE) add_flags(cxx "-Wall -Wextra") #Profiling set(CMAKE_CXX_FLAGS_PROFILING "-g -pg -DNDEBUG -DAKANTU_NDEBUG -O2" CACHE STRING "Flags used by the compiler during profiling builds") set(CMAKE_C_FLAGS_PROFILING "-g -pg -DNDEBUG -DAKANTU_NDEBUG -O2" CACHE STRING "Flags used by the compiler during profiling builds") set(CMAKE_Fortran_FLAGS_PROFILING "-g -pg -DNDEBUG -DAKANTU_NDEBUG -O2" CACHE STRING "Flags used by the compiler during profiling builds") set(CMAKE_EXE_LINKER_FLAGS_PROFILING "-pg" CACHE STRING "Flags used by the linker during profiling builds") set(CMAKE_SHARED_LINKER_FLAGS_PROFILING "-pg" CACHE STRING "Flags used by the linker during profiling builds") mark_as_advanced( CMAKE_CXX_FLAGS_PROFILING CMAKE_C_FLAGS_PROFILING CMAKE_Fortran_FLAGS_PROFILING CMAKE_EXE_LINKER_FLAGS_PROFILING CMAKE_SHARED_LINKER_FLAGS_PROFILING ) #=============================================================================== # Dependencies #=============================================================================== declare_akantu_types() package_list_packages(${PROJECT_SOURCE_DIR}/packages EXTRA_PACKAGES_FOLDER ${PROJECT_SOURCE_DIR}/extra_packages NO_AUTO_COMPILE_FLAGS) ## meta option \todo better way to do it when multiple package give enable the ## same feature if(AKANTU_SCOTCH) set(AKANTU_PARTITIONER ON) else() set(AKANTU_PARTITIONER OFF) endif() if(AKANTU_MUMPS) set(AKANTU_SOLVER ON) else() set(AKANTU_SOLVER OFF) endif() #=============================================================================== # Akantu library #=============================================================================== add_subdirectory(src) #=============================================================================== # Documentation #=============================================================================== if(AKANTU_DOCUMENTATION_DOXYGEN OR AKANTU_DOCUMENTATION_MANUAL) add_subdirectory(doc) else() set(AKANTU_DOC_EXCLUDE_FILES "${PROJECT_SOURCE_DIR}/doc/manual" CACHE INTERNAL "") endif() #=============================================================================== # Examples and tests #=============================================================================== option(AKANTU_EXAMPLES "Activate examples" OFF) option(AKANTU_TESTS "Activate tests" OFF) include(AkantuTestsMacros) include(AkantuExampleMacros) if(AKANTU_EXAMPLES OR AKANTU_TESTS) - option(AKANTU_BUILD_ALL_TESTS "Build all tests") + option(AKANTU_BUILD_ALL_TESTS "Build all tests" ON) find_package(GMSH REQUIRED) endif() if(AKANTU_EXAMPLES) add_subdirectory(examples) endif() # tests add_test_tree(test) #=============================================================================== # Python interface #=============================================================================== package_is_activated(python_interface _python_act) if(_python_act) if(IS_ABSOLUTE "${CMAKE_INSTALL_PREFIX}") set(AKANTU_PYTHON_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}) else() set(AKANTU_PYTHON_INSTALL_PREFIX "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PREFIX}") endif() add_subdirectory(python) endif() #=============================================================================== # Install and Packaging #=============================================================================== include(AkantuInstall) option(AKANTU_DISABLE_CPACK "This option commands the generation of extra info for the \"make package\" target" ON) mark_as_advanced(AKANTU_DISABLE_CPACK) if(NOT AKANTU_DISABLE_CPACK) include(AkantuCPack) endif() diff --git a/cmake/AkantuCPack.cmake b/cmake/AkantuCPack.cmake index 216e74f62..b38db5215 100644 --- a/cmake/AkantuCPack.cmake +++ b/cmake/AkantuCPack.cmake @@ -1,129 +1,129 @@ #=============================================================================== # @file AkantuCPack.cmake # # @author Nicolas Richart # # @date creation: Wed Oct 17 2012 # @date last modification: Mon Jan 18 2016 # # @brief Configure the packaging system # # @section LICENSE # # Copyright (©) 2010-2012, 2014, 2015 EPFL (Ecole Polytechnique Fédérale de # Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des # Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== set(PACKAGE_FILE_NAME "akantu" CACHE STRING "Name of package to be generated") mark_as_advanced(PACKAGE_FILE_NAME) set(CPACK_SOURCE_GENERATOR "TGZ;TBZ2") if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows") set(CPACK_GENERATOR "TGZ;DEB") else() set(CPACK_GENERATOR "TGZ;NSIS") package_get_all_external_informations( _external_include_dirs _external_libraries ) set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS ${_external_libraries}) include(InstallRequiredSystemLibraries) endif() if(CMAKE_SYSTEM_PROCESSOR MATCHES "i.86" OR CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "[aA][mM][dD]64") if(CMAKE_SIZEOF_VOID_P EQUAL 8) set(_arch "amd64") else() set(_arch "i386") endif() elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc") set(_arch "powerpc") else() set(_arch "unknown") endif() if(WIN32 AND MINGW) set(_arch "mingw32") endif() # General configuration set(CPACK_PACKAGE_VENDOR "LSMS") set(CPACK_PACKAGE_FILE_NAME "${PACKAGE_FILE_NAME}-${AKANTU_VERSION}-${_arch}") set(CPACK_PACKAGE_VERSION "${AKANTU_VERSION}") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A multipurpose finite element library, Akantu") set(CPACK_PACKAGE_NAME "akantu") #set(CMAKE_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/cmake/akantu.ico") # Debian config package package_get_all_package_system_dependency(deb _deb_deps) package_get_all_package_system_dependency(deb-src _deb_src_deps) set(CPACK_DEBIAN_PACKAGE_MAINTAINER "nicolas.richart@epfl.ch, guillaume.anciaux@epfl.ch") set(CPACK_DEBIAN_PACKAGE_SECTION "Science") set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${_arch}" CACHE STRING "Architecture of akantu's package") set(CPACK_DEBIAN_PACKAGE_DEPENDS "${_deb_deps}") set(CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDSS "${_deb_src_deps}") mark_as_advanced(CPACK_DEBIAN_PACKAGE_ARCHITECTURE) # RPM package configuration #set(CPACK_RPM_PACKAGE_REQUIRES "${${_project}_PACKAGE_SYSTEM_DEBIAN_PACKAGE_DEPENDS}") # NSIS Windows installer #set(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}/cmake/akantu.ico") #set(CPACK_NSIS_CONTACT "akantu@akantu.ch") #set(CPACK_NSIS_MODIFY_PATH ON) # Components description set(CPACK_COMPONENTS_ALL lib dev bin python) set(CPACK_COMPONENT_LIB_DISPLAY_NAME "Libraries") set(CPACK_COMPONENT_BIN_DISPLAY_NAME "Examples") set(CPACK_COMPONENT_PYTHON_DISPLAY_NAME "Python interface") set(CPACK_COMPONENT_DEV_DISPLAY_NAME "C++ Headers") set(CPACK_COMPONENT_DEV_DEPENDS lib) set(CPACK_COMPONENT_BIN_DEPENDS lib) set(CPACK_COMPONENT_PYTHON_DEPENDS lib) set(CPACK_COMPONENT_LIB_DESCRIPTION "Akantu libraries") set(CPACK_COMPONENT_DEV_DESCRIPTION "Akantu C/C++ header files") set(CPACK_COMPONENT_LIB_GROUP "Akantu Libraries and Executables") set(CPACK_COMPONENT_BIN_GROUP "Akantu Libraries and Executables") set(CPACK_COMPONENT_PYTHON_GROUP "Akantu Libraries and Executables") set(CPACK_COMPONENT_DEV_GROUP "Development") set(CPACK_SOURCE_PACKAGE_FILE_NAME "${PACKAGE_FILE_NAME}-${AKANTU_VERSION}-src") set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/COPYING") include(AkantuCPackMacros) generate_cpack_ignore_list(CPACK_SOURCE_IGNORE_FILES) # for debug -#foreach(_file ${CPACK_SOURCE_IGNORE_FILES}) -# message("IGNORE ${_file}") -#endforeach() +foreach(_file ${CPACK_SOURCE_IGNORE_FILES}) + message("IGNORE ${_file}") +endforeach() list(APPEND CPACK_SOURCE_IGNORE_FILES "/.*build.*/" "/CVS/" "/\\\\.svn/" "/\\\\.bzr/" "/\\\\.hg/" "/\\\\.hgignore" "/\\\\.git/" "/\\\\.idea/" "\\\\.swp$" "\\\\.#" "/#" "~") include(CPack) diff --git a/cmake/AkantuExampleMacros.cmake b/cmake/AkantuExampleMacros.cmake index b8fa19713..a1b80e0af 100644 --- a/cmake/AkantuExampleMacros.cmake +++ b/cmake/AkantuExampleMacros.cmake @@ -1,86 +1,86 @@ #=============================================================================== # @file AkantuExampleMacros.cmake # # @author Guillaume Anciaux # @author Nicolas Richart # # @date creation: Mon Jan 18 2016 # # @brief macros for examples # # @section LICENSE # # Copyright (©) 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) Laboratory # (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # # @section DESCRIPTION # #=============================================================================== include(AkantuSimulationMacros) # ============================================================================== function(register_example example_name) _add_akantu_simulation(${example_name} ${ARGN} LIST_FILES _example_files) if(DEFINED _add_examples_pkg) package_add_to_variable(EXAMPLES_FILES ${_add_examples_pkg} ${_example_files}) endif() endfunction() # ============================================================================== function(add_example et_name desc) string(TOUPPER ${et_name} upper_name) - if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${et_name} AND _activated) + if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${et_name}) message(FATAL_ERROR "The folder ${CMAKE_CURRENT_SOURCE_DIR}/${et_name} " "that you try to register as an example sub-folder, does not exists.") endif() cmake_parse_arguments(_manage_example "" "" "PACKAGE" ${ARGN} ) if(_manage_example_PACKAGE) set(_act TRUE) foreach(_pkg ${_manage_example_PACKAGE}) package_is_activated(${_pkg} _activated) if(NOT _activated) set(_act FALSE) endif() endforeach() else() message(SEND_ERROR "Examples should be associated to a package") endif() if(${_act}) if(DEFINED _add_examples_pkg) set(_save_add_examples_pkg ${_add_examples_pkg}) endif() list(GET _manage_example_PACKAGE 0 _pkg) set(_add_examples_pkg ${_pkg}) add_subdirectory(${et_name}) unset(_add_examples_pkg) if(DEFINED _save_add_examples_pkg) set(_add_examples_pkg ${_save_add_examples_pkg}) unset(_save_add_examples_pkg) endif() endif() endfunction() diff --git a/cmake/AkantuInstall.cmake b/cmake/AkantuInstall.cmake index 8e714db1f..147d58fd1 100644 --- a/cmake/AkantuInstall.cmake +++ b/cmake/AkantuInstall.cmake @@ -1,143 +1,154 @@ #=============================================================================== # @file AkantuInstall.cmake # # @author Nicolas Richart # # @date creation: Wed Oct 17 2012 # @date last modification: Mon Jan 18 2016 # # @brief Create the files that allows users to link with Akantu in an other # cmake project # # @section LICENSE # # Copyright (©) 2010-2012, 2014, 2015 EPFL (Ecole Polytechnique Fédérale de # Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des # Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== #=============================================================================== # Config gen for external packages #=============================================================================== configure_file(cmake/AkantuBuildTreeSettings.cmake.in "${PROJECT_BINARY_DIR}/AkantuBuildTreeSettings.cmake" @ONLY) file(WRITE "${PROJECT_BINARY_DIR}/AkantuConfigInclude.cmake" " #=============================================================================== # @file AkantuConfigInclude.cmake # @author Nicolas Richart # @date Fri Jun 11 09:46:59 2010 # # @section LICENSE # # Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # # @section DESCRIPTION # #=============================================================================== ") package_get_all_packages(_package_list) foreach(_pkg_name ${_package_list}) # package_pkg_name(${_option} _pkg_name) _package_is_activated(${_pkg_name} _acctivated) _package_get_real_name(${_pkg_name} _real_name) string(TOUPPER ${_real_name} _real_pkg_name) file(APPEND "${PROJECT_BINARY_DIR}/AkantuConfigInclude.cmake" " set(AKANTU_HAS_${_real_pkg_name} ${_acctivated})") _package_get_libraries(${_pkg_name} _libs) if(_libs) file(APPEND "${PROJECT_BINARY_DIR}/AkantuConfigInclude.cmake" " set(AKANTU_${_real_pkg_name}_LIBRARIES ${_libs})") endif() _package_get_include_dir(${_pkg_name} _incs) if(_incs) file(APPEND "${PROJECT_BINARY_DIR}/AkantuConfigInclude.cmake" " set(AKANTU_${_real_pkg_name}_INCLUDE_DIR ${_incs}) ") endif() _package_get_compile_flags(${_pkg_name} CXX _compile_flags) if(_compile_flags) file(APPEND "${PROJECT_BINARY_DIR}/AkantuConfigInclude.cmake" " set(AKANTU_${_real_pkg_name}_COMPILE_CXX_FLAGS ${_compile_flags}) ") endif() endforeach() file(APPEND "${PROJECT_BINARY_DIR}/AkantuConfigInclude.cmake" " ") file(APPEND "${PROJECT_BINARY_DIR}/AkantuConfigInclude.cmake" " set(AKANTU_EXTRA_CXX_FLAGS \"${AKANTU_EXTRA_CXX_FLAGS}\") ") # Create the AkantuConfig.cmake and AkantuConfigVersion files get_filename_component(CONF_REL_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}" ABSOLUTE) configure_file(cmake/AkantuConfig.cmake.in "${PROJECT_BINARY_DIR}/AkantuConfig.cmake" @ONLY) configure_file(cmake/AkantuConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/AkantuConfigVersion.cmake" @ONLY) configure_file(cmake/AkantuUse.cmake "${PROJECT_BINARY_DIR}/AkantuUse.cmake" COPYONLY) +configure_file(cmake/akantu_environement.sh.in ${PROJECT_BINARY_DIR}/akantu_environement.sh @ONLY) +configure_file(cmake/akantu_environement.csh.in ${PROJECT_BINARY_DIR}/akantu_environement.csh @ONLY) + + +configure_file(cmake/akantu_install_environement.sh.in ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/akantu_environement.sh @ONLY) +configure_file(cmake/akantu_install_environement.csh.in ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/akantu_environement.csh @ONLY) + +install(FILES + ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/akantu_environement.sh + ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/akantu_environement.csh + DESTINATION share/akantu${AKANTU_VERSION}) # include(CMakePackageConfigHelpers) # configure_package_config_file(cmake/AkantuConfig.cmake.in ${PROJECT_BINARY_DIR}/AkantuConfig.cmake # INSTALL_DESTINATION "${CONF_REL_INCLUDE_DIR}lib/akantu/cmake" # PATH_VARS "${CONF_REL_INCLUDE_DIR}/include" ) # write_basic_package_version_file(${PROJECT_BINARY_DIR}/AkantuConfigVersion.cmake # VERSION "${AKANTU_VERSION}" # COMPATIBILITY SameMajorVersion) # Install the export set for use with the install-tree install(FILES ${PROJECT_BINARY_DIR}/AkantuConfig.cmake ${PROJECT_BINARY_DIR}/AkantuConfigInclude.cmake ${PROJECT_BINARY_DIR}/AkantuConfigVersion.cmake ${PROJECT_SOURCE_DIR}/cmake/AkantuUse.cmake ${PROJECT_SOURCE_DIR}/cmake/AkantuSimulationMacros.cmake DESTINATION lib/akantu COMPONENT dev) install(FILES ${PROJECT_SOURCE_DIR}/cmake/Modules/FindIOHelper.cmake ${PROJECT_SOURCE_DIR}/cmake/Modules/FindMumps.cmake ${PROJECT_SOURCE_DIR}/cmake/Modules/FindScotch.cmake ${PROJECT_SOURCE_DIR}/cmake/Modules/FindGMSH.cmake DESTINATION lib/akantu/cmake COMPONENT dev) diff --git a/cmake/AkantuPackagesSystem.cmake b/cmake/AkantuPackagesSystem.cmake index 2a031e46a..f64074096 100644 --- a/cmake/AkantuPackagesSystem.cmake +++ b/cmake/AkantuPackagesSystem.cmake @@ -1,360 +1,364 @@ #=============================================================================== # @file AkantuPackagesSystem.cmake # # @author Nicolas Richart # # @date creation: Sat Jul 18 2015 # @date last modification: Mon Jan 18 2016 # # @brief Addition to the PackageSystem specific for Akantu # # @section LICENSE # # Copyright (©) 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) Laboratory # (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== #=============================================================================== # Element Types #=============================================================================== #------------------------------------------------------------------------------- function(package_declare_elements pkg) set(_options KIND ELEMENT_TYPES GEOMETRICAL_TYPES INTERPOLATION_TYPES GEOMETRICAL_SHAPES GAUSS_INTEGRATION_TYPES INTERPOLATION_TYPES INTERPOLATION_KIND FE_ENGINE_LISTS ) cmake_parse_arguments(_opt_pkg "" "" "${_options}" ${ARGN}) foreach(_opt ${_options}) if(_opt_pkg_${_opt}) package_set_variable(ET_${_opt} ${pkg} ${_opt_pkg_${_opt}}) endif() endforeach() endfunction() #------------------------------------------------------------------------------- function(_transfer_list_to_enum types enum) if(${enum}) set(_enum_tmp ${${enum}}) else() unset(_enum_tmp) endif() foreach(_type ${${types}}) # defining the types for the enum if(DEFINED _enum_tmp) set(_enum_tmp "${_enum_tmp} ${_type},") else() set(_enum_tmp "${_type},") endif() endforeach() set(${enum} ${_enum_tmp} PARENT_SCOPE) endfunction() #------------------------------------------------------------------------------- function(_transfer_list_to_boost_seq types boost_seq) if(${boost_seq}) set(_boost_seq_tmp ${${boost_seq}}) endif() foreach(_type ${${types}}) if(DEFINED _boost_seq_tmp) set(_boost_seq_tmp "${_boost_seq_tmp}${_tabs}\\ (${_type})") else() set(_boost_seq_tmp " (${_type})") endif() string(LENGTH "${_type}" _length) if(_length LESS 13) set(_tabs "\t\t\t\t") elseif(_length LESS 28) set(_tabs "\t\t\t") else() set(_tabs "\t\t") endif() endforeach() set(${boost_seq} ${_boost_seq_tmp} PARENT_SCOPE) endfunction() #------------------------------------------------------------------------------- function(package_get_element_lists) package_get_all_activated_packages(_activated_list) set(_lists KIND ELEMENT_TYPES GEOMETRICAL_TYPES INTERPOLATION_TYPES GEOMETRICAL_SHAPES GAUSS_INTEGRATION_TYPES INTERPOLATION_TYPES INTERPOLATION_KIND FE_ENGINE_LISTS ) set(_element_kind "#define AKANTU_ELEMENT_KIND") set(_all_element_types "#define AKANTU_ALL_ELEMENT_TYPE\t") set(_inter_types_boost_seq "#define AKANTU_INTERPOLATION_TYPES\t\t") foreach(_pkg_name ${_activated_list}) foreach(_list ${_lists}) string(TOLOWER "${_list}" _l_list) _package_get_variable(ET_${_list} ${_pkg_name} _${_l_list}) _transfer_list_to_enum(_${_l_list} _${_l_list}_enum) endforeach() if(_interpolation_types) _transfer_list_to_boost_seq(_interpolation_types _inter_types_boost_seq) endif() if(_kind) string(TOUPPER "${_kind}" _u_kind) if(_element_types) set(_boosted_element_types "${_boosted_element_types} #define AKANTU_ek_${_kind}_ELEMENT_TYPE\t") _transfer_list_to_boost_seq(_element_types _boosted_element_types) set(_boosted_element_types "${_boosted_element_types}\n") # defininf the kinds variables set(_element_kinds "${_element_kinds} #define AKANTU_${_u_kind}_KIND\t(_ek_${_kind})") # defining the full list of element set(_all_element_types "${_all_element_types}\t\\ AKANTU_ek_${_kind}_ELEMENT_TYPE") endif() # defining the full list of kinds set(_element_kind "${_element_kind}${_kind_tabs}\t\t\\ AKANTU_${_u_kind}_KIND") set(_kind_tabs "\t") # defining the macros set(_boost_macros "${_boost_macros} #define AKANTU_BOOST_${_u_kind}_ELEMENT_SWITCH(macro) \\ AKANTU_BOOST_ELEMENT_SWITCH(macro, \\ AKANTU_ek_${_kind}_ELEMENT_TYPE) #define AKANTU_BOOST_${_u_kind}_ELEMENT_LIST(macro) \\ AKANTU_BOOST_APPLY_ON_LIST(macro, \\ AKANTU_ek_${_kind}_ELEMENT_TYPE) ") list(APPEND _aka_fe_lists ${_fe_engine_lists}) foreach(_fe_engine_list ${_fe_engine_lists}) if(NOT DEFINED _fe_engine_list_${_fe_engine_list}) string(TOUPPER "${_fe_engine_list}" _u_list) string(LENGTH "#define AKANTU_FE_ENGINE_LIST_${_u_list}" _length) math(EXPR _length "72 - ${_length}") set(_space "") while(_length GREATER 0) if(CMAKE_VERSION VERSION_GREATER 3.0) string(CONCAT _space "${_space}" " ") else() set(_space "${_space} ") endif() math(EXPR _length "${_length} - 1") endwhile() set(_fe_engine_list_${_fe_engine_list} "#define AKANTU_FE_ENGINE_LIST_${_u_list}${_space}\\ AKANTU_GENERATE_KIND_LIST((_ek_${_kind})") else() set(_fe_engine_list_${_fe_engine_list} "${_fe_engine_list_${_fe_engine_list}}\t\t\t\t\\ (_ek_${_kind})") endif() endforeach() endif() endforeach() if(_aka_fe_lists) list(REMOVE_DUPLICATES _aka_fe_lists) foreach(_fe_list ${_aka_fe_lists}) set(_aka_fe_defines "${_fe_engine_list_${_fe_list}})\n${_aka_fe_defines}") endforeach() endif() # package_get_all_deactivated_packages(_deactivated_list) # foreach(_pkg_name ${_deactivated_list}) # _package_get_variable(ET_KIND ${_pkg_name} _kind) # if(_kind) # string(TOUPPER "${_kind}" _u_kind) # set(_element_kinds "${_element_kinds} # #define AKANTU_${_u_kind}_KIND") # endif() # endforeach() foreach(_list ${_lists}) string(TOLOWER "${_list}" _l_list) set(AKANTU_${_list}_ENUM ${_${_l_list}_enum} PARENT_SCOPE) endforeach() set(AKANTU_INTERPOLATION_TYPES_BOOST_SEQ ${_inter_types_boost_seq} PARENT_SCOPE) set(AKANTU_ELEMENT_TYPES_BOOST_SEQ ${_boosted_element_types} PARENT_SCOPE) set(AKANTU_ELEMENT_KINDS_BOOST_SEQ ${_element_kinds} PARENT_SCOPE) set(AKANTU_ELEMENT_KIND_BOOST_SEQ ${_element_kind} PARENT_SCOPE) set(AKANTU_ALL_ELEMENT_BOOST_SEQ ${_all_element_types} PARENT_SCOPE) set(AKANTU_ELEMENT_KINDS_BOOST_MACROS ${_boost_macros} PARENT_SCOPE) set(AKANTU_FE_ENGINE_LISTS ${_aka_fe_defines} PARENT_SCOPE) endfunction() #------------------------------------------------------------------------------- function(package_get_element_types pkg list) package_get_name(${pkg} _pkg_name) _package_get_variable(ET_ELEMENT_TYPES ${_pkg_name} _tmp_list) set(${list} ${_tmp_list} PARENT_SCOPE) endfunction() #=============================================================================== # Material specific #=============================================================================== #------------------------------------------------------------------------------- function(package_declare_material_infos pkg) cmake_parse_arguments(_opt_pkg "" "" "LIST;INCLUDE" ${ARGN}) package_set_variable(MATERIAL_LIST ${pkg} ${_opt_pkg_LIST}) package_set_variable(MATERIAL_INCLUDE ${pkg} ${_opt_pkg_INCLUDE}) endfunction() #------------------------------------------------------------------------------- function(package_get_all_material_includes includes) _package_get_variable_for_activated(MATERIAL_INCLUDE _includes) foreach(_mat_inc ${_includes}) if(DEFINED _mat_includes) set(_mat_includes "${_mat_includes}\n#include \"${_mat_inc}\"") else() set(_mat_includes "#include \"${_mat_inc}\"") endif() endforeach() set(${includes} ${_mat_includes} PARENT_SCOPE) endfunction() #------------------------------------------------------------------------------- function(package_get_all_material_lists lists) _package_get_variable_for_activated(MATERIAL_LIST _lists) foreach(_mat_list ${_lists}) if(DEFINED _mat_lists) set(_mat_lists "${_mat_lists}\n ${_mat_list}\t\t\t\\") else() set(_mat_lists " ${_mat_list}\t\t\t\\") endif() endforeach() set(${lists} ${_mat_lists} PARENT_SCOPE) endfunction() # ------------------------------------------------------------------------------ # Extra files to consider in source package generated by CPack # ------------------------------------------------------------------------------ function(package_declare_extra_files_to_package pkg) set(_types SOURCES MANUAL TESTS PROJECT) cmake_parse_arguments(_extra_files "" "" "${_types}" ${ARGN}) set(_files ${_extra_files_UNPARSED_ARGUMENTS}) package_get_sources_folder(${pkg} _folder_SOURCES) package_get_manual_folder(${pkg} _folder_MANUAL) package_get_tests_folder(${pkg} _folder_TESTS) set(_folder_PROJECT ${PROJECT_SOURCE_DIR}) foreach(_type ${_types}) if(_extra_files_${_type}) foreach(_file ${_extra_files_${_type}}) list(APPEND _files ${_folder_${_type}}/${_file}) if(NOT EXISTS ${_folder_${_type}}/${_file}) message(SEND_ERROR "The package ${pkg} tries to register the file ${_file} (as a ${_type} file). This file cannot be found.") endif() endforeach() endif() endforeach() package_set_variable(EXTRA_FILES ${pkg} ${_files}) endfunction() # ------------------------------------------------------------------------------ function(package_add_files_to_package) set(_files) foreach(_file ${ARGN}) list(APPEND _files ${PROJECT_SOURCE_DIR}/${_file}) endforeach() package_add_to_project_variable(EXTRA_FILES ${_files}) endfunction() function(package_get_files_for_package files) package_get_project_variable(EXTRA_FILES _tmp) set(${files} ${_tmp} PARENT_SCOPE) endfunction() package_add_files_to_package( .clang-format AUTHORS README VERSION COPYING COPYING.lesser CTestConfig.cmake + cmake/akantu_environement.sh.in + cmake/akantu_environement.csh.in + cmake/akantu_install_environement.sh.in + cmake/akantu_install_environement.csh.in cmake/Modules/CMakeFlagsHandling.cmake cmake/Modules/CMakePackagesSystem.cmake cmake/Modules/CMakePackagesSystemGlobalFunctions.cmake cmake/Modules/CMakePackagesSystemPrivateFunctions.cmake cmake/Modules/CMakeVersionGenerator.cmake cmake/Modules/PCHgcc.cmake cmake/AkantuBuildTreeSettings.cmake.in cmake/AkantuConfig.cmake.in cmake/AkantuConfigVersion.cmake.in cmake/AkantuCPack.cmake cmake/AkantuCPackMacros.cmake cmake/AkantuInstall.cmake cmake/AkantuMacros.cmake cmake/AkantuPackagesSystem.cmake cmake/AkantuUse.cmake cmake/AkantuSimulationMacros.cmake cmake/material_lister.cc cmake/Modules/FindGMSH.cmake ) diff --git a/cmake/AkantuTestsMacros.cmake b/cmake/AkantuTestsMacros.cmake index b88ce0004..f42dfe56e 100644 --- a/cmake/AkantuTestsMacros.cmake +++ b/cmake/AkantuTestsMacros.cmake @@ -1,402 +1,399 @@ #=============================================================================== # @file AkantuTestsMacros.cmake # # @author Nicolas Richart # # @date creation: Fri Sep 03 2010 # @date last modification: Mon Jan 18 2016 # # @brief macros for tests # # @section LICENSE # # Copyright (©) 2010-2012, 2014, 2015 EPFL (Ecole Polytechnique Fédérale de # Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des # Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== #[=======================================================================[.rst: #AkantuTestsMacros #----------------- # #This modules provides the functions to helper to declare tests and folders #containing tests in akantu # #.. command:: add_test_tree # # add_test_tree() # # ```` is the entry direcroty of the full structure of # subfolders containing tests # #.. command:: add_akantu_test # # add_akantu_test( ) # # This function add a subdirectory ```` of tests that will be conditionnaly # activable and will be visible only if the parent folder as been activated An # option ``AKANTU_BUILD_TEST_`` will appear in ccmake with the description # ````. The compilation of all tests can be forced with the option # ``AKANTU_BUILD_ALL_TESTS`` # #.. command:: register_test # # register_test( # SOURCES ... # PACKAGE ... # SCRIPT # [FILES_TO_COPY ...] # [DEPENDS ...] # [DIRECTORIES_TO_CREATE ...] # [COMPILE_OPTIONS ...] # [EXTRA_FILES ...] # [UNSABLE] # [PARALLEL] # ) # # This function defines a test ``_run`` this test could be of # different nature depending on the context. If Just sources are provided the # test consist of running the executable generated. If a file ``.sh`` # is present the test will execute the script. And if a ``.verified`` # exists the output of the test will be compared to this reference file # # The options are: # # ``SOURCES ...`` # The list of source files to compile to generate the executable of the test # # ``PACKAGE ...`` # The list of package to which this test belongs. The test will be activable # only of all the packages listed are activated # # ``SCRIPT