diff --git a/cmake/Modules/CMakeVersionGenerator.cmake b/cmake/Modules/CMakeVersionGenerator.cmake index d02ee1d06..f47fe7456 100644 --- a/cmake/Modules/CMakeVersionGenerator.cmake +++ b/cmake/Modules/CMakeVersionGenerator.cmake @@ -1,85 +1,85 @@ #=============================================================================== # @file CMakeVersionGenerator.cmake # # @author Guillaume Anciaux # @author Nicolas Richart # # @date creation: Thu Dec 20 2012 # @date last modification: Fri Jun 13 2014 # # @brief Set of macros used by akantu to handle the package system # # @section LICENSE # # Copyright (©) 2014 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 . # #=============================================================================== if(__DEFINE_PROJECT_VERSION__) return() endif() set(__DEFINE_PROJECT_VERSION__ TRUE) macro(define_project_version) string(TOUPPER ${PROJECT_NAME} _project) if(EXISTS ${PROJECT_SOURCE_DIR}/VERSION) file(STRINGS ${PROJECT_SOURCE_DIR}/VERSION ${_project}_VERSION) if("${${_project}_VERSION}" MATCHES "^([0-9]+)") string(REGEX REPLACE "^([0-9]+).*" "\\1" _ver_major "${${_project}_VERSION}") set(${_project}_MAJOR_VERSION ${_ver_major}) if("${${_project}_VERSION}" MATCHES "^${_ver_major}\\.([0-9]+)") string(REGEX REPLACE "^${_ver_major}\\.([0-9]+).*" "\\1" _ver_minor "${${_project}_VERSION}") set(${_project}_MINOR_VERSION ${_ver_minor}) if("${${_project}_VERSION}" MATCHES "^${_ver_major}\\.${_ver_minor}\\.([0-9a-zA-Z\\-]+)") string(REGEX REPLACE "^${_ver_major}\\.${_ver_minor}\\.([0-9a-zA-Z\\-]+).*" "\\1" _ver_build "${${_project}_VERSION}") set(${_project}_BUILD_VERSION ${_ver_build}) endif() endif() endif() - else() - find_package(Subversion) + # else() + # find_package(Subversion) - if(SUBVERSION_FOUND) - subversion_wc_info(${PROJECT_SOURCE_DIR} ${_project} ERROR_QUIET) - if(${${_project}_WC_FOUND}) - set(${_project}_BUILD_VERSION ${${_project}_WC_REVISION}) - set(${_project}_VERSION - "${${_project}_MAJOR_VERSION}.${${_project}_MINOR_VERSION}.${${_project}_BUILD_VERSION}" - ) - endif() - endif() + # if(SUBVERSION_FOUND) + # subversion_wc_info(${PROJECT_SOURCE_DIR} ${_project} ERROR_QUIET) + # if(${${_project}_WC_FOUND}) + # set(${_project}_BUILD_VERSION ${${_project}_WC_REVISION}) + # set(${_project}_VERSION + # "${${_project}_MAJOR_VERSION}.${${_project}_MINOR_VERSION}.${${_project}_BUILD_VERSION}" + # ) + # endif() + # endif() endif() if(NOT ${_project}_VERSION) set(${_project}_VERSION "${${_project}_MAJOR_VERSION}.${${_project}_MINOR_VERSION}" ) endif() # Append the library version information to the library target properties if(NOT ${_project}_NO_LIBRARY_VERSION) message(STATUS "${PROJECT_NAME} version: ${${_project}_VERSION}") set(${_project}_LIBRARY_PROPERTIES ${${_project}_LIBRARY_PROPERTIES} VERSION "${${_project}_VERSION}" SOVERSION "${${_project}_MAJOR_VERSION}.${${_project}_MINOR_VERSION}" ) endif() endmacro() \ No newline at end of file diff --git a/packages/80_nlopt.cmake b/packages/80_nlopt.cmake index 399d4343b..fa223e4f9 100644 --- a/packages/80_nlopt.cmake +++ b/packages/80_nlopt.cmake @@ -1,82 +1,82 @@ #=============================================================================== # @file 80_nlopt.cmake # # @author Guillaume Anciaux # @author Nicolas Richart # # @date creation: Thu Jun 05 2014 # @date last modification: Thu Sep 18 2014 # # @brief package for the opitmization library NLopt # # @section LICENSE # # Copyright (©) 2014 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 . # #=============================================================================== option(AKANTU_USE_THIRD_PARTY_NLOPT "Automatic download of the NLOPT library" ON) -option(AKANTU_USE_NLOPT "Use NLOPT library") +option(AKANTU_USE_NLOPT "Use NLOPT library" OFF) mark_as_advanced(AKANTU_USE_THIRD_PARTY_NLOPT AKANTU_USE_NLOPT) set(NLOPT_VERSION "2.4.2") set(NLOPT_ARCHIVE "${PROJECT_SOURCE_DIR}/third-party/nlopt-${NLOPT_VERSION}.tar.gz") set(NLOPT_ARCHIVE_HASH "MD5=d0b8f139a4acf29b76dbae69ade8ac54") if(NOT EXISTS ${NLOPT_ARCHIVE}) set(NLOPT_ARCHIVE "http://ab-initio.mit.edu/nlopt/nlopt-${NLOPT_VERSION}.tar.gz") endif() if (AKANTU_USE_THIRD_PARTY_NLOPT AND AKANTU_USE_NLOPT) set(NLOPT_CONFIGURE_COMMAND /configure --prefix= --enable-shared --with-cxx) set(NLOPT_DIR ${PROJECT_BINARY_DIR}/third-party) include(ExternalProject) ExternalProject_Add(NLopt PREFIX ${NLOPT_DIR} URL ${NLOPT_ARCHIVE} URL_HASH ${NLOPT_ARCHIVE_HASH} CONFIGURE_COMMAND ${NLOPT_CONFIGURE_COMMAND} BUILD_COMMAND make INSTALL_COMMAND make install ) set(NLOPT_LIBRARIES ${NLOPT_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}nlopt_cxx${CMAKE_SHARED_LIBRARY_SUFFIX} CACHE PATH "Libraries for NLopt" FORCE) set(NLOPT_INCLUDE_DIR ${NLOPT_DIR}/include CACHE PATH "Include directories for NLopt" FORCE) mark_as_advanced(NLOPT_INCLUDE_DIR NLOPT_LIBRARIES) list(APPEND AKANTU_EXTERNAL_LIBRARIES ${NLOPT_LIBRARIES}) list(APPEND AKANTU_EXTERNAL_LIB_INCLUDE_DIR ${NLOPT_INCLUDE_DIR}) set(AKANTU_NLOPT_INCLUDE_DIR ${NLOPT_INCLUDE_DIR}) set(AKANTU_NLOPT_LIBRARIES ${NLOPT_LIBRARIES}) list(APPEND AKANTU_OPTION_LIST NLOPT) set(NLOPT_FOUND TRUE CACHE INTERNAL "" FORCE) set(AKANTU_NLOPT ON) list(APPEND AKANTU_EXTRA_TARGET_DEPENDENCIES NLopt) else() add_optional_external_package(NLopt "Use NLOPT library" OFF) endif() set(AKANTU_NLOPT_DOCUMENTATION " This package enable the use of the optimization alogorithm library \\href{http://ab-initio.mit.edu/wiki/index.php/NLopt}{NLopt}. Since there are no packaging for the common operating system by default \\akantu compiles it as a third-party project. This behavior can be modified with the option \\code{AKANTU\\_USE\\_THIRD\\_PARTY\\_NLOPT}. If the automated download fails please download \\href{http://ab-initio.mit.edu/nlopt/nlopt-${NLOPT_VERSION}.tar.gz}{nlopt-${NLOPT_VERSION}.tar.gz} and place it in \\shellcode{/third-party} download. ") diff --git a/packages/90_iohelper.cmake b/packages/90_iohelper.cmake index f1fec8a0f..4a69ab0df 100644 --- a/packages/90_iohelper.cmake +++ b/packages/90_iohelper.cmake @@ -1,82 +1,90 @@ #=============================================================================== # @file 90_iohelper.cmake # # @author Nicolas Richart # # @date creation: Tue Nov 29 2011 # @date last modification: Tue Sep 02 2014 # # @brief package description for iohelper # # @section LICENSE # # Copyright (©) 2010-2012, 2014 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 . # #=============================================================================== -if(EXISTS ${PROJECT_SOURCE_DIR}/third-party/iohelper) - option(AKANTU_USE_IOHELPER "Add IOHelper support in akantu" ON) - mark_as_advanced(AKANTU_USE_IOHELPER) +option(AKANTU_USE_THIRD_PARTY_IOHELPER "Automatic download of the IOHelper library" ON) +option(AKANTU_USE_IOHELPER "Add IOHelper support in akantu" ON) - if(AKANTU_USE_IOHELPER) - set(IOHELPER_TARGETS_EXPORT ${AKANTU_TARGETS_EXPORT}) - add_subdirectory(third-party/iohelper) +mark_as_advanced(AKANTU_USE_IOHELPER) +mark_as_advanced(AKANTU_USE_THIRD_PARTY_IOHELPER) - list(APPEND AKANTU_EXTERNAL_LIBRARIES iohelper) - list(APPEND AKANTU_EXTERNAL_LIB_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/third-party/iohelper/src) +if (AKANTU_USE_THIRD_PARTY_IOHELPER AND AKANTU_USE_IOHELPER) + set(IOHELPER_VERSION "1.1") + set(IOHELPER_GIT "https://git.epfl.ch/repo/iohelper.git") - set(AKANTU_IOHELPER_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/third-party/iohelper/src) + include(ExternalProject) - list(APPEND AKANTU_EXPORT_LIST iohelper) - list(APPEND AKANTU_OPTION_LIST IOHELPER) - mark_as_advanced(IOHELPER_TESTS) + ExternalProject_Add(IOHelper + PREFIX ${PROJECT_BINARY_DIR}/third-party + GIT_REPOSITORY ${IOHELPER_GIT} + CMAKE_ARGS / + CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DCMAKE_CXX_COMPILER:PATH=${CMAKE_CXX_COMPILER} + BUILD_COMMAND make + INSTALL_COMMAND make install + ) + + set_third_party_shared_libirary_name(IOHELPER_LIBRARIES iohelper) + list(APPEND AKANTU_EXTERNAL_LIBRARIES ${IOHELPER_LIBRARIES}) + list(APPEND AKANTU_EXTERNAL_LIB_INCLUDE_DIR ${PROJECT_BINARY_DIR}/third-party/include/iohelper) + + list(APPEND AKANTU_EXTRA_TARGET_DEPENDENCIES IOHelper) + set(AKANTU_IOHELPER_INCLUDE_DIR ${PROJECT_BINARY_DIR}/third-party/include/iohelper) set(AKANTU_IOHELPER ON) - else() - set(AKANTU_IOHELPER OFF) - endif() else() add_optional_external_package(IOHelper "Add IOHelper support in akantu" ON) endif() set(AKANTU_IOHELPER_FILES io/dumper/dumper_iohelper.hh io/dumper/dumper_iohelper.cc io/dumper/dumper_paraview.hh io/dumper/dumper_text.cc io/dumper/dumper_text.hh io/dumper/dumper_paraview.cc io/dumper/dumper_homogenizing_field.hh io/dumper/dumper_type_traits.hh io/dumper/dumper_compute.hh io/dumper/dumper_nodal_field.hh io/dumper/dumper_quadrature_points_field.hh io/dumper/dumper_variable.hh io/dumper/dumper_iterator_helper.hh io/dumper/dumper_connectivity_field.hh io/dumper/dumper_padding_helper.hh io/dumper/dumper_elemental_field.hh io/dumper/dumper_element_iterator.hh io/dumper/dumper_material_internal_field.hh io/dumper/dumper_generic_elemental_field.hh io/dumper/dumper_generic_elemental_field_tmpl.hh ) set(AKANTU_IOHELPER_DOCUMENTATION " This package activates the IOHelper facilities withing Akantu. This is mandatory if you want to be able to output Paraview files as well as any Dumper within Akantu. ")