diff --git a/CMakeLists.txt b/CMakeLists.txt index 383ae3ecd..98b8bebba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,187 +1,190 @@ #=============================================================================== # @file CMakeLists.txt # # @author Guillaume Anciaux # @author Nicolas Richart # # @date creation: Mon Jun 14 2010 # @date last modification: Fri Jan 22 2016 # # @brief main configuration file # # @section LICENSE # # Copyright (©) 2010-2012, 2014, 2015 EPFL (Ecole Polytechnique Fédérale de # Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des # Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # # @section DESCRIPTION #------------------------------------------------------------------------------- # _ _ # | | | | # __ _| | ____ _ _ __ | |_ _ _ # / _` | |/ / _` | '_ \| __| | | | # | (_| | < (_| | | | | |_| |_| | # \__,_|_|\_\__,_|_| |_|\__|\__,_| # #=============================================================================== #=============================================================================== # CMake Project #=============================================================================== cmake_minimum_required(VERSION 3.1.3) # add this options before PROJECT keyword set(CMAKE_DISABLE_SOURCE_CHANGES ON) set(CMAKE_DISABLE_IN_SOURCE_BUILD ON) project(Akantu) enable_language(CXX) #=============================================================================== # Misc. config for cmake #=============================================================================== set(AKANTU_CMAKE_DIR "${PROJECT_SOURCE_DIR}/cmake") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/Modules") set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries.") mark_as_advanced(BUILD_SHARED_LIBS) if(NOT AKANTU_TARGETS_EXPORT) set(AKANTU_TARGETS_EXPORT AkantuLibraryDepends) endif() include(CMakeVersionGenerator) include(CMakePackagesSystem) include(CMakeFlagsHandling) include(AkantuPackagesSystem) include(AkantuMacros) include(AkantuCleaning) #cmake_activate_debug_message() #=============================================================================== # Version Number #=============================================================================== # AKANTU version number. An even minor number corresponds to releases. set(AKANTU_MAJOR_VERSION 3) set(AKANTU_MINOR_VERSION 0) set(AKANTU_PATCH_VERSION 0) define_project_version() #=============================================================================== # Options #=============================================================================== # Debug set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -DAKANTU_NDEBUG" CACHE STRING "Flags used by the compiler during release builds" FORCE) #add_flags(cxx "-Wall -Wextra -pedantic -Werror") if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") add_flags(cxx "-Wall -Wextra -pedantic") # -Weffc++ else() add_flags(cxx "-Wall") endif() option(AKANTU_EXAMPLES "Activate examples" OFF) option(AKANTU_TESTS "Activate tests" OFF) +set(AKANTU_PREFERRED_PYTHON_VERSION 3 CACHE STRING "Preferred version for python related things") +mark_as_advanced(AKANTU_PREFERED_PYTHON_VERSION) + include(AkantuExtraCompilationProfiles) #=============================================================================== # Dependencies #=============================================================================== declare_akantu_types() package_list_packages(${PROJECT_SOURCE_DIR}/packages EXTRA_PACKAGES_FOLDER ${PROJECT_SOURCE_DIR}/extra_packages NO_AUTO_COMPILE_FLAGS) ## meta option \todo better way to do it when multiple package give enable the ## same feature if(AKANTU_SCOTCH) set(AKANTU_PARTITIONER ON) else() set(AKANTU_PARTITIONER OFF) endif() if(AKANTU_MUMPS) set(AKANTU_SOLVER ON) else() set(AKANTU_SOLVER OFF) endif() #=============================================================================== # Akantu library #=============================================================================== add_subdirectory(src) #=============================================================================== # Documentation #=============================================================================== if(AKANTU_DOCUMENTATION_DOXYGEN OR AKANTU_DOCUMENTATION_MANUAL) add_subdirectory(doc) else() set(AKANTU_DOC_EXCLUDE_FILES "${PROJECT_SOURCE_DIR}/doc/manual" CACHE INTERNAL "") endif() #=============================================================================== # Examples and tests #=============================================================================== include(AkantuTestsMacros) include(AkantuExampleMacros) if(AKANTU_TESTS) option(AKANTU_BUILD_ALL_TESTS "Build all tests" ON) find_package(GMSH REQUIRED) # package_is_activated(pybind11 _pybind11_act) # if(_pybind11_act) # find_package(pybind11 CONFIG REQUIRED QUIET) # to get the pybind11_add_module macro # endif() endif() if(AKANTU_EXAMPLES) find_package(GMSH REQUIRED) add_subdirectory(examples) endif() # tests add_test_tree(test) #=============================================================================== # Python interface #=============================================================================== package_is_activated(python_interface _python_act) if(_python_act) if(IS_ABSOLUTE "${CMAKE_INSTALL_PREFIX}") set(AKANTU_PYTHON_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}) else() set(AKANTU_PYTHON_INSTALL_PREFIX "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PREFIX}") endif() add_subdirectory(python) endif() #=============================================================================== # Install and Packaging #=============================================================================== include(AkantuInstall) option(AKANTU_DISABLE_CPACK "This option commands the generation of extra info for the \"make package\" target" ON) mark_as_advanced(AKANTU_DISABLE_CPACK) if(NOT AKANTU_DISABLE_CPACK) include(AkantuCPack) endif() diff --git a/cmake/Modules/CMakePackagesSystem.cmake b/cmake/Modules/CMakePackagesSystem.cmake index 381683730..101e9f3ae 100644 --- a/cmake/Modules/CMakePackagesSystem.cmake +++ b/cmake/Modules/CMakePackagesSystem.cmake @@ -1,1070 +1,1064 @@ #=============================================================================== # @file CMakePackagesSystem.cmake # # @author Guillaume Anciaux # @author Nicolas Richart # # @date creation: Wed Nov 05 2014 # @date last modification: Wed Jan 20 2016 # # @brief Set of macros used by akantu to handle the package system # # @section LICENSE # # Copyright (©) 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) Laboratory # (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== #[=======================================================================[.rst: #CMakePackagesSystem #------------------- # #This package defines multiple function to handle packages. This packages can #be of two kinds regular ones and extra_packages (ex: in akantu the LGPL part #is regular packages and extra packages are on Propetary license) # #Package are loaded with the help of the command: # #.. command:: package_list_packages # # package_list_packages( # [ EXTRA_PACKAGE_FOLDER ] # [ SOURCE_FOLDER ] # [ TEST_FOLDER ] # [ MANUAL_FOLDER ] # ) # # This command will look for packages name like ``/.cmake`` # OR ``//package.cmake`` # #A package is a cmake script that should contain at list the declaration of a #package # #.. command:: package_declare # # package_declare( # [EXTERNAL] [META] [ADVANCED] [NOT_OPTIONAL] # [DESCRIPTION ] [DEFAULT ] # [DEPENDS ...] # [BOOST_COMPONENTS ...] # [EXTRA_PACKAGE_OPTIONS ...] # [COMPILE_FLAGS ] # [SYSTEM [ ]] # [FEATURES_PUBLIC ...] # [FEATURES_PRIVATE ...] # [EXCLUDE_FROM_ALL] # ) # #.. command:: package_declare_sources # # It can also declare multiple informations: # source files: # # package_declare_sources( # ... ) # #.. command:: package_declare_documentation # # a LaTeX documentation # package_declare_documentation( # ...) # #.. command:: package_declare_documentation_files # # LaTeX documentation files # package_declare_documentation_files( # ... ) # #Different function can also be retrieved from the package system by using the #different accessors # #.. command:: package_get_name # package_get_name( ) # #.. command:: package_get_real_name # package_get_real_name( ) # #.. command:: package_get_option_name # package_get_option_name( ) # #.. command:: package_use_system # package_use_system( ) # #.. command:: package_get_nature # package_get_nature( ) # #.. command:: package_get_description # package_get_description( ) # #.. command:: package_get_filename # package_get_filename( ) # #.. command:: package_get_sources_folder # package_get_sources_folder( ) #.. command:: package_get_tests_folder # package_get_tests_folder( ) #.. command:: package_get_manual_folder # package_get_manual_folder( ) # #.. command:: package_get_find_package_extra_options # package_get_find_package_extra_options( ) # #.. command:: package_get_compile_flags # package_get_compile_flags( ) #.. command:: package_set_compile_flags # package_set_compile_flags( ... ) # #.. command:: package_get_include_dir # package_get_include_dir( ) #.. command:: package_set_include_dir # package_set_include_dir( ... ) #.. command:: package_add_include_dir # package_add_include_dir( ... ) # #.. command:: package_get_libraries # package_get_libraries( ) #.. command:: package_set_libraries # package_set_libraries( ... ) # #.. command:: package_add_extra_dependency # package_add_extra_dependency(pkg ... ) #.. command:: package_rm_extra_dependency # package_rm_extra_dependency( ) #.. command:: package_get_extra_dependencies # package_get_extra_dependencies( ) # #.. command:: package_is_activated # package_is_activated( ) #.. command:: package_is_deactivated # package_is_deactivated( ) # #.. command:: package_get_dependencies # package_get_dependencies( ) #.. command:: package_add_dependencies # package_add_dependencies( ... ) # package_remove_dependencies( ... ) # package_remove_dependency( ) # #.. command:: package_on_enabled_script # package_on_enabled_script(