diff --git a/CMakeLists.txt b/CMakeLists.txt index f54eadc69..ad9c872b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,175 +1,172 @@ #=============================================================================== # @file CMakeLists.txt # # @author Nicolas Richart # # @date Mon Jun 14 19:12:20 2010 # # @brief main configuration file # # @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 #------------------------------------------------------------------------------- # _ _ # | | | | # __ _| | ____ _ _ __ | |_ _ _ # / _` | |/ / _` | '_ \| __| | | | # | (_| | < (_| | | | | |_| |_| | # \__,_|_|\_\__,_|_| |_|\__|\__,_| # #=============================================================================== #=============================================================================== # CMake Project #=============================================================================== cmake_minimum_required(VERSION 2.8) 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.") if(NOT AKANTU_TARGETS_EXPORT) set(AKANTU_TARGETS_EXPORT AkantuLibraryDepends) endif() include(CMakeVersionGenerator) include(CMakePackagesSystem) include(CMakeFlagsHandling) include(AkantuMacros) #cmake_activate_debug_message() #=============================================================================== # Version Number #=============================================================================== # AKANTU version number. An even minor number corresponds to releases. set(AKANTU_MAJOR_VERSION 1) set(AKANTU_MINOR_VERSION 0) set(AKANTU_PATCH_VERSION 0) - define_project_version() #=============================================================================== # Options #=============================================================================== # Debug option(AKANTU_DEBUG "Compiles akantu with the debug messages" ON) mark_as_advanced(AKANTU_DEBUG) add_flags(cxx "-Wall") if(NOT AKANTU_DEBUG) - add_flags(cxx "-Wno-return-type") set(AKANTU_NDEBUG ON) else() - remove_flags(cxx "-Wno-return-type") + set(AKANTU_NDEBUG OFF) endif() #Profiling set(CMAKE_CXX_FLAGS_PROFILING "-g -pg" 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) mark_as_advanced(CMAKE_EXE_LINKER_FLAGS_PROFILING) mark_as_advanced(CMAKE_SHARED_LINKER_FLAGS_PROFILING) -include(AkantuDetermineCCompiler) +include(CMakeDetermineCCompiler) #=============================================================================== # Dependencies #=============================================================================== set(Boost_USE_STATIC_LIBS ON) set(Boost_USE_MULTITHREADED ON) set(Boost_USE_STATIC_RUNTIME OFF) find_package( Boost 1.36.0 COMPONENTS chrono system) if(Boost_FOUND) include_directories(${Boost_INCLUDE_DIRS}) set (AKANTU_EXTERNAL_LIBRARIES ${Boost_LIBRARIES}) endif() - add_all_packages(${PROJECT_SOURCE_DIR}/packages ${PROJECT_SOURCE_DIR}/src) ## 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 #=============================================================================== option(AKANTU_DOCUMENTATION "Build source documentation using Doxygen." OFF) if(AKANTU_DOCUMENTATION) add_subdirectory(doc) endif() - #=============================================================================== # Examples and tests #=============================================================================== option(AKANTU_EXAMPLES "Activate examples" OFF) option(AKANTU_TESTS "Activate tests" OFF) if(AKANTU_EXAMPLES OR AKANTU_TESTS) include(AkantuTestAndExamples) find_package(GMSH REQUIRED) endif() if(AKANTU_EXAMPLES) add_subdirectory(examples) endif() if(AKANTU_TESTS) enable_testing() include(CTest) set(AKANTU_TESTS_EXCLUDE_FILES) add_subdirectory(test) endif() #=============================================================================== # Install and Packaging #=============================================================================== include(AkantuInstall) include(AkantuCPack) set(TMP ${AKANTU_INCLUDE_DIRS}) set(AKANTU_INCLUDE_DIRS ${TMP} CACHE INTERNAL "Internal include directories to link with Akantu as a subproject") diff --git a/cmake/AkantuCPack.cmake b/cmake/AkantuCPack.cmake index ddeac6da7..a05129d1d 100644 --- a/cmake/AkantuCPack.cmake +++ b/cmake/AkantuCPack.cmake @@ -1,53 +1,70 @@ #=============================================================================== # @file AkantuCPack.cmake # # @author Nicolas Richart # # @date Wed Oct 17 15:19:18 2012 # # @brief Configure the packaging system # # @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 . # #=============================================================================== set(PACKAGE_FILE_NAME "akantu" CACHE STRING "Name of package to be generated") mark_as_advanced(PACKAGE_FILE_NAME) set(CPACK_GENERATOR "DEB;TGZ;TBZ2;STGZ") + +# Debian config package set(CPACK_DEBIAN_PACKAGE_MAINTAINER "guillaume.anciaux@epfl.ch, nicolas.richart@epfl.ch") if(CMAKE_SIZEOF_VOID_P EQUAL 8) set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64" CACHE STRING "Architecture of debian package generation") else() set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "i386" CACHE STRING "Architecture of debian package generation") endif() set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "Akantu library") set(CPACK_DEBIAN_PACKAGE_DEPENDS "${PACKAGE_SYSTEM_DEBIAN_PACKAGE_DEPENDS}") + +# General configuration set(CPACK_PACKAGE_VENDOR "LSMS") set(CPACK_PACKAGE_FILE_NAME "${PACKAGE_FILE_NAME}-${AKANTU_VERSION}-${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}") -set(CPACK_SOURCE_PACKAGE_FILE_NAME "${PACKAGE_FILE_NAME}-${AKANTU_VERSION}-src") set(CPACK_PACKAGE_VERSION "${AKANTU_VERSION}") + +set(CPACK_COMPONENTS_ALL lib dev) +set(CPACK_COMPONENT_LIB_DISPLAY_NAME "Libraries") +set(CPACK_COMPONENT_DEV_DISPLAY_NAME "C++ Headers") +set(CPACK_COMPONENT_DEV_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") +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") + list(APPEND CPACK_SOURCE_IGNORE_FILES ${AKANTU_EXCLUDE_SOURCE_FILE} ${AKANTU_TESTS_EXCLUDE_FILES} ${AKANTU_DOC_EXCLUDE_FILES}) foreach(_pkg ${PACKAGE_SYSTEM_PACKAGES_OFF}) list(APPEND CPACK_SOURCE_IGNORE_FILES ${CMAKE_SOURCE_DIR}/packages/${_pkg}.cmake) endforeach() list(APPEND CPACK_SOURCE_IGNORE_FILES "/doc/manual/;/.*build.*/;/CVS/;/\\\\.svn/;/\\\\.bzr/;/\\\\.hg/;/\\\\.git/;\\\\.swp$;\\\\.#;/#;~") include(CPack) diff --git a/cmake/AkantuDetermineCCompiler.cmake b/cmake/AkantuDetermineCCompiler.cmake deleted file mode 100644 index c4da43d81..000000000 --- a/cmake/AkantuDetermineCCompiler.cmake +++ /dev/null @@ -1,66 +0,0 @@ -#=============================================================================== -# @file AkantuDetermineCCompiler.cmake -# -# @author Nicolas Richart -# -# @date Thu Aug 02 10:34:06 2012 -# -# @brief CMake file to determine the compiler -# -# @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 . -# -#=============================================================================== - -macro(determine_compiler_version COMPILER) - exec_program(${CMAKE_CXX_COMPILER} - ARGS --version - OUTPUT_VARIABLE _temp - ) - - set(${COMPILER}_COMPILER_VERSION "" CACHE STRING "Vesion of ${COMPILER} compiler.") - string(REGEX MATCH "([0-9\\.]+)" - ${COMPILER}_COMPILER_VERSION - ${_temp} - ) - - mark_as_advanced(${COMPILER}_COMPILER_VERSION) -endmacro() - -# Code from James Bigler (http://www.cmake.org/pipermail/cmake/2007-June/014460.html) -set(MANTA_COMPILER_NAME_REGEXPR "icc.*$") -if(NOT CMAKE_COMPILER_IS_GNUCC) - # This regular expression also matches things like icc-9.1 - if(CMAKE_C_COMPILER MATCHES ${MANTA_COMPILER_NAME_REGEXPR}) - set(AKANTU_USING_ICC TRUE) - endif(CMAKE_C_COMPILER MATCHES ${MANTA_COMPILER_NAME_REGEXPR}) -else(NOT CMAKE_COMPILER_IS_GNUCC) - set(AKANTU_USING_GNUCC TRUE) -endif(NOT CMAKE_COMPILER_IS_GNUCC) - -set(MANTA_COMPILER_NAME_REGEXPR "icpc.*$") -if(NOT CMAKE_COMPILER_IS_GNUCXX) - if(CMAKE_CXX_COMPILER MATCHES ${MANTA_COMPILER_NAME_REGEXPR}) - set(AKANTU_USING_ICPC TRUE) - determine_compiler_version(INTEL) - #else mvsc/clang/ibm/... ? - endif(CMAKE_CXX_COMPILER MATCHES ${MANTA_COMPILER_NAME_REGEXPR}) -else(NOT CMAKE_COMPILER_IS_GNUCXX) - set(AKANTU_USING_GNUCXX TRUE) - determine_compiler_version(GCC) -endif(NOT CMAKE_COMPILER_IS_GNUCXX) diff --git a/cmake/AkantuInstall.cmake b/cmake/AkantuInstall.cmake index 32fbb32cd..ef646cd30 100644 --- a/cmake/AkantuInstall.cmake +++ b/cmake/AkantuInstall.cmake @@ -1,123 +1,123 @@ #=============================================================================== # @file AkantuInstall.cmake # # @author Nicolas Richart # # @date Wed Oct 17 15:19:18 2012 # # @brief Create the files that allows users to link with Akantu in an other # cmake project # # @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 . # #=============================================================================== #=============================================================================== # 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 # #=============================================================================== ") foreach(_option ${PACKAGE_SYSTEM_PACKAGES_NAMES_LIST_ALL}) list(FIND AKANTU_OPTION_LIST ${_option_name} _index) if (_index EQUAL -1) if(NOT "${_option}" STREQUAL "CORE") if(NOT AKANTU_${_option}) set(AKANTU_${_option} OFF) endif() file(APPEND "${PROJECT_BINARY_DIR}/AkantuConfigInclude.cmake" " set(AKANTU_HAS_${_option} ${AKANTU_${_option}})") endif() endif() endforeach() file(APPEND "${PROJECT_BINARY_DIR}/AkantuConfigInclude.cmake" " set(AKANTU_HAS_PARTITIONER ${AKANTU_PARTITIONER}) set(AKANTU_HAS_SOLVER ${AKANTU_SOLVER}) ") foreach(_option ${AKANTU_OPTION_LIST}) package_pkg_name(${_option} _pkg_name) file(APPEND "${PROJECT_BINARY_DIR}/AkantuConfigInclude.cmake" " list(APPEND AKANTU_OPTION_LIST ${_option}) set(AKANTU_USE_${_option} ${AKANTU_${_option}})") if(${_pkg_name}_LIBRARIES) file(APPEND "${PROJECT_BINARY_DIR}/AkantuConfigInclude.cmake" " set(${_pkg_name}_LIBRARIES ${${_pkg_name}_LIBRARIES})") endif() if(${_pkg_name}_INCLUDE_DIR) file(APPEND "${PROJECT_BINARY_DIR}/AkantuConfigInclude.cmake" " set(${_pkg_name}_INCLUDE_DIR ${${_pkg_name}_INCLUDE_DIR}) ") endif() endforeach() # 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) # 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 DESTINATION lib/akantu COMPONENT dev) install(FILES - ${PROJECT_SOURCE_DIR}/cmake/FindIOHelper.cmake - ${PROJECT_SOURCE_DIR}/cmake/FindQVIEW.cmake - ${PROJECT_SOURCE_DIR}/cmake/FindMumps.cmake - ${PROJECT_SOURCE_DIR}/cmake/FindScotch.cmake - ${PROJECT_SOURCE_DIR}/cmake/FindGMSH.cmake + ${PROJECT_SOURCE_DIR}/cmake/Modules/FindIOHelper.cmake + ${PROJECT_SOURCE_DIR}/cmake/Modules/FindQVIEW.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/AkantuPackageSystem.cmake b/cmake/AkantuPackageSystem.cmake deleted file mode 100644 index 8b6b1d593..000000000 --- a/cmake/AkantuPackageSystem.cmake +++ /dev/null @@ -1,312 +0,0 @@ -#=============================================================================== -# @file AkantuPackageSystem.cmake -# -# @author Guillaume Anciaux -# @author Nicolas Richart -# -# @date Tue Oct 16 14:05:02 2012 -# -# @brief Set of macros used by akantu to handle the package system -# -# @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 . -# -#=============================================================================== - -#=============================================================================== -# Package Management -#=============================================================================== - -set(PACKAGE_SYSTEM_PKG_PREFIX AKANTU_) -set(PACKAGE_SYSTEM_OPT_PREFIX AKANTU_USE_) -set(PACKAGE_SYSTEM_DESC_PREFIX AKANTU_DESC_) - -macro(package_pkg_name PKG PKG_NAME) - string(TOUPPER ${PKG} _u_package) - set(${PKG_NAME} ${PACKAGE_SYSTEM_PKG_PREFIX}${_u_package}) -endmacro() - -macro(package_opt_name PKG OPT_NAME) - string(TOUPPER ${PKG} _u_package) - set(${OPT_NAME} ${PACKAGE_SYSTEM_OPT_PREFIX}${_u_package}) -endmacro() - -macro(package_desc_name PKG DESC_NAME) - string(TOUPPER ${PKG} _u_package) - set(${DESC_NAME} ${PACKAGE_SYSTEM_DESC_PREFIX}${_u_package}) -endmacro() - -#=============================================================================== -macro(add_all_packages package_dir) - akantu_message("add_all_packages: PKG DIR : ${package_dir}") - file(GLOB _akantu_package_list "${package_dir}/*.cmake") - - foreach(_pkg ${_akantu_package_list}) - get_filename_component(_basename ${_pkg} NAME) - string(REGEX REPLACE "\\.cmake" "" _option_name ${_basename}) - string(TOUPPER "${_option_name}" _option_name) - list(APPEND PACKAGE_SYSTEM_PACKAGES_NAMES_LIST_ALL ${_option_name}) - endforeach() - - akantu_message("add_all_packages: PKG LIST : "${PACKAGE_SYSTEM_PACKAGES_NAMES_LIST_ALL}) - - foreach(_pkg ${PACKAGE_SYSTEM_PACKAGES_NAMES_LIST_ALL}) - akantu_message("add_all_packages: including ${_pkg}") - string(TOLOWER "${_pkg}" _pkg) - include(${package_dir}/${_pkg}.cmake) - package_pkg_name(${_pkg} _package_name) - if (${_package_name}) - list(APPEND PACKAGE_SYSTEM_PACKAGES_ON ${_pkg}) - else (${_package_name}) - list(APPEND PACKAGE_SYSTEM_PACKAGES_OFF ${_pkg}) - endif() - - foreach(_file ${${_package_name}_FILES}) - list(APPEND _release_all_file ${_file}) - endforeach() - endforeach() - - akantu_message("add_all_packages: ON PKG : ${PACKAGE_SYSTEM_PACKAGES_ON}") - akantu_message("add_all_packages: ALL FILE LIST : ${_release_all_file}") - - #check if there are some file in the release that are not registered in a package - file(GLOB_RECURSE __all_files "*.cc" "*.hh") - set(_all_files) - foreach(_file ${__all_files}) - if("${_file}" MATCHES "${CMAKE_SOURCE_DIR}/src") - file(RELATIVE_PATH __file ${CMAKE_SOURCE_DIR}/src ${_file}) - list(APPEND _all_files ${__file}) - endif() - endforeach() - - foreach(_file ${_all_files}) - if(NOT ${_file} MATCHES "test.*" AND NOT ${_file} MATCHES "third-party") - list(FIND _release_all_file ${_file} _index) - if (_index EQUAL -1) - list(APPEND _missing_files_in_packages ${_file}) - message("The file ${_file} is not registered in any package.") - message("Please append the file in one of the files within directory ${CMAKE_SOURCE_DIR}/packages") - endif() - endif() - endforeach() - if(_missing_files_in_packages) - message("A complete list of files missing in the packeges description can be found here: ${CMAKE_BINARY_DIR}/missing_files_in_packages") - if(EXISTS ${CMAKE_BINARY_DIR}/missing_files_in_packages) - file(REMOVE ${CMAKE_BINARY_DIR}/missing_files_in_packages) - endif() - foreach(_file ${_missing_files_in_packages}) - file(APPEND ${CMAKE_BINARY_DIR}/missing_files_in_packages "${_file} -") - endforeach() - endif() - - - #check if there are some file in the package list that are not on the current directory - foreach(_file ${_release_all_file}) - list(FIND _all_files ${_file} _index) - if (_index EQUAL -1) - message("The file ${_file} is registered in packages but is not present in the source directory.") - endif() - endforeach() - - #construct list of files for unactivated packages - foreach(_pkg ${PACKAGE_SYSTEM_PACKAGES_OFF}) - package_pkg_name(${_pkg} _pkg_name) - foreach(_file ${${_pkg_name}_FILES}) - # string(REGEX REPLACE "\\/" "\\\\\\\\/" __file ${_file}) - akantu_message("add_all_packages: ${_file} ${__file}") - # list(APPEND _exclude_source_file "/${__file}/") - list(APPEND AKANTU_EXCLUDE_SOURCE_FILE ${_file}) - endforeach() - endforeach() - - #check dependencies - foreach(_pkg ${PACKAGE_SYSTEM_PACKAGES_OFF}) - # differentiate the file types - akantu_message("add_all_packages: DEPENDS PKG : ${_pkg}") - akantu_message("add_all_packages: DEPENDS LST : ${${_pkg}_DEPENDS}") - package_pkg_name(${_pkg} _pkg_name) - if (NOT "${${_pkg_name}_DEB_DEPEND}" STREQUAL "") - set(deb_depend "${deb_depend}, ${${_pkg}_DEB_DEPEND}") - endif() - endforeach() - set(PACKAGE_SYSTEM_DEBIAN_PACKAGE_DEPENDS "${deb_depend}") -endmacro() - -#=============================================================================== -macro(generate_source_list_from_packages source_dir source_files headers_files include_dirs) - set(deb_depend "libc6") - - akantu_message("generate_source_list_from_packages: SRC DIR : ${source_dir}") - foreach(_pkg ${PACKAGE_SYSTEM_PACKAGES_ON}) - # differentiate the file types - package_pkg_name(${_pkg} _package_name) - foreach(_file ${${_package_name}_FILES}) - if(${_file} MATCHES ".*inline.*\\.cc") -# list(APPEND ${_package_name}_inlines ${_file}) - list(APPEND ${_package_name}_headers ${_file}) - elseif(${_file} MATCHES ".*\\.hh") - list(APPEND ${_package_name}_headers ${_file}) - else() - list(APPEND ${_package_name}_srcs ${_file}) - endif() - endforeach() - - # generates the include directory variable - foreach(_file ${${_package_name}_headers}) - get_filename_component(_absolute_name ${_file} ABSOLUTE) - get_filename_component(_include_dir ${_absolute_name} PATH) - list(APPEND ${_package_name}_include_dirs ${_include_dir}) - list(REMOVE_DUPLICATES ${_package_name}_include_dirs) - endforeach() - - # generate global lists for akantu to know what to build - list(APPEND ${source_files} ${${_package_name}_srcs}) - list(APPEND ${headers_files} ${${_package_name}_headers}) - list(APPEND ${include_dirs} ${${_package_name}_include_dirs}) - - akantu_message("generate_source_list_from_packages: PKG ${_package_name} SRCS : ${${_package_name}_srcs}") - akantu_message("generate_source_list_from_packages: PKG ${_package_name} HRDS : ${${_package_name}_headers}") - akantu_message("generate_source_list_from_packages: PKG ${_package_name} INCS : ${${_package_name}_include_dirs}") - endforeach() - - akantu_message("generate_source_list_from_packages: SRCS : ${${source_files}}") - akantu_message("generate_source_list_from_packages: HRDS : ${${headers_files}}") - akantu_message("generate_source_list_from_packages: INCS : ${${include_dirs}}") -endmacro() - -#=============================================================================== -# macro to include optional packages -macro(add_optional_package PACKAGE DESC DEFAULT) - cmake_parse_arguments(_opt_pkg "" "LANGUAGE" "DEPENDS;PREFIX" ${ARGN}) - - package_pkg_name (${PACKAGE} _pkg_name) - package_opt_name (${PACKAGE} _option_name) - package_desc_name(${PACKAGE} _desc_name) - - akantu_message("add_optional_package: Registering ${PACKAGE} ${DESC} -> ${_option_name}") - - if(_opt_pkg_PREFIX) - set(_package_prefix ${_opt_pkg_PREFIX}) - else() - string(TOUPPER ${PACKAGE} _u_package) - set(_package_prefix ${_u_package}) - endif() - - set(${_desc_name} ${DESC}) - option(${_option_name} ${DESC} ${DEFAULT}) - - if(${_option_name}) - if(_opt_pkg_LANGUAGE) - foreach(_language ${_opt_pkg_LANGUAGE}) - akantu_message("add_optional_package: Package ${PACKAGE} asked for language ${_language}") - enable_language(${_language}) - endforeach() - endif() - - foreach(_dep ${_opt_pkg_DEPENDS}) - add_package_dependecies(${PACKAGE} ${_dep}) - endforeach() - - find_package(${PACKAGE} REQUIRED) - - foreach(_prefix ${_package_prefix}) - if(${_prefix}_FOUND) - list(APPEND AKANTU_DEFINITIONS ${_option_name}) - if(DEFINED ${_prefix}_INCLUDE_DIR) - list(APPEND AKANTU_EXTERNAL_LIB_INCLUDE_DIR ${${_prefix}_INCLUDE_DIR}) - set(${_pkg_name}_INCLUDE_DIR ${${_prefix}_INCLUDE_DIR}) - else() - list(APPEND AKANTU_EXTERNAL_LIB_INCLUDE_DIR ${${_prefix}_INCLUDE_PATH}) - set(${_pkg_name}_INCLUDE_DIR ${${_prefix}_INCLUDE_PATH}) - endif() - list(APPEND AKANTU_EXTERNAL_LIBRARIES ${${_prefix}_LIBRARIES}) - set(${_pkg_name}_LIBRARIES ${${_prefix}_LIBRARIES}) - set(${_pkg_name} ON) - string(TOUPPER ${PACKAGE} _u_package) - list(APPEND AKANTU_OPTION_LIST ${_u_package}) - akantu_message("add_optional_package: Package ${PACKAGE} found!") - akantu_message("add_optional_package: Package ${PACKAGE} includes : ${${_pkg_name}_INCLUDE_DIR}") - akantu_message("add_optional_package: Package ${PACKAGE} libraries: ${${_pkg_name}_LIBRARIES}") - akantu_message("add_optional_package: option list: ${AKANTU_OPTION_LIST}") - else(${_prefix}_FOUND) - akantu_message("add_optional_package: Package ${PACKAGE} not found!") - set(${_pkg_name} OFF) - endif(${_prefix}_FOUND) - endforeach() - endif(${_option_name}) -endmacro() - - -#=============================================================================== -macro(add_package_dependecies PKG DEP) - package_pkg_name (${PKG} _opt_name) - package_opt_name (${DEP} _dep_name) - package_desc_name(${DEP} _var_dep_desc) - - akantu_message("add_package_dependecies: add dependence between ${_opt_name} and ${_dep_name}") - set(_dep_desc ${_var_dep_desc}) - - akantu_message("add_package_dependecies: ON dependencies of ${_dep_name} are: ${${_dep_name}_DEPS}") - akantu_message("add_package_dependecies: saved value for ${_dep_name} is: ${${_dep_name}_OLD}") - if(${_opt_name}) - if("${${_dep_name}_DEPS}" STREQUAL "") - akantu_message("add_package_dependecies: Save dep state ${_dep_name}:${${_dep_name}}") - set(${_dep_name}_OLD ${${_dep_name}} CACHE INTERNAL "${_dep_desc}" FORCE) - endif() - - akantu_message("add_package_dependecies: force value to ON ${_dep_name}") - set(${_dep_name} ON CACHE BOOL "${_dep_desc}" FORCE) - - list(FIND ${_dep_name}_DEPS ${_opt_name} pos) - if(pos EQUAL -1) - list(APPEND ${_dep_name}_DEPS ${_opt_name}) - set(${_dep_name}_DEPS ${${_dep_name}_DEPS} CACHE INTERNAL "Dependencies ON with package ${_dep_name}" FORCE) - endif() - else() - list(LENGTH ${_dep_name}_DEPS len) - list(FIND ${_dep_name}_DEPS ${_opt_name} pos) - if((len EQUAL 1) AND (NOT pos EQUAL -1)) - akantu_message("add_package_dependecies: Restore state ${_dep_name}:${${_dep_name}} (${pos})") - set(${_dep_name} ${${_dep_name}_OLD} CACHE BOOL "${_dep_desc}" FORCE) - unset(${_dep_name}_OLD CACHE) - endif() - - if(NOT pos EQUAL -1) - list(REMOVE_AT ${_dep_name}_DEPS ${pos}) - set(${_dep_name}_DEPS ${${_dep_name}_DEPS} CACHE INTERNAL "Nb dependencies with package ${_dep_name}" FORCE) - endif() - endif() -endmacro() - -#=============================================================================== -# macro to add meta packages -macro(add_meta_package PKG DESC DEFAULT) - akantu_message("add_meta_package: register meta option ${PKG} ${DESC} ${DEFAULT}") - package_pkg_name (${PKG} _pkg_name) - package_desc_name(${PKG} _desc_name) - - set(${_desc_name} ${DESC}) - option(${_pkg_name} ${DESC} ${DEFAULT}) - - foreach(_dep ${ARGN}) - package_opt_name (${_dep} _dep_name) - mark_as_advanced(${_dep_name}) - add_package_dependecies(${PKG} ${_dep}) - endforeach() -endmacro() \ No newline at end of file diff --git a/cmake/AkantuVersion.cmake b/cmake/AkantuVersion.cmake deleted file mode 100644 index 704482998..000000000 --- a/cmake/AkantuVersion.cmake +++ /dev/null @@ -1,59 +0,0 @@ -#=============================================================================== -# @file AkantuVersion.cmake -# -# @author Guillaume Anciaux -# -# @date Wed Oct 17 15:19:18 2012 -# -# @brief Handle the generation of version numbers -# -# @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 . -# -#=============================================================================== - -find_package(Subversion) - -if(EXISTS ${PROJECT_SOURCE_DIR}/.svn) - if(SUBVERSION_FOUND) - subversion_wc_info(${PROJECT_SOURCE_DIR} MY) - set(AKANTU_BUILD_VERSION ${MY_WC_REVISION}) - set(AKANTU_VERSION - "${AKANTU_MAJOR_VERSION}.${AKANTU_MINOR_VERSION}.${AKANTU_PATCH_VERSION}.${AKANTU_BUILD_VERSION}" - ) - file(WRITE VERSION "${AKANTU_VERSION}\n") - else(SUBVERSION_FOUND) - message("SVN control files were found but no subversion executable is present... ") - set(AKANTU_VERSION 0) - endif(SUBVERSION_FOUND) -else(EXISTS ${PROJECT_SOURCE_DIR}/.svn) - if(EXISTS ${PROJECT_SOURCE_DIR}/VERSION) - file(STRINGS VERSION AKANTU_VERSION) - else(EXISTS ${PROJECT_SOURCE_DIR}/VERSION) - message("No SVN control file neither VERSION file could be found. How was this release made ?") - endif(EXISTS ${PROJECT_SOURCE_DIR}/VERSION) -endif(EXISTS ${PROJECT_SOURCE_DIR}/.svn) - - -# Append the library version information to the library target properties -if(NOT AKANTU_NO_LIBRARY_VERSION) - set(AKANTU_LIBRARY_PROPERTIES ${AKANTU_LIBRARY_PROPERTIES} - VERSION "${AKANTU_VERSION}" - SOVERSION "${AKANTU_MAJOR_VERSION}.${AKANTU_MINOR_VERSION}" - ) -endif(NOT AKANTU_NO_LIBRARY_VERSION) diff --git a/cmake/CMakeDebugMessages.cmake b/cmake/CMakeDebugMessages.cmake deleted file mode 100644 index e32795ab6..000000000 --- a/cmake/CMakeDebugMessages.cmake +++ /dev/null @@ -1,70 +0,0 @@ -#=============================================================================== -# @file CMakeDebugMessages.cmake -# -# @author Nicolas Richart -# -# @date Tue Oct 16 14:05:02 2012 -# -# @brief Set of macros used by akantu to handle the package system -# -# @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 . -# -#=============================================================================== - -if(__CMAKE_DEBUG_MESSAGES) - return() -endif() -set(__CMAKE_DEBUG_MESSAGES TRUE) - -macro(cmake_register_debug_message_module module) - set(_CMAKE_DEBUG_MESSAGE_MODULES ${CMAKE_DEBUG_MESSAGE_MODULES}) - list(APPEND _CMAKE_DEBUG_MESSAGE_MODULES ${module}) - set(CMAKE_DEBUG_MESSAGE_MODULES "${_CMAKE_DEBUG_MESSAGE_MODULES}" - CACHE INTERNAL "List of modules handled by the debug messages system" FORCE) -endmacro() - -macro(cmake_activate_debug_message) - set(_default FALSE) - if(NOT ARGN) - set(_default TRUE) - endif() - - foreach(_module ${CMAKE_DEBUG_MESSAGE_MODULES}) - set(CMAKE_DEBUG_MESSAGE_${_module} ${_default} CACHE INTERNAL "" FORCE) - endforeach() - - foreach(_module ${ARGN}) - set(CMAKE_DEBUG_MESSAGE_${_module} TRUE CACHE INTERNAL "" FORCE) - endforeach() -endmacro() - - -macro(cmake_deactivate_debug_message) - foreach(_module ${CMAKE_DEBUG_MESSAGE_MODULES}) - if(CMAKE_DEBUG_MESSAGE_${_module}) - set(CMAKE_DEBUG_MESSAGE_${_module} FALSE CACHE INTERNAL "" FORCE) - endif() - endforeach() -endmacro() - -macro(cmake_debug_message module) - if(CMAKE_DEBUG_MESSAGE_${module}) - message("${PROJECT_NAME} - ${module}: ${ARGN}") - endif() -endmacro() \ No newline at end of file diff --git a/cmake/CMakeFlagsHandling.cmake b/cmake/CMakeFlagsHandling.cmake deleted file mode 100644 index 9a0766cc4..000000000 --- a/cmake/CMakeFlagsHandling.cmake +++ /dev/null @@ -1,67 +0,0 @@ -#=============================================================================== -# @file CMakeFlagsHandling.cmake -# -# @author Nicolas Richart -# -# @date Tue Oct 16 14:05:02 2012 -# -# @brief Set of macros used by akantu to handle the package system -# -# @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 . -# -#=============================================================================== - -if(_CMAKE_FLAGS_HANDLING) - return() -endif() -set(_CMAKE_FLAGS_HANDLING TRUE) - - -#=============================================================================== -# Compilation options handling -#=============================================================================== -macro(_get_flags_message type desc) - if(${type} MATCHES "C..") - set(${desc} "Flags used by the compiler during all build types.") - elseif(${type} MATCHES "EXE_LINKER") - set(${desc} "Flags used by the linker.") - elseif(${type} MATCHES "SHARED_LINKER") - set(${desc} "Flags used by the linker during the creation of dll's.") - endif() -endmacro() - -#=============================================================================== -macro(add_flags type flag) - string(TOUPPER ${type} _type) - set(_var CMAKE_${_type}_FLAGS) - _get_flags_message(${_type} _desc) - if(NOT ${_var} MATCHES "${flag}") - set(${_var} "${flag} ${${_var}}" CACHE STRING ${_desc} FORCE) - endif() -endmacro() - -#=============================================================================== -macro(remove_flags type flag) - string(TOUPPER ${type} _type) - set(_var CMAKE_${_type}_FLAGS) - _get_flags_message(${_type} _desc) - string(REPLACE "${flag} " "" ${_var} "${${_var}}") - set(${_var} "${${_var}}" CACHE STRING ${_desc} FORCE) -endmacro() -#=============================================================================== diff --git a/cmake/CMakePackagesSystem.cmake b/cmake/CMakePackagesSystem.cmake deleted file mode 100644 index 570717f64..000000000 --- a/cmake/CMakePackagesSystem.cmake +++ /dev/null @@ -1,348 +0,0 @@ -#=============================================================================== -# @file CMakePackagesSystem.cmake -# -# @author Guillaume Anciaux -# @author Nicolas Richart -# -# @date Tue Oct 16 14:05:02 2012 -# -# @brief Set of macros used by akantu to handle the package system -# -# @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 . -# -#=============================================================================== - -#=============================================================================== -# Package Management -#=============================================================================== -if(__CMAKE_PACKAGES_SYSTEM) - return() -endif() -set(__CMAKE_PACKAGES_SYSTEM TRUE) - -include(CMakeDebugMessages) -cmake_register_debug_message_module(PackagesSystem) - -macro(package_pkg_name PKG PKG_NAME) - string(TOUPPER ${PROJECT_NAME} _project) - string(TOUPPER ${PKG} _u_package) - set(${PKG_NAME} ${_project}_${_u_package}) -endmacro() - -macro(package_opt_name PKG OPT_NAME) - string(TOUPPER ${PROJECT_NAME} _project) - string(TOUPPER ${PKG} _u_package) - set(${OPT_NAME} ${_project}_USE_${_u_package}) -endmacro() - -macro(package_desc_name PKG DESC_NAME) - string(TOUPPER ${PROJECT_NAME} _project) - string(TOUPPER ${PKG} _u_package) - set(${DESC_NAME} ${_project}_DESC_${_u_package}) -endmacro() - -#=============================================================================== -macro(add_all_packages package_dir src_dir) - string(TOUPPER ${PROJECT_NAME} _project) - cmake_debug_message(PackagesSystem "add_all_packages: PKG DIR : ${package_dir}") - file(GLOB ${_project}_package_list "${package_dir}/*.cmake") - - set(_${_project}_src_dir ${src_dir}) - - foreach(_pkg ${${_project}_package_list}) - get_filename_component(_basename ${_pkg} NAME) - string(REGEX REPLACE "\\.cmake" "" _option_name ${_basename}) - string(TOUPPER "${_option_name}" _option_name) - list(APPEND ${_project}_PACKAGE_SYSTEM_PACKAGES_NAMES_LIST_ALL ${_option_name}) - endforeach() - - cmake_debug_message(PackagesSystem "add_all_packages: PKG LIST : ${${_project}_PACKAGE_SYSTEM_PACKAGES_NAMES_LIST_ALL}") - - foreach(_pkg ${${_project}_PACKAGE_SYSTEM_PACKAGES_NAMES_LIST_ALL}) - cmake_debug_message(PackagesSystem "add_all_packages: including ${_pkg}") - string(TOLOWER "${_pkg}" _pkg) - include(${package_dir}/${_pkg}.cmake) - package_pkg_name(${_pkg} _package_name) - if (${_package_name}) - list(APPEND ${_project}_PACKAGE_SYSTEM_PACKAGES_ON ${_pkg}) - else (${_package_name}) - list(APPEND ${_project}_PACKAGE_SYSTEM_PACKAGES_OFF ${_pkg}) - endif() - - foreach(_file ${${_package_name}_FILES}) - list(APPEND ${_project}_release_all_files ${_file}) - endforeach() - endforeach() - - cmake_debug_message(PackagesSystem "add_all_packages: ON PKG : ${${_project}_PACKAGE_SYSTEM_PACKAGES_ON}") - cmake_debug_message(PackagesSystem "add_all_packages: ALL RELEASE FILES LIST : ${_project}_release_all_files ${${_project}_release_all_files}") - - #check if there are some file in the release that are not registered in a package - file(GLOB_RECURSE ${_project}_all_files "*.cc" "*.hh" "*.c" "*.h") - cmake_debug_message(PackagesSystem "add_all_packages: ALL FILES LIST : ${_project}_all_files ${${_project}_all_files}") - - cmake_debug_message(PackagesSystem "add_all_packages: SOURCE DIR : ${_${_project}_src_dir}") - foreach(_file ${${_project}_all_files}) - if("${_file}" MATCHES "${_${_project}_src_dir}") - file(RELATIVE_PATH __file "${_${_project}_src_dir}" ${_file}) - list(APPEND ${_project}_all_files_relatives ${__file}) - endif() - endforeach() - - foreach(_file ${${_project}_all_files_relatives}) - if(NOT ${_file} MATCHES "test.*" AND NOT ${_file} MATCHES "third-party" AND NOT ${_file} MATCHES "doc") - list(FIND ${_project}_release_all_files ${_file} _index) - if (_index EQUAL -1) - list(APPEND ${_project}_missing_files_in_packages ${_file}) - message("The file ${_file} is not registered in any package.") - message("Please append the file in one of the files within directory ${PROJECT_SOURCE_DIR}/packages") - endif() - endif() - endforeach() - - if(${_project}_missing_files_in_packages) - message("A complete list of files missing in the packeges description can be found here: ${PROJECT_BINARY_DIR}/missing_files_in_packages") - if(EXISTS ${PROJECT_BINARY_DIR}/missing_files_in_packages) - file(REMOVE ${PROJECT_BINARY_DIR}/missing_files_in_packages) - endif() - foreach(_file ${${_project}_missing_files_in_packages}) - file(APPEND ${PROJECT_BINARY_DIR}/missing_files_in_packages "${_file} -") - endforeach() - endif() - - #check if there are some file in the package list that are not on the current directory - foreach(_file ${${_project}_release_all_files}) - list(FIND ${_project}_all_files_relatives ${_file} _index) - if (_index EQUAL -1) - message("The file ${_file} is registered in packages but is not present in the source directory.") - endif() - endforeach() - - #construct list of files for unactivated packages - foreach(_pkg ${${_project}_PACKAGE_SYSTEM_PACKAGES_OFF}) - package_pkg_name(${_pkg} _pkg_name) - foreach(_file ${${_pkg_name}_FILES}) - cmake_debug_message(PackagesSystem "add_all_packages: ${_file}") - list(APPEND ${_project}_EXCLUDE_SOURCE_FILE ${_file}) - endforeach() - endforeach() - - #check dependencies - foreach(_pkg ${${_project}_PACKAGE_SYSTEM_PACKAGES_OFF}) - # differentiate the file types - cmake_debug_message(PackagesSystem "add_all_packages: DEPENDS PKG : ${_pkg}") - cmake_debug_message(PackagesSystem "add_all_packages: DEPENDS LST : ${${_pkg}_DEPENDS}") - package_pkg_name(${_pkg} _pkg_name) - if (NOT "${${_pkg_name}_DEB_DEPEND}" STREQUAL "") - set(deb_depend "${deb_depend}, ${${_pkg}_DEB_DEPEND}") - endif() - endforeach() - set(${_project}_PACKAGE_SYSTEM_DEBIAN_PACKAGE_DEPENDS "${deb_depend}") -endmacro() - -#=============================================================================== -macro(generate_source_list_from_packages source_dir source_files inline_files headers_files include_dirs) - string(TOUPPER ${PROJECT_NAME} _project) - - cmake_debug_message(PackagesSystem "generate_source_list_from_packages: SRC DIR : ${source_dir}") - foreach(_pkg ${${_project}_PACKAGE_SYSTEM_PACKAGES_ON}) - # differentiate the file types - package_pkg_name(${_pkg} _package_name) - cmake_debug_message(PackagesSystem "generate_source_list_from_packages: PKG ${_package_name} FILES : ${${_package_name}_FILES}") - foreach(_file ${${_package_name}_FILES}) - if(${_file} MATCHES ".*inline.*\\.cc") - list(APPEND ${_package_name}_inlines ${_file}) - elseif(${_file} MATCHES ".*\\.h+") - list(APPEND ${_package_name}_headers ${_file}) - else() - list(APPEND ${_package_name}_srcs ${_file}) - endif() - endforeach() - - # generates the include directory variable - foreach(_file ${${_package_name}_headers}) - get_filename_component(_absolute_name ${_file} ABSOLUTE) - get_filename_component(_include_dir ${_absolute_name} PATH) - list(APPEND ${_package_name}_include_dirs ${_include_dir}) - list(REMOVE_DUPLICATES ${_package_name}_include_dirs) - endforeach() - - # generate global lists for akantu to know what to build - list(APPEND ${source_files} ${${_package_name}_srcs}) - list(APPEND ${inline_files} ${${_package_name}_inlines}) - list(APPEND ${headers_files} ${${_package_name}_headers}) - list(APPEND ${include_dirs} ${${_package_name}_include_dirs}) - - cmake_debug_message(PackagesSystem "generate_source_list_from_packages: PKG ${_package_name} SRCS : ${${_package_name}_srcs}") - cmake_debug_message(PackagesSystem "generate_source_list_from_packages: PKG ${_package_name} INLINES : ${${_package_name}_inlines}") - cmake_debug_message(PackagesSystem "generate_source_list_from_packages: PKG ${_package_name} HRDS : ${${_package_name}_headers}") - cmake_debug_message(PackagesSystem "generate_source_list_from_packages: PKG ${_package_name} INCS : ${${_package_name}_include_dirs}") - endforeach() - - cmake_debug_message(PackagesSystem "generate_source_list_from_packages: SRCS : ${${source_files}}") - cmake_debug_message(PackagesSystem "generate_source_list_from_packages: HRDS : ${${headers_files}}") - cmake_debug_message(PackagesSystem "generate_source_list_from_packages: INCS : ${${include_dirs}}") -endmacro() - -#=============================================================================== -# macro to include optional packages -macro(add_optional_external_package PACKAGE DESC DEFAULT) - package_opt_name (${PACKAGE} _option_name) - package_desc_name(${PACKAGE} _desc_name) - set(${_desc_name} ${DESC}) - option(${_option_name} ${DESC} ${DEFAULT}) - _add_external_package(${PACKAGE} ${ARGN}) -endmacro() - -macro(add_external_package PACKAGE) - package_opt_name (${PACKAGE} _option_name) - set(${_option_name} ON) - _add_external_package(${PACKAGE} ${ARGN}) -endmacro() - - -macro(_add_external_package PACKAGE) - string(TOUPPER ${PROJECT_NAME} _project) - cmake_parse_arguments(_opt_pkg "" "LANGUAGE" "DEPENDS;PREFIX;FOUND;ARGS" ${ARGN}) - - package_pkg_name (${PACKAGE} _pkg_name) - package_opt_name (${PACKAGE} _option_name) - - cmake_debug_message(PackagesSystem "add_optional_package: Registering ${PACKAGE} ${DESC} -> ${_option_name}") - - if(_opt_pkg_PREFIX) - set(_package_prefix ${_opt_pkg_PREFIX}) - else() - string(TOUPPER ${PACKAGE} _u_package) - set(_package_prefix ${_u_package}) - endif() - - if(${_option_name}) - if(_opt_pkg_LANGUAGE) - foreach(_language ${_opt_pkg_LANGUAGE}) - cmake_debug_message(PackagesSystem "add_optional_package: Package ${PACKAGE} asked for language ${_language}") - enable_language(${_language}) - endforeach() - endif() - - foreach(_dep ${_opt_pkg_DEPENDS}) - add_external_package_dependencies(${PACKAGE} ${_dep}) - endforeach() - - find_package(${PACKAGE} REQUIRED ${_opt_pkg_ARGS}) - - foreach(_prefix ${_package_prefix}) - if(${_prefix}_FOUND OR _opt_pkg_FOUND) - list(APPEND ${_project}_DEFINITIONS ${_option_name}) - if(DEFINED ${_prefix}_INCLUDE_DIRS) - list(APPEND ${_project}_EXTERNAL_LIB_INCLUDE_DIR ${${_prefix}_INCLUDE_DIRS}) - set(${_pkg_name}_INCLUDE_DIR ${${_prefix}_INCLUDE_DIRS}) - elseif(DEFINED ${_prefix}_INCLUDE_DIR) - list(APPEND ${_project}_EXTERNAL_LIB_INCLUDE_DIR ${${_prefix}_INCLUDE_DIR}) - set(${_pkg_name}_INCLUDE_DIR ${${_prefix}_INCLUDE_DIR}) - elseif(DEFINED ${_prefix}_INCLUDE_PATH) - list(APPEND ${_project}_EXTERNAL_LIB_INCLUDE_DIR ${${_prefix}_INCLUDE_PATH}) - set(${_pkg_name}_INCLUDE_DIR ${${_prefix}_INCLUDE_PATH}) - endif() - list(APPEND ${_project}_EXTERNAL_LIBRARIES ${${_prefix}_LIBRARIES}) - set(${_pkg_name}_LIBRARIES ${${_prefix}_LIBRARIES}) - set(${_pkg_name} ON) - string(TOUPPER ${PACKAGE} _u_package) - list(APPEND ${_project}_OPTION_LIST ${_u_package}) - cmake_debug_message(PackagesSystem "add_optional_package: Package ${PACKAGE} found! (PREFIX: ${_prefix})") - cmake_debug_message(PackagesSystem "add_optional_package: Package ${PACKAGE} includes : ${${_pkg_name}_INCLUDE_DIR}") - cmake_debug_message(PackagesSystem "add_optional_package: Package ${PACKAGE} libraries: ${${_pkg_name}_LIBRARIES}") - cmake_debug_message(PackagesSystem "add_optional_package: option list: ${${_project}_OPTION_LIST}") - else(${_prefix}_FOUND) - cmake_debug_message(PackagesSystem "add_optional_package: Package ${PACKAGE} not found! (PREFIX: ${_prefix})") - set(${_pkg_name} OFF) - endif() - endforeach() - endif(${_option_name}) -endmacro() - -#=============================================================================== -# macro to add meta packages -macro(add_meta_package PKG DESC DEFAULT) - cmake_debug_message(PackagesSystem "add_meta_package: register meta option ${PKG} ${DESC} ${DEFAULT}") - package_pkg_name (${PKG} _pkg_name) - package_desc_name(${PKG} _desc_name) - - set(${_desc_name} ${DESC}) - option(${_pkg_name} ${DESC} ${DEFAULT}) - - foreach(_dep ${ARGN}) - package_opt_name (${_dep} _dep_name) - mark_as_advanced(${_dep_name}) - add_external_package_dependencies(${PKG} ${_dep}) - endforeach() -endmacro() - -#=============================================================================== -macro(_add_package_dependencies PKG DEP _dep_name) - package_pkg_name (${PKG} _opt_name) - package_desc_name(${DEP} _var_dep_desc) - - cmake_debug_message(PackagesSystem "add_package_dependecies: add dependence between ${_opt_name} and ${_dep_name}") - set(_dep_desc ${_var_dep_desc}) - - cmake_debug_message(PackagesSystem "add_package_dependecies: ON dependencies of ${_dep_name} are: ${${_dep_name}_DEPS}") - cmake_debug_message(PackagesSystem "add_package_dependecies: saved value for ${_dep_name} is: ${${_dep_name}_OLD}") - if(${_opt_name}) - if("${${_dep_name}_DEPS}" STREQUAL "") - cmake_debug_message(PackagesSystem "add_package_dependecies: Save dep state ${_dep_name}:${${_dep_name}}") - set(${_dep_name}_OLD ${${_dep_name}} CACHE INTERNAL "${_dep_desc}" FORCE) - endif() - - cmake_debug_message(PackagesSystem "add_package_dependecies: force value to ON ${_dep_name}") - set(${_dep_name} ON CACHE BOOL "${_dep_desc}" FORCE) - - list(FIND ${_dep_name}_DEPS ${_opt_name} pos) - if(pos EQUAL -1) - list(APPEND ${_dep_name}_DEPS ${_opt_name}) - set(${_dep_name}_DEPS ${${_dep_name}_DEPS} CACHE INTERNAL "Dependencies ON with package ${_dep_name}" FORCE) - endif() - else() - list(LENGTH ${_dep_name}_DEPS len) - list(FIND ${_dep_name}_DEPS ${_opt_name} pos) - if((len EQUAL 1) AND (NOT pos EQUAL -1)) - cmake_debug_message(PackagesSystem "add_package_dependecies: Restore state ${_dep_name}:${${_dep_name}} (${pos})") - set(${_dep_name} ${${_dep_name}_OLD} CACHE BOOL "${_dep_desc}" FORCE) - unset(${_dep_name}_OLD CACHE) - endif() - - if(NOT pos EQUAL -1) - list(REMOVE_AT ${_dep_name}_DEPS ${pos}) - set(${_dep_name}_DEPS ${${_dep_name}_DEPS} CACHE INTERNAL "Nb dependencies with package ${_dep_name}" FORCE) - endif() - endif() -endmacro() - -#=============================================================================== -macro(add_internal_package_dependencies PKG DEP) - package_pkg_name (${DEP} _dep_name) - _add_package_dependencies(${PKG} ${DEP} ${_dep_name}) -endmacro() - -#=============================================================================== -macro(add_external_package_dependencies PKG DEP) - package_opt_name (${DEP} _dep_name) - _add_package_dependencies(${PKG} ${DEP} ${_dep_name}) -endmacro() diff --git a/cmake/CMakeVersionGenerator.cmake b/cmake/CMakeVersionGenerator.cmake deleted file mode 100644 index 0e7ff4098..000000000 --- a/cmake/CMakeVersionGenerator.cmake +++ /dev/null @@ -1,68 +0,0 @@ -#=============================================================================== -# @file CMakeVersionGenerator.cmake -# -# @author Guillaume Anciaux -# @author Nicolas Richart -# -# @date Tue Oct 16 14:05:02 2012 -# -# @brief Set of macros used by akantu to handle the package system -# -# @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 . -# -#=============================================================================== - -if(__DEFINE_PROJECT_VERSION__) - return() -endif() -set(__DEFINE_PROJECT_VERSION__ TRUE) - -macro(define_project_version) - find_package(Subversion) - string(TOUPPER ${PROJECT_NAME} _project) - - if(EXISTS ${PROJECT_SOURCE_DIR}/.svn) - if(SUBVERSION_FOUND) - subversion_wc_info(${PROJECT_SOURCE_DIR} MY) - set(${_project}_BUILD_VERSION ${MY_WC_REVISION}) - set(${_project}_VERSION - "${${_project}_MAJOR_VERSION}.${${_project}_MINOR_VERSION}.${${_project}_PATCH_VERSION}.${${_project}_BUILD_VERSION}" - ) - file(WRITE VERSION "${${_project}_VERSION}\n") - else(SUBVERSION_FOUND) - message("SVN control files were found but no subversion executable is present... ") - set(${_project}_VERSION 0) - endif(SUBVERSION_FOUND) - else(EXISTS ${PROJECT_SOURCE_DIR}/.svn) - if(EXISTS ${PROJECT_SOURCE_DIR}/VERSION) - file(STRINGS VERSION ${_project}_VERSION) - else(EXISTS ${PROJECT_SOURCE_DIR}/VERSION) - message("No SVN control file neither VERSION file could be found. How was this release made ?") - endif(EXISTS ${PROJECT_SOURCE_DIR}/VERSION) - endif(EXISTS ${PROJECT_SOURCE_DIR}/.svn) - - - # Append the library version information to the library target properties - if(NOT ${_project}_NO_LIBRARY_VERSION) - set(${_project}_LIBRARY_PROPERTIES ${${_project}_LIBRARY_PROPERTIES} - VERSION "${${_project}_VERSION}" - SOVERSION "${${_project}_MAJOR_VERSION}.${${_project}_MINOR_VERSION}" - ) - endif(NOT ${_project}_NO_LIBRARY_VERSION) -endmacro() \ No newline at end of file diff --git a/cmake/FindCBLAS.cmake b/cmake/FindCBLAS.cmake deleted file mode 100644 index 95c711ba0..000000000 --- a/cmake/FindCBLAS.cmake +++ /dev/null @@ -1,34 +0,0 @@ -#=============================================================================== -# @file FindCBLAS.cmake -# @author Alejandro M. Aragón -# @date Thu Apr 19 16:44:00 2012 -# -# @brief The find_package file for the CBLAS library -# -# @section LICENSE -# -# Copyright (©) 2010-2012 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 . -# -#=============================================================================== - -find_library (CBLAS_LIBRARY cblas) - -set(CBLAS_LIBRARIES ${CBLAS_LIBRARY} CACHE INTERNAL "Libraries for CBLAS" FORCE) - -find_path (CBLAS_INCLUDE_DIR cblas.h) -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(CBLAS DEFAULT_MSG CBLAS_INCLUDE_DIR CBLAS_LIBRARIES) \ No newline at end of file diff --git a/cmake/FindEPSN.cmake b/cmake/FindEPSN.cmake deleted file mode 100644 index 3df5b835b..000000000 --- a/cmake/FindEPSN.cmake +++ /dev/null @@ -1,55 +0,0 @@ -#=============================================================================== -# @file FindEPSN.cmake -# -# @author Nicolas Richart -# -# @date Mon Dec 13 10:44:16 2010 -# -# @brief The find_package file for EPSN -# -# @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 . -# -#=============================================================================== - -#=============================================================================== -find_path(EPSN_DIR EPSNConfig.cmake - PATHS $ENV{EPSN_TOP} - ) - - -if(EPSN_DIR) - include(${EPSN_DIR}/EPSNConfig.cmake) - set(EPSN_LIB_PATH ${EPSN_DIR}/lib - ${EPSN_LIBRARIES_DIR} - ) - find_library(EPSN_COMMON_LIBRARY epsn_common - PATHS ${EPSN_LIB_PATH} - ) - find_library(EPSN_SIMULATION_LIBRARY epsn_simulation - PATHS ${EPSN_LIB_PATH} - ) - include(${EPSN_DIR}/EPSNLibraryDepends.cmake) - - set(EPSN_LIBRARIES ${EPSN_SIMULATION_LIBRARY} ${EPSN_COMMON_LIBRARY}) -endif(EPSN_DIR) - -#=============================================================================== -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(EPSN DEFAULT_MSG - EPSN_LIBRARIES EPSN_INCLUDE_DIR) diff --git a/cmake/FindGMSH.cmake b/cmake/FindGMSH.cmake deleted file mode 100644 index 7a15d8511..000000000 --- a/cmake/FindGMSH.cmake +++ /dev/null @@ -1,74 +0,0 @@ -#=============================================================================== -# @file FindGMSH.cmake -# -# @author Nicolas Richart -# -# @date Fri Oct 15 09:29:57 2010 -# -# @brief Find gmsh and delacre the add_mesh macro -# -# @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 . -# -#=============================================================================== - -find_program(GMSH gmsh - DOC "The mesh generetor gmsh") - -find_package(PackageHandleStandardArgs) -find_package_handle_standard_args(GMSH DEFAULT_MSG GMSH) - -#=============================================================================== -macro(ADD_MESH MESH_TARGET GEO_FILE DIM ORDER) - if(GMSH_FOUND) - set(arguments - ${MESH_TARGET} ${GEO_FILE} ${DIM} ${ORDER} - ${ARGN} - ) - - cmake_parse_arguments(ADD_MESH - "" - "OUTPUT" - "" - ${arguments} - ) - - set(_geo_file ${CMAKE_CURRENT_SOURCE_DIR}/${GEO_FILE}) - - if(ADD_MESH_OUTPUT) - set(_msh_file ${CMAKE_CURRENT_BINARY_DIR}/${ADD_MESH_OUTPUT}) - else(ADD_MESH_OUTPUT) - get_filename_component(_msh_file "${GEO_FILE}" NAME_WE) - set(_msh_file ${CMAKE_CURRENT_BINARY_DIR}/${_msh_file}.msh) - endif(ADD_MESH_OUTPUT) - - if(EXISTS ${_geo_file}) - add_custom_command( - OUTPUT ${_msh_file} - DEPENDS ${_geo_file} - COMMAND ${GMSH} - ARGS -${DIM} -order ${ORDER} -optimize -o ${_msh_file} ${_geo_file} 2>&1 > /dev/null - ) - add_custom_target(${MESH_TARGET} - DEPENDS ${_msh_file}) - set_target_properties(${MESH_TARGET} PROPERTIES RESSOURCES ${_geo_file}) - #else(EXISTS ${_geo_file}) - # message("File ${_geo_file} not found") - endif(EXISTS ${_geo_file}) - endif(GMSH_FOUND) -endmacro(ADD_MESH) diff --git a/cmake/FindIOHelper.cmake b/cmake/FindIOHelper.cmake deleted file mode 100644 index f65a86b82..000000000 --- a/cmake/FindIOHelper.cmake +++ /dev/null @@ -1,59 +0,0 @@ -#=============================================================================== -# @file FindIOHelper.cmake -# -# @author Nicolas Richart -# -# @date Wed Aug 04 10:58:42 2010 -# -# @brief The find_package file for IOHelper -# -# @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 . -# -#=============================================================================== - -#=============================================================================== -#set(IOHELPER_LIBRARY "NOTFOUND" CACHE INTERNAL "Cleared" FORCE) -find_library(IOHELPER_LIBRARY iohelper - PATHS ${IOHELPER_DIR} - PATH_SUFFIXES lib - ) - -find_path(IOHELPER_INCLUDE_DIR io_helper.hh - PATHS ${IOHELPER_DIR} - PATH_SUFFIXES include include/iohelper - ) - -#=============================================================================== -mark_as_advanced(IOHELPER_LIBRARY) -mark_as_advanced(IOHELPER_INCLUDE_DIR) - -#=============================================================================== -find_package(ZLIB REQUIRED) - -set(IOHELPER_LIBRARIES_ALL ${IOHELPER_LIBRARY} ${ZLIB_LIBRARIES}) -set(IOHELPER_LIBRARIES ${IOHELPER_LIBRARIES_ALL} CACHE INTERNAL "Libraries for IOHelper" FORCE) - -#=============================================================================== -if(NOT IOHELPER_FOUND) - set(IOHELPER_DIR "" CACHE PATH "Location of IOHelper source directory.") -endif() - -#=============================================================================== -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(IOHelper DEFAULT_MSG IOHELPER_LIBRARY IOHELPER_INCLUDE_DIR) diff --git a/cmake/FindMumps.cmake b/cmake/FindMumps.cmake deleted file mode 100644 index 82b8a4cb2..000000000 --- a/cmake/FindMumps.cmake +++ /dev/null @@ -1,104 +0,0 @@ -#=============================================================================== -# @file FindMumps.cmake -# -# @author Nicolas Richart -# -# @date Mon Dec 13 10:48:06 2010 -# -# @brief The find_package file for the Mumps solver -# -# @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 . -# -#=============================================================================== - -#=============================================================================== -find_library(MUMPS_LIBRARY_DMUMPS NAMES dmumps_seq dmumps_ptscotch dmumps - PATHS ${MUMPS_DIR} /usr - PATH_SUFFIXES lib - ) - -find_library(MUMPS_LIBRARY_COMMON NAMES mumps_seq mumps_common_ptscotch mumps_common - PATHS ${MUMPS_DIR} - PATH_SUFFIXES lib - ) - -find_library(MUMPS_LIBRARY_PORD NAMES pord_seq pord_ptscotch pord - PATHS ${MUMPS_DIR} - PATH_SUFFIXES lib - ) - - -find_path(MUMPS_INCLUDE_DIR dmumps_c.h - PATHS ${MUMPS_DIR} - PATH_SUFFIXES include - ) - - -find_library(BLACS_LIBRARY_C NAME blacsC - PATHS ${MUMPS_DIR} PATH_SUFFIXES lib) -find_library(BLACS_LIBRARY_F77 NAME blacsF77 - PATHS ${MUMPS_DIR} PATH_SUFFIXES lib) -find_library(BLACS_LIBRARY NAME blacs - PATHS ${MUMPS_DIR} PATH_SUFFIXES lib) -find_library(SCALAPACK_LIBRARY NAME scalapack - PATHS ${MUMPS_DIR} PATH_SUFFIXES lib) - -#enable_language(Fortran) -#find_package(BLAS REQUIRED) -#find_package(LAPACK REQUIRED) -##=============================================================================== -mark_as_advanced(MUMPS_LIBRARY_COMMON) -mark_as_advanced(MUMPS_LIBRARY_DMUMPS) -mark_as_advanced(MUMPS_LIBRARY_PORD) -mark_as_advanced(MUMPS_INCLUDE_DIR) - -mark_as_advanced(BLACS_LIBRARY_C) -mark_as_advanced(BLACS_LIBRARY_F77) -mark_as_advanced(BLACS_LIBRARY) -mark_as_advanced(SCALAPACK_LIBRARY) - -set(MUMPS_LIBRARIES_ALL ${MUMPS_LIBRARY_DMUMPS} ${MUMPS_LIBRARY_COMMON} ${MUMPS_LIBRARY_PORD}) - -if(SCALAPACK_LIBRARY) - set(BLACS_LIBRARIES_ALL ${BLACS_LIBRARIES_ALL} ${SCALAPACK_LIBRARY}) -endif() -if(BLACS_LIBRARY_F77) - set(BLACS_LIBRARIES_ALL ${BLACS_LIBRARIES_ALL} ${BLACS_LIBRARY_F77}) -endif() -if(BLACS_LIBRARY) - set(BLACS_LIBRARIES_ALL ${BLACS_LIBRARIES_ALL} ${BLACS_LIBRARY}) -endif() -if(BLACS_LIBRARY_C) - set(BLACS_LIBRARIES_ALL ${BLACS_LIBRARIES_ALL} ${BLACS_LIBRARY_C}) -endif() -if(BLACS_LIBRARY_F77) - set(BLACS_LIBRARIES_ALL ${BLACS_LIBRARIES_ALL} ${BLACS_LIBRARY_F77}) -endif() - -set(MUMPS_LIBRARIES ${MUMPS_LIBRARIES_ALL} ${BLACS_LIBRARIES_ALL} ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} CACHE INTERNAL "Libraries for MUMPS" FORCE) - - -#=============================================================================== -if(NOT Mumps_FOUND) - set(MUMPS_DIR "" CACHE PATH "Prefix of MUMPS library.") -endif(NOT Mumps_FOUND) -#=============================================================================== -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Mumps DEFAULT_MSG - MUMPS_LIBRARIES MUMPS_INCLUDE_DIR) \ No newline at end of file diff --git a/cmake/FindPTScotch.cmake b/cmake/FindPTScotch.cmake deleted file mode 100644 index ac16be3a3..000000000 --- a/cmake/FindPTScotch.cmake +++ /dev/null @@ -1,86 +0,0 @@ -#=============================================================================== -# @file FindPTScotch.cmake -# -# @author Nicolas Richart -# -# @date Tue Apr 05 18:49:26 2011 -# -# @brief The find_package file for PT-Scotch -# -# @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 . -# -#=============================================================================== - -#=============================================================================== -#if(PTSCOTCH_DIR) -# set(PTSCOTCH_LIBRARY "NOTFOUND" CACHE INTERNAL "Cleared" FORCE) -#endif(PTSCOTCH_DIR) - -find_library(PTSCOTCH_LIBRARY ptscotch - PATHS ${PTSCOTCH_DIR} - PATH_SUFFIXES src/libscotch lib - ) - -find_library(PTSCOTCH_LIBRARY_ERR ptscotcherr - PATHS ${PTSCOTCH_DIR} - PATH_SUFFIXES src/libscotch lib - ) - -find_library(PTSCOTCH_LIBRARY_ESMUMPS ptesmumps - PATHS ${PTSCOTCH_DIR} - PATH_SUFFIXES src/libscotch lib - ) - -find_path(PTSCOTCH_INCLUDE_PATH ptscotch.h - PATHS ${PTSCOTCH_DIR} - PATH_SUFFIXES include scotch src/libscotch include/scotch - ) - -#=============================================================================== -mark_as_advanced(PTSCOTCH_LIBRARY) -mark_as_advanced(PTSCOTCH_LIBRARY_ERR) -mark_as_advanced(PTSCOTCH_LIBRARY_ESMUMPS) -mark_as_advanced(PTSCOTCH_INCLUDE_PATH) - -set(PTSCOTCH_LIBRARIES_ALL ${PTSCOTCH_LIBRARY} ${PTSCOTCH_LIBRARY_ERR}) - -if(PTSCOTCH_LIBRARY_ESMUMPS) - set(PTSCOTCH_LIBRARIES_ALL ${PTSCOTCH_LIBRARY_ESMUMPS} ${PTSCOTCH_LIBRARIES_ALL}) -endif() - -set(PTSCOTCH_LIBRARIES ${PTSCOTCH_LIBRARIES_ALL} CACHE INTERNAL "Libraries for PT-Scotch" FORCE) - -#=============================================================================== -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(PTSCOTCH DEFAULT_MSG - PTSCOTCH_LIBRARY PTSCOTCH_LIBRARY_ERR PTSCOTCH_INCLUDE_PATH) - - -if(PTSCOTCH_INCLUDE_PATH) - file(STRINGS ${PTSCOTCH_INCLUDE_PATH}/scotch.h PTSCOTCH_INCLUDE_CONTENT) - string(REGEX MATCH "_cplusplus" _match ${PTSCOTCH_INCLUDE_CONTENT}) - if(_match) - add_definitions(-DAKANTU_PTSCOTCH_NO_EXTERN) - endif() -endif() - -#=============================================================================== -if(NOT PTSCOTCH_FOUND) - set(PTSCOTCH_DIR "" CACHE PATH "Location of PT-Scotch library.") -endif(NOT PTSCOTCH_FOUND) diff --git a/cmake/FindQVIEW.cmake b/cmake/FindQVIEW.cmake deleted file mode 100644 index 0a08290c6..000000000 --- a/cmake/FindQVIEW.cmake +++ /dev/null @@ -1,48 +0,0 @@ -#=============================================================================== -# @file FindQVIEW.cmake -# -# @author Guillaume Anciaux -# -# @date Mon Jun 27 17:56:45 2011 -# -# @brief The find_package file for libQVIEW -# -# @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 . -# -#=============================================================================== - -find_library(QVIEW_LIBRARIES NAME qview - PATHS ${QVIEW_DIR} - PATH_SUFFIXES lib - ) -#=============================================================================== -find_path(QVIEW_INCLUDE_DIR libqview.h - PATHS ${QVIEW_DIR} - PATH_SUFFIXES include src - ) -#=============================================================================== -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(QVIEW DEFAULT_MSG - QVIEW_LIBRARIES QVIEW_INCLUDE_DIR) - -#=============================================================================== -if(NOT QVIEW_FOUND) - set(QVIEW_DIR "" CACHE PATH "Location of QVIEW library.") -endif(NOT QVIEW_FOUND) - diff --git a/cmake/FindScotch.cmake b/cmake/FindScotch.cmake deleted file mode 100644 index 9c4f4aaa3..000000000 --- a/cmake/FindScotch.cmake +++ /dev/null @@ -1,84 +0,0 @@ -#=============================================================================== -# @file FindScotch.cmake -# -# @author Nicolas Richart -# -# @date Wed Sep 01 17:57:12 2010 -# -# @brief The find_package file for Scotch -# -# @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 . -# -#=============================================================================== - -#=============================================================================== -#if(SCOTCH_DIR) -# set(SCOTCH_LIBRARY "NOTFOUND" CACHE INTERNAL "Cleared" FORCE) -#endif(SCOTCH_DIR) - -find_library(SCOTCH_LIBRARY scotch - PATHS ${SCOTCH_DIR} - PATH_SUFFIXES src/libscotch lib - ) - -find_library(SCOTCH_LIBRARY_ERR scotcherr - PATHS ${SCOTCH_DIR} - PATH_SUFFIXES src/libscotch lib - ) - -find_library(SCOTCH_LIBRARY_ERREXIT scotcherrexit - PATHS ${SCOTCH_DIR} - PATH_SUFFIXES src/libscotch lib - ) - -find_library(SCOTCH_LIBRARY_ESMUMPS ptesmumps - PATHS ${SCOTCH_DIR} - PATH_SUFFIXES src/libscotch lib - ) - -find_path(SCOTCH_INCLUDE_DIR scotch.h - PATHS ${SCOTCH_DIR} - PATH_SUFFIXES include scotch src/libscotch include/scotch - ) - -#=============================================================================== -mark_as_advanced(SCOTCH_LIBRARY) -mark_as_advanced(SCOTCH_LIBRARY_ERR) -mark_as_advanced(SCOTCH_LIBRARY_ERREXIT) -mark_as_advanced(SCOTCH_LIBRARY_ESMUMPS) -mark_as_advanced(SCOTCH_INCLUDE_DIR) - -set(SCOTCH_LIBRARIES_ALL ${SCOTCH_LIBRARY} ${SCOTCH_LIBRARY_ERR}) - -if(SCOTCH_LIBRARY_ESMUMPS) - set(SCOTCH_LIBRARIES_ALL ${SCOTCH_LIBRARY_ESMUMPS} ${SCOTCH_LIBRARIES_ALL}) -endif() - -set(SCOTCH_LIBRARIES ${SCOTCH_LIBRARIES_ALL} CACHE INTERNAL "Libraries for scotch" FORCE) - -#=============================================================================== -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Scotch DEFAULT_MSG - SCOTCH_LIBRARY SCOTCH_LIBRARY_ERR SCOTCH_INCLUDE_DIR) - - -#=============================================================================== -if(NOT SCOTCH_FOUND) - set(SCOTCH_DIR "" CACHE PATH "Location of Scotch library.") -endif() diff --git a/cmake/PCHgcc.cmake b/cmake/PCHgcc.cmake deleted file mode 100644 index 47a9740ff..000000000 --- a/cmake/PCHgcc.cmake +++ /dev/null @@ -1,54 +0,0 @@ -# (ADD_PCH_RULE _header_filename _src_list) -# Version 7/26/2010 4:55pm -# -# use this macro before "add_executable" -# -# _header_filename -# header to make a .gch -# -# _src_list -# the variable name (do not use ${..}) which contains a -# a list of sources (a.cpp b.cpp c.cpp ...) -# This macro will append a header file to it, then this src_list can be used in -# "add_executable..." -# -# -# Now a .gch file should be generated and gcc should use it. -# (add -Winvalid-pch to the cpp flags to verify) -# -# make clean should delete the pch file -# -# example : ADD_PCH_RULE(headers.h myprog_SRCS) - - -macro(ADD_PCH_RULE _header_filename _src_list) - set(_gch_filename "${CMAKE_CURRENT_BINARY_DIR}/${_header_filename}.gch") - - list(APPEND ${_src_list} ${_gch_filename}) - - set(_args ${CMAKE_CXX_FLAGS} -D__aka_inline__=inline) - - get_filename_component(_gch_filename_path ${_gch_filename} PATH) - file(MAKE_DIRECTORY ${_gch_filename_path}) - - # list(APPEND _args -c ${CMAKE_CURRENT_SOURCE_DIR}/${_header_filename}) - list(APPEND _args -c ${CMAKE_CURRENT_SOURCE_DIR}/${_header_filename} -o ${_gch_filename} -Winvalid-pch) - - get_directory_property(DIRINC INCLUDE_DIRECTORIES) - foreach (_inc ${DIRINC}) - list(APPEND _args "-I" ${_inc}) - endforeach(_inc ${DIRINC}) - separate_arguments(_args) - - set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${_header_filename} PROPERTIES GENERATED 1) - set_source_files_properties(${_gch_filename} PROPERTIES GENERATED 1) - add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_header_filename} - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/${_header_filename} ${CMAKE_CURRENT_BINARY_DIR}/${_header_filename} # ensure same directory! Required by gcc - DEPENDS ${_header_filename} - ) - - add_custom_command(OUTPUT ${_gch_filename} - COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} ${_args} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_header_filename} - ) -endmacro(ADD_PCH_RULE _header_filename _src_list) diff --git a/packages/blas.cmake b/packages/blas.cmake index 3ad103b51..acf8fe278 100644 --- a/packages/blas.cmake +++ b/packages/blas.cmake @@ -1,34 +1,34 @@ #=============================================================================== # @file blas.cmake # # @author Nicolas Richart # # @date Fri Oct 19 15:58:42 2012 # # @brief package description for blas support # # @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 . # #=============================================================================== add_optional_external_package(BLAS "Use BLAS for arithmetic operations" OFF LANGUAGE Fortran) + if(BLAS_mkl_core_LIBRARY) set(AKANTU_USE_BLAS_MKL) endif() - diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 514f010fc..334f6d788 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,104 +1,105 @@ #=============================================================================== # @file CMakeLists.txt # # @author Guillaume Anciaux # @author Nicolas Richart # # @date Mon Nov 28 16:54:12 2011 # # @brief CMake file for the library # # @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 . # #=============================================================================== #=============================================================================== # Package Management #=============================================================================== generate_source_list_from_packages(${CMAKE_CURRENT_BINARY_DIR} AKANTU_LIBRARY_SRCS AKANTU_LIBRARY_INLINE_HDRS AKANTU_LIBRARY_HDRS AKANTU_LIBRARY_INCLUDE_DIRS) #=========================================================================== # header precompilation #=========================================================================== set(AKANTU_COMMON_HDR_TO_PRECOMPILE common/aka_vector.hh common/aka_math.hh common/aka_types.hh fem/element_class.hh ) set(AKANTU_PRECOMPILE_HDR_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/common/ ${CMAKE_CURRENT_BINARY_DIR}/fem/ ) list(APPEND AKANTU_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR} ${AKANTU_LIBRARY_INCLUDE_DIRS} ${AKANTU_PRECOMPILE_HDR_INCLUDE_DIRS}) set(AKANTU_INCLUDE_DIRS ${AKANTU_INCLUDE_DIRS} PARENT_SCOPE) include_directories(${AKANTU_INCLUDE_DIRS} ${AKANTU_EXTERNAL_LIB_INCLUDE_DIR}) if(CMAKE_COMPILER_IS_GNUCXX) - include(${PROJECT_SOURCE_DIR}/cmake/PCHgcc.cmake) + include(PCHgcc) foreach(_header ${AKANTU_COMMON_HDR_TO_PRECOMPILE}) add_pch_rule(${_header} AKANTU_LIBRARY_SRCS) endforeach() elseif(CMAKE_COMPILER_IS_GNUCXX) endif() #=============================================================================== # Library generation #=============================================================================== configure_file(common/aka_config.hh.in "${CMAKE_CURRENT_BINARY_DIR}/aka_config.hh" @ONLY) list(APPEND AKANTU_LIBRARY_HDRS ${CMAKE_CURRENT_BINARY_DIR}/aka_config.hh) add_library(akantu ${AKANTU_LIBRARY_SRCS}) target_link_libraries(akantu ${AKANTU_EXTERNAL_LIBRARIES}) +list(APPEND AKANTU_PUBLIC_HDRS ${AKANTU_LIBRARY_HDRS} ${AKANTU_LIBRARY_INLINE_HDRS}) set_target_properties(akantu PROPERTIES ${AKANTU_LIBRARY_PROPERTIES}) -set_target_properties(akantu PROPERTIES PUBLIC_HEADER "${AKANTU_LIBRARY_HDRS}:${AKANTU_LIBRARY_INLINE_HDRS}") +set_target_properties(akantu PROPERTIES PUBLIC_HEADER "${AKANTU_PUBLIC_HDRS}") list(APPEND AKANTU_EXPORT_LIST akantu) install(TARGETS akantu EXPORT ${AKANTU_TARGETS_EXPORT} - LIBRARY DESTINATION lib COMPONENT shlib - ARCHIVE DESTINATION lib COMPONENT dev + LIBRARY DESTINATION lib COMPONENT lib + ARCHIVE DESTINATION lib COMPONENT lib PUBLIC_HEADER DESTINATION include/akantu/ COMPONENT dev ) if("${AKANTU_TARGETS_EXPORT}" STREQUAL "AkantuLibraryDepends") install(EXPORT AkantuLibraryDepends DESTINATION lib/akantu COMPONENT dev) endif() #Export for build tree export(TARGETS ${AKANTU_EXPORT_LIST} FILE "${CMAKE_BINARY_DIR}/AkantuLibraryDepends.cmake") export(PACKAGE Akantu)