diff --git a/.gitignore b/.gitignore index f3d00bd4e..8b2e638bb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,16 +1,18 @@ build* .dir-locals.el TAGS -!third-party/cmake -!third-party/iohelper third-party/*/ +!third-party/cmake/* +!third-party/akantu-iterators +!third-party/iohelper *~ release .*.swp *.tar.gz *.tgz *.tbz *.tar.bz2 .idea __pycache__ .mailmap +compile_commands.json diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 000000000..f81656fd3 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,84 @@ +stages: + - configure + - build + - build_tests + - test + +.configure: + stage: configure + except: + - tags + variables: + BLA_VENDOR: 'OpenBLAS' + script: + - cmake -E make_directory build + - cd build + - cmake -DAKANTU_COHESIVE_ELEMENT:BOOL=TRUE + -DAKANTU_IMPLICIT:BOOL=TRUE + -DAKANTU_PARALLEL:BOOL=TRUE + -DAKANTU_STRUCTURAL_MECHANICS:BOOL=TRUE + -DAKANTU_HEAT_TRANSFER:BOOL=TRUE + -DAKANTU_DAMAGE_NON_LOCAL:BOOL=TRUE + -DAKANTU_PYTHON_INTERFACE:BOOL=TRUE + -DAKANTU_EXAMPLES:BOOL=TRUE + -DAKANTU_BUILD_ALL_EXAMPLES:BOOL=TRUE + -DAKANTU_TEST_EXAMPLES:BOOL=FALSE + -DAKANTU_TESTS:BOOL=TRUE + -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo + -DAKANTU_RUN_IN_DOCKER:BOOL=TRUE .. + +.build: + stage: build + script: + - cmake --build build/ + +.tests: + stage: test + variables: + OMPI_MCA_plm: 'isolated' + OMPI_MCA_btl: 'tcp,self' + + script: + - cd build + - ctest -T test --no-compress-output --timeout 300 + after_script: + - cd build + - tag=$(head -n 1 < Testing/TAG) + - if [ -e Testing/${tag}/Test.xml ]; then + - xsltproc -o ./juint.xml ${CI_PROJECT_DIR}/test/ci/ctest2junit.xsl Testing/${tag}/Test.xml; + - fi + artifacts: + when: always + paths: + - build/juint.xml + reports: + junit: + - build/juint.xml + +.image_debian_testing_gcc: + cache: + key: debian_testing_gcc_${CI_COMMIT_SHORT_SHA} + paths: + - build + - third-party/google-test + - third-party/pybind11 + image: registry.gitlab.com/akantu/akantu:debian-testing + +configure:debian_testing_gcc: + extends: + - .configure + - .image_debian_testing_gcc + +build:debian_testing_gcc: + extends: + - .build + - .image_debian_testing_gcc + dependencies: + - configure:debian_testing_gcc + +test:debian_testing_gcc: + extends: + - .tests + - .image_debian_testing_gcc + dependencies: + - build:debian_testing_gcc diff --git a/CMakeLists.txt b/CMakeLists.txt index bb9d8955f..9cfb79dfc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,197 +1,208 @@ #=============================================================================== # @file CMakeLists.txt # # @author Guillaume Anciaux # @author Nicolas Richart # # @date creation: Mon Jun 14 2010 # @date last modification: Fri Jan 22 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 3.1.3) +cmake_minimum_required(VERSION 3.5.1) # add this options before PROJECT keyword set(CMAKE_DISABLE_SOURCE_CHANGES ON) set(CMAKE_DISABLE_IN_SOURCE_BUILD ON) project(Akantu) enable_language(CXX) +if(CMAKE_VERSION VERSION_GREATER 3.12) + cmake_policy(SET CMP0074 NEW) +endif() + #=============================================================================== # 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.") set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE BOOL "Enable/Disable output of compile commands during generation" FORCE) mark_as_advanced(BUILD_SHARED_LIBS) if(NOT AKANTU_TARGETS_EXPORT) set(AKANTU_TARGETS_EXPORT AkantuTargets) endif() include(CMakeVersionGenerator) include(CMakePackagesSystem) include(CMakeFlagsHandling) include(AkantuPackagesSystem) include(AkantuMacros) include(AkantuCleaning) #cmake_activate_debug_message() +include(GNUInstallDirs) +set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") +# add the automatically determined parts of the RPATH +# which point to directories outside the build tree to the install RPATH +set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + #=============================================================================== # Version Number #=============================================================================== # AKANTU version number. An even minor number corresponds to releases. set(AKANTU_MAJOR_VERSION 3) set(AKANTU_MINOR_VERSION 1) 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 -pedantic -Werror") if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") add_flags(cxx "-Wall -Wextra -pedantic") # -Weffc++ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG_INIT} -ggdb3" CACHE STRING "Flags used by the compiler during debug builds" FORCE) set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT} -ggdb3" CACHE STRING "Flags used by the compiler during debug builds" FORCE) else() add_flags(cxx "-Wall") endif() option(AKANTU_EXAMPLES "Activate examples" OFF) option(AKANTU_TESTS "Activate tests" OFF) +option(AKANTU_RUN_IN_DOCKER "Set the approriate flage tu run in docker" OFF) set(AKANTU_PREFERRED_PYTHON_VERSION 3 CACHE STRING "Preferred version for python related things") -mark_as_advanced(AKANTU_PREFERRED_PYTHON_VERSION) +mark_as_advanced(AKANTU_PREFERRED_PYTHON_VERSION AKANTU_RUN_IN_DOCKER) include(AkantuExtraCompilationProfiles) #=============================================================================== # 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() #=============================================================================== # 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() #=============================================================================== # Examples and tests #=============================================================================== include(AkantuTestsMacros) include(AkantuExampleMacros) if(AKANTU_TESTS) option(AKANTU_BUILD_ALL_TESTS "Build all tests" ON) find_package(GMSH REQUIRED) endif() # tests add_test_tree(test) if(AKANTU_EXAMPLES) if(AKANTU_TESTS) option(AKANTU_TEST_EXAMPLES "Run the examples" ON) endif() find_package(GMSH REQUIRED) add_subdirectory(examples) 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/Jenkinsfile b/Jenkinsfile index 408ee0ef9..d1271f860 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,184 +1,182 @@ pipeline { parameters {string(defaultValue: '', description: 'api-token', name: 'API_TOKEN') string(defaultValue: '', description: 'buildable phid', name: 'BUILD_TARGET_PHID') string(defaultValue: '', description: 'Commit id', name: 'COMMIT_ID') string(defaultValue: '', description: 'Diff id', name: 'DIFF_ID') string(defaultValue: 'PHID-PROJ-5eqyu6ooyjktagbhf473', description: 'ID of the project', name: 'PROJECT_ID') } options { disableConcurrentBuilds() //skipDefaultCheckout(true) } environment { PHABRICATOR_HOST = 'https://c4science.ch/api/' PYTHONPATH = sh returnStdout: true, script: 'echo ${WORKSPACE}/test/ci/script/' BLA_VENDOR = 'OpenBLAS' OMPI_MCA_plm = 'isolated' OMPI_MCA_btl = 'tcp,self' } agent { dockerfile { filename 'Dockerfile' - dir 'test/ci' + dir 'test/ci/debian.testing' additionalBuildArgs '--tag akantu-environment' } } stages { stage('Checkout proper commit') { steps { - checkout scm: [$class: 'GitSCM', - branches: [[name: "${COMMIT_ID}" ]] - ], changelog: true + checkout scm: [$class: 'GitSCM', + branches: [[name: "${COMMIT_ID}" ]] + ], changelog: true } } stage('Lint') { steps { - sh """ + sh """ arc lint --output json --rev HEAD^ | jq . -srM | tee lint.json ./test/ci/scripts/hbm send-arc-lint -f lint.json """ } } stage('Configure') { steps { sh """#!/bin/bash set -o pipefail mkdir -p build cd build cmake -DAKANTU_COHESIVE_ELEMENT:BOOL=TRUE \ -DAKANTU_IMPLICIT:BOOL=TRUE \ -DAKANTU_PARALLEL:BOOL=TRUE \ -DAKANTU_STRUCTURAL_MECHANICS:BOOL=TRUE \ -DAKANTU_HEAT_TRANSFER:BOOL=TRUE \ -DAKANTU_DAMAGE_NON_LOCAL:BOOL=TRUE \ -DAKANTU_PYTHON_INTERFACE:BOOL=TRUE \ -DAKANTU_EXAMPLES:BOOL=TRUE \ -DAKANTU_BUILD_ALL_EXAMPLES:BOOL=TRUE \ -DAKANTU_TEST_EXAMPLES:BOOL=FALSE \ - -DAKANTU_TESTS:BOOL=TRUE .. | tee configure.txt + -DAKANTU_TESTS:BOOL=TRUE \ + -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo .. | tee ../configure.txt """ } post { - failure { - uploadArtifact('configure.txt', 'Configure') - deleteDir() - } + failure { + uploadArtifact('build/configure.txt', 'Configure') + sh """ + rm -rf build + """ + } } } stage('Compile') { steps { - sh '''#!/bin/bash + sh '''#!/bin/bash set -o pipefail - make -C build/src | tee compilation.txt + make -C build/src | tee build/compilation.txt ''' } post { - failure { - uploadArtifact('compilation.txt', 'Compilation') - } + failure { + uploadArtifact('build/compilation.txt', 'Compilation') + } } } stage ('Warnings gcc') { steps { warnings(consoleParsers: [[parserName: 'GNU Make + GNU C Compiler (gcc)']]) } } stage('Compile python') { steps { sh '''#!/bin/bash set -o pipefail - make -C build/python | tee compilation_python.txt + make -C build/python | tee build/compilation_python.txt ''' } post { - failure { - uploadArtifact('compilation_python.txt', 'Compilation_Python') - } + failure { + uploadArtifact('build/compilation_python.txt', 'Compilation_Python') + } } } stage('Compile tests') { steps { sh '''#!/bin/bash set -o pipefail - make -C build/test | tee compilation_test.txt + make -C build/test | tee build/compilation_test.txt ''' } post { - failure { - uploadArtifact('compilation_test.txt', 'Compilation_Tests') - } + failure { + uploadArtifact('build/compilation_test.txt', 'Compilation_Tests') + } } } stage('Tests') { steps { sh ''' #rm -rf build/gtest_reports cd build/ #source ./akantu_environement.sh ctest -T test --no-compress-output || true tag=$(head -n 1 < Testing/TAG) if [ -e Testing/${tag}/Test.xml ]; then - cp Testing/${tag}/Test.xml ../CTestResults.xml + cp Testing/${tag}/Test.xml ./CTestResults.xml fi ''' } - //post { - //failure { - //zip zipFile: 'build.zip', dir: 'build/', archive: true - //} - //} } } post { always { - createArtifact("./CTestResults.xml") + createArtifact("build/CTestResults.xml") step([$class: 'XUnitBuilder', - thresholds: [ + thresholds: [ [$class: 'SkippedThreshold', failureThreshold: '0'], [$class: 'FailedThreshold', failureThreshold: '0']], - tools: [ - [$class: 'CTestType', pattern: 'CTestResults.xml', skipNoTestFiles: true] - ]]) + tools: [ + [$class: 'CTestType', pattern: 'build/CTestResults.xml', skipNoTestFiles: true] + ]]) } success { passed() } failure { failed() } } } def failed() { sh "./test/ci/scripts/hbm failed" } def passed() { sh "./test/ci/scripts/hbm passed" } def createArtifact(filename) { sh "./test/ci/scripts/hbm send-uri -k 'Jenkins URI' -u ${BUILD_URL} -l 'View Jenkins result'" sh "./test/ci/scripts/hbm send-ctest-results -f ${filename}" } def uploadArtifact(artifact, name) { sh "./test/ci/scripts/hbm upload-file -f ${artifact} -n \"${name}\" -v ${PROJECT_ID}" } diff --git a/README b/README index 7e9214d8b..11931061e 100644 --- a/README +++ b/README @@ -1,84 +1,26 @@ ================================================== _ _ | | | | __ _| | ____ _ _ __ | |_ _ _ / _` | |/ / _` | '_ \| __| | | | | (_| | < (_| | | | | |_| |_| | \__,_|_|\_\__,_|_| |_|\__|\__,_| ================================================== - -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 . - - -___________ +__________ COMPILATION There are two ways to compile Akantu. 1. You can compile it directly using cmake > mkdir build > cd build > ccmake .. > make ________ CONTACTS If you need some help to use Akantu you can contact use akantu@akantu.ch -_______ -AUTHORS - - - Nicolas Richart - - Guillaume Anciaux - - Jean-François Molinari - - Alejandro M. Aragón - - Alodie Schneuwly - - Aranda Ruiz Josue - - Aurelia Isabel Cuba Ramos - - Benjamin Paccaud - - Clement Roux - - Cyprien Wolff - - Damien Scantamburlo - - Damien Spielmann - - Dana Christen - - Daniel Pino Muñoz - - David Simon Kammer - - Fabian Barras - - Jaehyun Cho - - Jean-François Jerier - - Leonardo Snozzi - - Lucas Frerot - - Marco Vocialta - - Marion Estelle Chambart - - Mathilde Radiguet - - Mauro Corrado - - Nicholas Molyneaux - - Okan Yilmaz - - Pedro Romero - - Peter Spijker - - Ramin Aghababaei - - Rui Wang - - Sacha Laffely - - Seyedeh Mohadeseh Taheri Mousavi - - Srinivasa Babu Ramisetti - - Sébastien Hartmann - - Thomas Menouillard - - Till Junge - - Vladislav Yastrebov diff --git a/cmake/AkantuExampleMacros.cmake b/cmake/AkantuExampleMacros.cmake index be0a5322a..63d4c908a 100644 --- a/cmake/AkantuExampleMacros.cmake +++ b/cmake/AkantuExampleMacros.cmake @@ -1,141 +1,155 @@ #=============================================================================== # @file AkantuExampleMacros.cmake # # @author Guillaume Anciaux # @author Nicolas Richart # # @date creation: Mon Jan 18 2016 # @date last modification: Fri Jan 22 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) +set(AKANTU_DRIVER_SCRIPT ${AKANTU_CMAKE_DIR}/akantu_test_driver.sh) + # ============================================================================== 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() if(AKANTU_TEST_EXAMPLES) cmake_parse_arguments(_example "PYTHON;PARALLEL" - "" + "FILES_TO_COPY;DEPENDS" "SCRIPT" ${ARGN} ) + if(_example_FILES_TO_COPY) + foreach(_file ${_example_FILES_TO_COPY}) + _add_file_to_copy(${example_name} "${_file}") + endforeach() + endif() + if(_example_PARALLEL) set(_exe ${MPIEXEC}) if(NOT _exe) - set(_exe ${MPIEXEC_EXECUTABLE}) + set(_exe ${MPIEXEC_EXECUTABLE}) endif() - set(_parallel_runner ${_exe} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} 2) + set(_parallel_runner -p "${_exe} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG}" -N "2") endif() if(NOT _example_SCRIPT) - add_test(NAME ${example_name}-test - COMMAND ${_parallel_runner} $ - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + add_test(NAME ${example_name}-test + COMMAND ${AKANTU_DRIVER_SCRIPT} + ${_parallel_runner} + -n "${example_name}-test" + -w "${CMAKE_CURRENT_BINARY_DIR}" + -e $) elseif(_example_SCRIPT) + _add_file_to_copy(${example_name} "${_example_SCRIPT}") if(_example_PYTHON) - add_test(NAME ${example_name}-test - COMMAND ${_parallel_runner} ${PYTHON_EXECUTABLE} ${_example_SCRIPT} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + add_test(NAME ${example_name}-test + COMMAND ${AKANTU_DRIVER_SCRIPT} + ${_parallel_runner} + -n "${example_name}-test" + -E "${PROJECT_BINARY_DIR}/akantu_environement.sh" + -w "${CMAKE_CURRENT_BINARY_DIR}" + -e "${PYTHON_EXECUTABLE}" "${_example_SCRIPT}") else() - set(_python_path ENV{PYTHON_PATH}) - if (NOT _python_path MATCHES ${PROJECT_BINARY_DIR}/python) - set(ENV{PYTHON_PATH} "${_python_path}:${PROJECT_BINARY_DIR}/python") - endif() - add_test(NAME ${example_name}-test - COMMAND ${_parallel_runner} ${_example_SCRIPT} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - ) + add_test(NAME ${example_name}-test + COMMAND ${AKANTU_DRIVER_SCRIPT} + ${_parallel_runner} + -n "${example_name}-test" + -w "${CMAKE_CURRENT_BINARY_DIR}" + -e "${_example_SCRIPT}") endif() endif() endif() endfunction() # ============================================================================== function(add_example et_name desc) string(TOUPPER ${et_name} upper_name) if(NOT _build_all_ex) option(AKANTU_BUILD_ALL_EXAMPLES "Activate all examples" OFF) set( _build_all_ex TRUE) endif() option(AKANTU_BUILD_EXAMPLES_${upper_name} ${desc} OFF) if(AKANTU_BUILD_ALL_EXAMPLES) mark_as_advanced(FORCE AKANTU_BUILD_EXAMPLES_${upper_name}) else() mark_as_advanced(CLEAR AKANTU_BUILD_EXAMPLES_${upper_name}) endif() if(AKANTU_BUILD_EXAMPLES_${upper_name} OR AKANTU_BUILD_ALL_EXAMPLES) 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.") + "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) + package_is_activated(${_pkg} _activated) + if(NOT _activated) set(_act FALSE) - endif() + 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}) + 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) + set(_add_examples_pkg ${_save_add_examples_pkg}) + unset(_save_add_examples_pkg) endif() endif() endif() endfunction() diff --git a/cmake/AkantuInstall.cmake b/cmake/AkantuInstall.cmake index 4a7da3a2f..ed7530186 100644 --- a/cmake/AkantuInstall.cmake +++ b/cmake/AkantuInstall.cmake @@ -1,163 +1,165 @@ #=============================================================================== # @file AkantuInstall.cmake # # @author Nicolas Richart # # @date creation: Wed Oct 17 2012 # @date last modification: Fri Jan 22 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" " 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) package_is_activated(pybind11 _is_pybind11_activated) package_is_activated(swig _is_swig_activated) 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) package_is_activated(python_interface _is_acticated) if(_is_acticated) find_package(PythonInterp ${AKANTU_PREFERRED_PYTHON_VERSION}) 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) endif() +include(GNUInstallDirs) + 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}) + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/akantu${AKANTU_VERSION}) include(CMakePackageConfigHelpers) configure_package_config_file(cmake/AkantuConfig.cmake.in "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" - INSTALL_DESTINATION share/cmake/${PROJECT_NAME} + INSTALL_DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PROJECT_NAME} ) 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_SOURCE_DIR}/cmake/Modules/FindScaLAPACK.cmake ${PROJECT_SOURCE_DIR}/cmake/Modules/FindMETIS.cmake ${PROJECT_SOURCE_DIR}/cmake/Modules/FindParMETIS.cmake ${PROJECT_SOURCE_DIR}/cmake/Modules/FindPETSc.cmake ${PROJECT_SOURCE_DIR}/cmake/Modules/FindMumps.cmake ${PROJECT_SOURCE_DIR}/cmake/Modules/FindScotch.cmake ${PROJECT_SOURCE_DIR}/cmake/Modules/FindGMSH.cmake ${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 ${PROJECT_SOURCE_DIR}/cmake/Modules/FindGMSH.cmake - DESTINATION share/cmake/${PROJECT_NAME} + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PROJECT_NAME} COMPONENT dev) diff --git a/cmake/AkantuTestsMacros.cmake b/cmake/AkantuTestsMacros.cmake index 520f40e38..9537cd7d4 100644 --- a/cmake/AkantuTestsMacros.cmake +++ b/cmake/AkantuTestsMacros.cmake @@ -1,648 +1,653 @@ #=============================================================================== # @file AkantuTestsMacros.cmake # # @author Nicolas Richart # # @date creation: Fri Sep 03 2010 # @date last modification: Fri Jan 22 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 ...] [LINK_LIBRARIES ...] [INCLUDE_DIRECTORIES ...] [UNSABLE] [PARALLEL] [PARALLEL_LEVEL ...] ) 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