diff --git a/cmake/AkantuNeedPybind11.cmake b/cmake/AkantuNeedPybind11.cmake index e23bb6d94..d4e25de5d 100644 --- a/cmake/AkantuNeedPybind11.cmake +++ b/cmake/AkantuNeedPybind11.cmake @@ -1,16 +1,18 @@ if(DEFINED AKANTU_NEED_PYBIND11_LOADED) return() endif() set(AKANTU_NEED_PYBIND11_LOADED TRUE) set(PYBIND11_PYTHON_VERSION ${AKANTU_PREFERRED_PYTHON_VERSION} CACHE INTERNAL "") find_package(pybind11 QUIET) if (NOT pybind11_FOUND) set(PYBIND11_VERSION "v2.4.2") set(PYBIND11_GIT "https://github.com/pybind/pybind11.git") include(${PROJECT_SOURCE_DIR}/third-party/cmake/pybind11.cmake) +else() + message(STATUS "Found pybind11: ${pybind11_INCLUDE_DIRS} (${pybind11_VERSION})") endif() diff --git a/cmake/Modules/CMakePackagesSystemPrivateFunctions.cmake b/cmake/Modules/CMakePackagesSystemPrivateFunctions.cmake index 42eca6811..d2a5d35d7 100644 --- a/cmake/Modules/CMakePackagesSystemPrivateFunctions.cmake +++ b/cmake/Modules/CMakePackagesSystemPrivateFunctions.cmake @@ -1,984 +1,1005 @@ #=============================================================================== # @file CMakePackagesSystemPrivateFunctions.cmake # # @author Guillaume Anciaux # @author Nicolas Richart # # @date creation: Sat Jul 18 2015 # @date last modification: Mon Mar 08 2021 # # @brief Set of macros used by the package system, internal functions # # # @section LICENSE # # Copyright (©) 2015-2021 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 (DEFINED CMAKE_PACKAGES_SYSTEM_PRIVATE_FUNCTIONS_LOADED) return() endif() set(CMAKE_PACKAGES_SYSTEM_PRIVATE_FUNCTIONS_LOADED TRUE) # ============================================================================== # "Private" Accessors # ============================================================================== # ------------------------------------------------------------------------------ # Real name # ------------------------------------------------------------------------------ function(_package_get_real_name pkg_name real_name) set(${real_name} ${${pkg_name}} PARENT_SCOPE) endfunction() function(_package_set_real_name pkg_name real_name) set(${pkg_name} ${real_name} CACHE INTERNAL "" FORCE) endfunction() # ------------------------------------------------------------------------------ # Option name # ------------------------------------------------------------------------------ function(_package_declare_option pkg_name) string(TOUPPER "${PROJECT_NAME}" _project) _package_get_real_name(${pkg_name} _real_name) string(TOUPPER "${_real_name}" _u_package) _package_get_nature(${pkg_name} _nature) if(${_nature} MATCHES "internal" OR ${_nature} MATCHES "meta") set(_opt_name ${_project}_${_u_package}) elseif(${_nature} MATCHES "external") set(_opt_name ${_project}_USE_${_u_package}) else() set(_opt_name UNKNOWN_NATURE_${_project}_${_u_package}) endif() _package_set_variable(OPTION_NAME ${pkg_name} ${_opt_name}) endfunction() function(_package_get_option_name pkg_name opt_name) _package_get_variable(OPTION_NAME ${pkg_name} _opt_name) set(${opt_name} ${_opt_name} PARENT_SCOPE) endfunction() # ------------------------------------------------------------------------------ # Set if system package or compile external lib # ------------------------------------------------------------------------------ function(_package_set_system_option pkg_name default) string(TOUPPER "${PROJECT_NAME}" _project) _package_get_real_name(${pkg_name} _real_name) string(TOUPPER "${_real_name}" _u_package) set(${_project}_USE_SYSTEM_${_u_package} ${default} CACHE STRING "Should akantu compile the third-party: \"${_real_name}\"") mark_as_advanced(${_project}_USE_SYSTEM_${_u_package}) set_property(CACHE ${_project}_USE_SYSTEM_${_u_package} PROPERTY STRINGS ON OFF AUTO) endfunction() function(_package_use_system pkg_name use) string(TOUPPER "${PROJECT_NAME}" _project) _package_get_real_name(${pkg_name} _real_name) string(TOUPPER "${_real_name}" _u_package) if(DEFINED ${_project}_USE_SYSTEM_${_u_package}) if(${${_project}_USE_SYSTEM_${_u_package}} MATCHES "(ON|AUTO)") set(${use} TRUE PARENT_SCOPE) else() set(${use} FALSE PARENT_SCOPE) endif() else() set(${use} TRUE PARENT_SCOPE) endif() endfunction() function(_package_has_system_fallback pkg_name fallback) string(TOUPPER "${PROJECT_NAME}" _project) _package_get_real_name(${pkg_name} _real_name) string(TOUPPER "${_real_name}" _u_package) if(DEFINED ${_project}_USE_SYSTEM_${_u_package}) if(${${_project}_USE_SYSTEM_${_u_package}} MATCHES "AUTO") set(${fallback} TRUE PARENT_SCOPE) else() set(${fallback} FALSE PARENT_SCOPE) endif() else() set(${fallback} FALSE PARENT_SCOPE) endif() endfunction() function(_package_set_system_script pkg_name script) _package_set_variable(COMPILE_SCRIPT ${pkg_name} "${script}") endfunction() function(_package_add_third_party_script_variable pkg_name var) _package_set_variable(VARIABLE_${var} ${pkg_name} "${ARGN}") set(${var} ${ARGN} PARENT_SCOPE) endfunction() # ------------------------------------------------------------------------------ function(_package_load_third_party_script pkg_name) if(${pkg_name}_COMPILE_SCRIPT) # set the stored variable get_cmake_property(_all_vars VARIABLES) foreach(_var ${_all_vars}) if(_var MATCHES "^${pkg_name}_VARIABLE_.*") string(REPLACE "${pkg_name}_VARIABLE_" "" _orig_var "${_var}") set(${_orig_var} ${${_var}}) endif() endforeach() _package_get_real_name(${pkg_name} _name) string(TOUPPER "${_name}" _u_name) _package_get_option_name(${pkg_name} _opt_name) if(${_opt_name}_VERSION) set(_version "${${_opt_name}_VERSION}") set(${_u_name}_VERSION "${_version}" CACHE INTERNAL "" FORCE) elseif(${_u_name}_VERSION) set(_version "${${_u_name}_VERSION}") endif() # load the script include(ExternalProject) include(${${pkg_name}_COMPILE_SCRIPT}) if(${_u_name}_LIBRARIES) _package_set_libraries(${pkg_name} ${${_u_name}_LIBRARIES}) list(APPEND _required_vars ${_u_name}_LIBRARIES) endif() if(${_u_name}_INCLUDE_DIR) _package_set_include_dir(${pkg_name} ${${_u_name}_INCLUDE_DIR}) list(APPEND _required_vars ${_u_name}_INCLUDE_DIR) endif() include(FindPackageHandleStandardArgs) if (NOT _required_vars) message(FATAL_ERROR "The package ${_name} does not define any of the variables ${_u_name}_INCLUDE_DIR nor ${_u_name}_LIBRARIES") endif() if(CMAKE_VERSION VERSION_GREATER 2.8.12) find_package_handle_standard_args(${_name} REQUIRED_VARS ${_required_vars} VERSION_VAR _version FAIL_MESSAGE "Something was not configured by a the third-party script for ${_name}" ) else() find_package_handle_standard_args(${_name} "Something was not configured by a the third-party script for ${_name}" ${_required_vars} ) endif() endif() set(${pkg_name}_USE_SYSTEM_PREVIOUS FALSE CACHE INTERNAL "" FORCE) endfunction() # ------------------------------------------------------------------------------ # Nature # ------------------------------------------------------------------------------ function(_package_set_nature pkg_name nature) _package_set_variable(NATURE ${pkg_name} ${nature}) endfunction() function(_package_get_nature pkg_name nature) _package_get_variable(NATURE ${pkg_name} _nature "unknown") set(${nature} ${_nature} PARENT_SCOPE) endfunction() # ------------------------------------------------------------------------------ # Description # ------------------------------------------------------------------------------ function(_package_set_description pkg_name desc) _package_set_variable(DESC ${pkg_name} ${desc}) endfunction() function(_package_get_description pkg_name desc) _package_get_variable(DESC ${pkg_name} _desc "No description set for the package ${${pkg_name}} (${pkg_name})") set(${desc} ${_desc} PARENT_SCOPE) endfunction() # ------------------------------------------------------------------------------ # Package file name # ------------------------------------------------------------------------------ function(_package_set_filename pkg_name file) _package_set_variable(FILE ${pkg_name} ${file}) endfunction() function(_package_get_filename pkg_name file) _package_get_variable(FILE ${pkg_name} _file "No filename set for the package ${${pkg_name}}") set(${file} ${_file} PARENT_SCOPE) endfunction() # ------------------------------------------------------------------------------ # Source folder # ------------------------------------------------------------------------------ function(_package_set_sources_folder pkg_name src_folder) _package_set_variable(SRC_FOLDER ${pkg_name} ${src_folder}) endfunction() function(_package_get_sources_folder pkg_name src_folder) _package_get_variable(SRC_FOLDER ${pkg_name} _src_folder) set(${src_folder} ${_src_folder} PARENT_SCOPE) endfunction() # ------------------------------------------------------------------------------ # Test folder # ------------------------------------------------------------------------------ function(_package_set_tests_folder pkg_name test_folder) _package_set_variable(TEST_FOLDER ${pkg_name} ${test_folder}) endfunction() function(_package_get_tests_folder pkg_name test_folder) _package_get_variable(TEST_FOLDER ${pkg_name} _test_folder) set(${test_folder} ${_test_folder} PARENT_SCOPE) endfunction() # ------------------------------------------------------------------------------ # Manual folder # ------------------------------------------------------------------------------ function(_package_set_manual_folder pkg_name manual_folder) _package_set_variable(MANUAL_FOLDER ${pkg_name} ${manual_folder}) endfunction() function(_package_get_manual_folder pkg_name manual_folder) _package_get_variable(MANUAL_FOLDER ${pkg_name} _manual_folder) set(${manual_folder} ${_manual_folder} PARENT_SCOPE) endfunction() # ------------------------------------------------------------------------------ # Extra option for the find_package # ------------------------------------------------------------------------------ function(_package_set_find_package_extra_options pkg_name) _package_set_variable(FIND_PKG_OPTIONS ${pkg_name} ${ARGN}) endfunction() function(_package_get_find_package_extra_options pkg_name options) _package_get_variable(FIND_PKG_OPTIONS ${pkg_name} _options) set(${options} ${_options} PARENT_SCOPE) endfunction() # ------------------------------------------------------------------------------ # Compilation flags # ------------------------------------------------------------------------------ function(_package_set_compile_flags pkg_name lang) _package_set_variable(COMPILE_${lang}_FLAGS ${pkg_name} ${ARGN}) endfunction() function(_package_unset_compile_flags pkg_name lang) _package_variable_unset(COMPILE_${lang}_FLAGS ${pkg_name}) endfunction() function(_package_get_compile_flags pkg_name lang flags) _package_get_variable(COMPILE_${lang}_FLAGS ${pkg_name} _tmp_flags) string(REPLACE ";" " " _flags "${_tmp_flags}") set(${flags} "${_flags}" PARENT_SCOPE) endfunction() # ------------------------------------------------------------------------------ # Include dir # ------------------------------------------------------------------------------ function(_package_set_include_dir pkg_name) _package_set_variable(INCLUDE_DIR ${pkg_name} ${ARGN}) endfunction() function(_package_get_include_dir pkg_name include_dir) _package_get_variable(INCLUDE_DIR ${pkg_name} _include_dir "") set(${include_dir} ${_include_dir} PARENT_SCOPE) endfunction() function(_package_add_include_dir pkg_name) _package_add_to_variable(INCLUDE_DIR ${pkg_name} ${ARGN}) endfunction() # ------------------------------------------------------------------------------ # Libraries # ------------------------------------------------------------------------------ function(_package_set_libraries pkg_name) _package_set_variable(LIBRARIES ${pkg_name} ${ARGN}) endfunction() function(_package_get_libraries pkg_name libraries) _package_get_variable(LIBRARIES ${pkg_name} _libraries "") set(${libraries} ${_libraries} PARENT_SCOPE) endfunction() function(_package_add_libraries pkg_name) _package_add_to_variable(LIBRARIES ${pkg_name} ${ARGN}) endfunction() # ------------------------------------------------------------------------------ # Extra dependencies like custom commands of ExternalProject # ------------------------------------------------------------------------------ function(_package_add_extra_dependency pkg_name) _package_add_to_variable(EXTRA_DEPENDENCY ${pkg_name} ${ARGN}) endfunction() function(_package_rm_extra_dependency pkg_name dep) _package_remove_from_variable(EXTRA_DEPENDENCY ${pkg_name} ${dep}) endfunction() function(_package_set_extra_dependencies pkg) _package_set_variable(EXTRA_DEPENDENCY ${pkg_name} ${ARGN}) endfunction() function(_package_get_extra_dependencies pkg deps) _package_get_variable(EXTRA_DEPENDENCY ${pkg_name} _deps "") set(${deps} ${_deps} PARENT_SCOPE) endfunction() function(_package_unset_extra_dependencies pkg_name) _package_variable_unset(EXTRA_DEPENDENCY ${pkg_name}) endfunction() # ------------------------------------------------------------------------------ # Activate/deactivate # ------------------------------------------------------------------------------ function(_package_activate pkg_name) _package_set_variable(STATE ${pkg_name} ON) endfunction() function(_package_deactivate pkg_name) _package_set_variable(STATE ${pkg_name} OFF) endfunction() function(_package_is_activated pkg_name act) _package_get_variable(STATE ${pkg_name} _state OFF) if(_state) set(${act} TRUE PARENT_SCOPE) else() set(${act} FALSE PARENT_SCOPE) endif() endfunction() function(_package_is_deactivated pkg_name act) _package_get_variable(STATE ${pkg_name} _state OFF) if(NOT _state) set(${act} TRUE PARENT_SCOPE) else() set(${act} FALSE PARENT_SCOPE) endif() endfunction() function(_package_unset_activated pkg_name) _package_variable_unset(STATE ${pkg_name}) endfunction() # ------------------------------------------------------------------------------ # Callbacks # ------------------------------------------------------------------------------ function(_package_on_enable_script pkg_name script) string(TOLOWER "${pkg_name}" _l_pkg_name) set(_output_file "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_l_pkg_name}.cmake") file(WRITE "${_output_file}" "${script}") _package_set_variable(CALLBACK_SCRIPT ${pkg_name} "${_output_file}") endfunction() function(_package_get_callback_script pkg_name filename) _package_get_variable(CALLBACK_SCRIPT ${pkg_name} _filename NOTFOUND) set(${filename} ${_filename} PARENT_SCOPE) endfunction() # ------------------------------------------------------------------------------ # Export list # ------------------------------------------------------------------------------ function(_package_add_to_export_list pkg_name) _package_add_to_variable(EXPORT_LIST ${pkg_name} ${ARGN}) endfunction() function(_package_remove_from_export_list pkg_name) _package_remove_from_variable(EXPORT_LIST ${pkg_name} ${ARGN}) endfunction() function(_package_get_export_list pkg_name export_list) _package_get_variable(EXPORT_LIST ${pkg_name} _export_list) set(${export_list} ${_export_list} PARENT_SCOPE) endfunction() # ------------------------------------------------------------------------------ # Direct dependencies # ------------------------------------------------------------------------------ function(_package_add_dependencies pkg_name type) _package_add_to_variable(DEPENDENCIES_${type} ${pkg_name} ${ARGN}) endfunction() function(_package_get_dependencies pkg_name type dependencies) _package_get_variable(DEPENDENCIES_${type} ${pkg_name} _dependencies) set(${dependencies} ${_dependencies} PARENT_SCOPE) endfunction() function(_package_unset_dependencies pkg_name type) _package_variable_unset(DEPENDENCIES_${type} ${pkg_name}) endfunction() function(_package_remove_dependency pkg_name type dep) set(_deps ${${pkg_name}_DEPENDENCIES_${type}}) _package_get_fdependencies(${dep} _fdeps) # check if this is the last reverse dependency list(LENGTH _fdeps len) list(FIND _fdeps ${pkg_name} pos) if((len EQUAL 1) AND (NOT pos EQUAL -1)) _package_get_description(${dep} _dep_desc) _package_get_option_name(${dep} _dep_option_name) set(${_dep_option_name} ${${dep}_OLD} CACHE BOOL "${_dep_desc}" FORCE) unset(${dep}_OLD CACHE) endif() # remove the pkg_name form the reverse dependency _package_remove_fdependency(${dep} ${pkg_name}) list(FIND _deps ${dep} pos) if(NOT pos EQUAL -1) list(REMOVE_AT _deps ${pos}) _package_set_variable(DEPENDENCIES_${type} ${pkg_name} ${_deps}) endif() endfunction() # ------------------------------------------------------------------------------ # Functions to handle reverse dependencies # ------------------------------------------------------------------------------ function(_package_set_rdependencies pkg_name) _package_set_variable(RDEPENDENCIES ${pkg_name} ${ARGN}) endfunction() function(_package_get_rdependencies pkg_name rdependencies) _package_get_variable(RDEPENDENCIES ${pkg_name} _rdependencies) set(${rdependencies} ${_rdependencies} PARENT_SCOPE) endfunction() function(_package_add_rdependency pkg_name rdep) # store the reverse dependency _package_add_to_variable(RDEPENDENCIES ${pkg_name} ${rdep}) endfunction() function(_package_remove_rdependency pkg_name rdep) _package_remove_from_variable(RDEPENDENCIES ${pkg_name} ${rdep}) endfunction() # ------------------------------------------------------------------------------ # Function to handle forcing dependencies (Package turn ON that enforce their # dependencies ON) # ------------------------------------------------------------------------------ function(_package_set_fdependencies pkg_name) _package_set_variable(FDEPENDENCIES ${pkg_name} ${ARGN}) endfunction() function(_package_get_fdependencies pkg_name fdependencies) _package_get_variable(FDEPENDENCIES ${pkg_name} _fdependencies) set(${fdependencies} ${_fdependencies} PARENT_SCOPE) endfunction() function(_package_add_fdependency pkg_name fdep) # store the reverse dependency _package_add_to_variable(FDEPENDENCIES ${pkg_name} ${fdep}) endfunction() function(_package_remove_fdependency pkg_name fdep) _package_remove_from_variable(FDEPENDENCIES ${pkg_name} ${fdep}) endfunction() # ------------------------------------------------------------------------------ # Exteral package system as apt rpm dependencies # ------------------------------------------------------------------------------ function(_package_set_package_system_dependency pkg system) string(TOUPPER "${_system}" _u_system) _package_set_variable(PACKAGE_SYSTEM_${_u_system} ${_pkg_name} ${ARGN}) endfunction() function(_package_get_package_system_dependency pkg system var) string(TOUPPER "${_system}" _u_system) _package_get_variable(PACKAGE_SYSTEM_${_u_system} ${_pkg_name} ${_deps}) set(${var} ${_deps} PARENT_SCOPE) endfunction() # ------------------------------------------------------------------------------ # Documentation related functions # ------------------------------------------------------------------------------ function(_package_set_documentation_files pkg_name) _package_set_variable(DOCUMENTATION_FILES ${pkg_name} ${ARGN}) endfunction() function(_package_get_documentation_files pkg_name doc_files) _package_get_variable(DOCUMENTATION_FILES ${pkg_name} _doc_files "") set(${doc_files} ${_doc_files} PARENT_SCOPE) endfunction() function(_package_set_documentation pkg_name) # \n replaced by && and \\ by ££ to avoid cache problems set(_doc_str "") foreach(_str ${ARGN}) set(_doc_str "${_doc_str}&&${_str}") endforeach() string(REPLACE "\\" "££" _doc_escaped "${_doc_str}") _package_set_variable(DOCUMENTATION ${pkg_name} "${_doc_str}") endfunction() function(_package_get_documentation pkg_name _doc) # \n replaced by && and \\ by ££ to avoid cache problems _package_get_variable(DOCUMENTATION ${pkg_name} _doc_tmp "") string(REPLACE "££" "\\" _doc_escaped "${_doc_tmp}") string(REPLACE "&&" "\n" _doc_newlines "${_doc_escaped}") set(${_doc} "${_doc_newlines}" PARENT_SCOPE) endfunction() # ------------------------------------------------------------------------------ # Special boost thingy # ------------------------------------------------------------------------------ function(_package_set_boost_component_needed pkg_name) _package_add_to_variable(BOOST_COMPONENTS_NEEDED ${pkg_name} ${ARGN}) package_get_name(Boost _boost_pkg_name) _package_add_dependencies(${pkg_name} PRIVATE ${_boost_pkg_name}) endfunction() function(_package_get_boost_component_needed pkg_name needed) _package_get_variable(BOOST_COMPONENTS_NEEDED ${pkg_name} _needed) set(${needed} ${_needed} PARENT_SCOPE) endfunction() function(_package_load_boost_components) string(TOUPPER ${PROJECT_NAME} _project) _package_get_variable_for_activated(BOOST_COMPONENTS_NEEDED _boost_needed_components) package_get_name(Boost _pkg_name) if(_boost_needed_components) message(STATUS "Looking for Boost liraries: ${_boost_needed_components}") foreach(_comp ${_boost_needed_components}) find_package(Boost COMPONENTS ${_comp} QUIET) string(TOUPPER ${_comp} _u_comp) if(Boost_${_u_comp}_FOUND) message(STATUS " ${_comp}: FOUND") package_set_project_variable(BOOST_${_u_comp} TRUE) # Generate the libraries for the package _package_add_libraries(${_pkg_name} ${Boost_${_u_comp}_LIBRARY}) else() message(STATUS " ${_comp}: NOT FOUND") endif() endforeach() endif() endfunction() # ------------------------------------------------------------------------------ # get the list of source files for a given package # ------------------------------------------------------------------------------ function(_package_get_source_files pkg_name SRCS PUBLIC_HEADERS PRIVATE_HEADERS) string(TOUPPER ${PROJECT_NAME} _project) set(tmp_SRCS) set(tmp_PUBLIC_HEADERS) set(tmp_PRIVATE_HEADERS) foreach(_type SRCS PUBLIC_HEADERS PRIVATE_HEADERS) foreach(_file ${${pkg_name}_${_type}}) string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" _rel_file "${_file}") list(APPEND tmp_${_type} "${_rel_file}") endforeach() endforeach() set(${SRCS} ${tmp_SRCS} PARENT_SCOPE) set(${PUBLIC_HEADERS} ${tmp_PUBLIC_HEADERS} PARENT_SCOPE) set(${PRIVATE_HEADERS} ${tmp_PRIVATE_HEADERS} PARENT_SCOPE) endfunction() # ============================================================================== # Internal functions # ============================================================================== # ------------------------------------------------------------------------------ # Build the reverse dependencies from the dependencies # ------------------------------------------------------------------------------ function(_package_build_rdependencies) package_get_all_packages(_pkg_list) # set empty lists foreach(_pkg_name ${_pkg_list}) set(${_pkg_name}_rdeps) endforeach() # fill the dependencies list foreach(_pkg_name ${_pkg_list}) _package_get_dependencies(${_pkg_name} PRIVATE _deps_priv) _package_get_dependencies(${_pkg_name} INTERFACE _deps_interface) foreach(_dep_name ${_deps_priv} ${_deps_interface}) list(APPEND ${_dep_name}_rdeps ${_pkg_name}) endforeach() endforeach() # clean and set the reverse dependencies foreach(_pkg_name ${_pkg_list}) if(${_pkg_name}_rdeps) list(REMOVE_DUPLICATES ${_pkg_name}_rdeps) _package_set_rdependencies(${_pkg_name} ${${_pkg_name}_rdeps}) endif() endforeach() endfunction() # ------------------------------------------------------------------------------ # This function resolve the dependance order run the needed find_packages # ------------------------------------------------------------------------------ function(_package_load_packages) package_get_all_packages(_pkg_list) # Activate the dependencies of activated package and generate an ordered list # of dependencies set(ordered_loading_list) foreach(_pkg_name ${_pkg_list}) _package_load_dependencies_package(${_pkg_name} ordered_loading_list) endforeach() # Load the packages in the propoer order foreach(_pkg_name ${ordered_loading_list}) _package_get_option_name(${_pkg_name} _option_name) if(${_option_name}) _package_load_package(${_pkg_name}) else() # deactivate the packages than can already be deactivated _package_deactivate(${_pkg_name}) endif() endforeach() # generates the activated and unactivated lists of packages set(_packages_activated) set(_packages_deactivated) foreach(_pkg_name ${_pkg_list}) _package_is_activated(${_pkg_name} _active) set(_exclude FALSE) _package_get_variable(EXCLUDE_FROM_ALL ${_pkg_name} _exclude) if(_active AND NOT _exclude) list(APPEND _packages_activated ${_pkg_name}) else() list(APPEND _packages_deactivated ${_pkg_name}) endif() endforeach() # generate the list usable by the calling code package_set_project_variable(ACTIVATED_PACKAGE_LIST "${_packages_activated}") package_set_project_variable(DEACTIVATED_PACKAGE_LIST "${_packages_deactivated}") endfunction() # ------------------------------------------------------------------------------ # This load an external package and recursively all its dependencies # ------------------------------------------------------------------------------ function(_package_load_dependencies_package pkg_name loading_list) # Get packages informations _package_get_option_name(${pkg_name} _pkg_option_name) _package_get_dependencies(${pkg_name} PRIVATE _deps_private) _package_get_dependencies(${pkg_name} INTERFACE _deps_interface) set(_dependencies ${_deps_private} ${_deps_interface}) # handle the dependencies foreach(_dep_name ${_dependencies}) _package_get_description(${_dep_name} _dep_desc) _package_get_option_name(${_dep_name} _dep_option_name) _package_get_fdependencies(${_dep_name} _fdeps) if(${_pkg_option_name}) if("${_fdeps}" STREQUAL "") set(${_dep_name}_OLD ${${_dep_option_name}} CACHE INTERNAL "" FORCE) endif() # set the option to on set(_type BOOL) _package_get_nature(${_dep_name} _nature) if(_nature MATCHES ".*not_optional$") set(_type INTERNAL) endif() set(${_dep_option_name} ON CACHE BOOL "${_dep_desc}" FORCE) # store the reverse dependency _package_add_fdependency(${_dep_name} ${pkg_name}) else() # check if this is the last reverse dependency list(LENGTH _fdeps len) list(FIND _fdeps ${pkg_name} pos) if((len EQUAL 1) AND (NOT pos EQUAL -1)) set(${_dep_option_name} ${${_dep_name}_OLD} CACHE BOOL "${_dep_desc}" FORCE) unset(${_dep_name}_OLD CACHE) endif() # remove the pkg_name form the reverse dependency _package_remove_fdependency(${_dep_name} ${pkg_name}) endif() # recusively load the dependencies _package_load_dependencies_package(${_dep_name} ${loading_list}) endforeach() # get the compile flags _package_get_compile_flags(${pkg_name} CXX _pkg_compile_flags) package_get_project_variable(NO_AUTO_COMPILE_FLAGS _no_auto_compile_flags) # if package option is on add it in the list if(${_pkg_option_name}) list(FIND ${loading_list} ${pkg_name} _pos) if(_pos EQUAL -1) set(_tmp_loading_list ${${loading_list}}) list(APPEND _tmp_loading_list ${pkg_name}) set(${loading_list} "${_tmp_loading_list}" PARENT_SCOPE) endif() #add the comilation flags if needed if(_pkg_compile_flags AND NOT _no_auto_compile_flags) add_flags(cxx ${_pkg_compile_flags}) endif() else() #remove the comilation flags if needed if(_pkg_comile_flags AND NOT _no_auto_compile_flags) remove_flags(cxx ${_pkg_compile_flags}) endif() endif() endfunction() # ------------------------------------------------------------------------------ # Load the package if it is an external one # ------------------------------------------------------------------------------ function(_package_load_package pkg_name) # load the package if it is an external _package_get_nature(${pkg_name} _nature) if(${_nature} MATCHES "external") _package_use_system(${pkg_name} _use_system) set(_activated TRUE) if(_use_system) _package_load_external_package(${pkg_name} _activated) endif() _package_has_system_fallback(${pkg_name} _fallback) if((NOT _use_system) OR (_fallback AND (NOT _activated))) _package_load_third_party_script(${pkg_name}) set(_activated TRUE) endif() if(_activated) _package_activate(${pkg_name}) elseif() _package_deactivate(${pkg_name}) endif() else() _package_activate(${pkg_name}) endif() endfunction() # ------------------------------------------------------------------------------ # Load external packages # ------------------------------------------------------------------------------ function(_package_load_external_package pkg_name activate) _package_get_real_name(${pkg_name} _real_name) string(TOUPPER ${_real_name} _u_package) if(NOT ${pkg_name}_USE_SYSTEM_PREVIOUS) #if system was off before clear the cache of preset variables get_cmake_property(_all_vars VARIABLES) foreach(_var ${_all_vars}) if(_var MATCHES "^${_u_package}_.*") unset(${_var} CACHE) endif() endforeach() set(${pkg_name}_USE_SYSTEM_PREVIOUS TRUE CACHE INTERNAL "" FORCE) endif() _package_get_find_package_extra_options(${pkg_name} _options) if(_options) cmake_parse_arguments(_opt_pkg "" "LANGUAGE" "LINK_LIBRARIES;PREFIX;FOUND;ARGS" ${_options}) if(_opt_pkg_UNPARSED_ARGUMENTS) message("You passed too many options for the find_package related to ${${pkg_name}} \"${_opt_pkg_UNPARSED_ARGUMENTS}\"") endif() endif() if(_opt_pkg_LANGUAGE) foreach(_language ${_opt_pkg_LANGUAGE}) enable_language(${_language}) endforeach() endif() # find the package set(_required REQUIRED) _package_has_system_fallback(${pkg_name} _fallback) if(_fallback) set(_required QUIET) endif() find_package(${_real_name} ${_required} ${_opt_pkg_ARGS}) # check if the package is found if(_opt_pkg_PREFIX) set(_package_prefix ${_opt_pkg_PREFIX}) else() set(_package_prefix ${_u_package}) endif() set(_act FALSE) set(_prefix_to_consider) if(DEFINED _opt_pkg_FOUND) if(${_opt_pkg_FOUND}) set(_act TRUE) set(_prefix_to_consider ${_package_prefix}) endif() else() foreach(_prefix ${_package_prefix}) if(${_prefix}_FOUND) set(_act TRUE) list(APPEND _prefix_to_consider ${_prefix}) endif() endforeach() endif() if(_act) + set(_include_dirs) + set(_libraries) foreach(_prefix ${_prefix_to_consider}) # Generate the include dir for the package if(DEFINED ${_prefix}_INCLUDE_DIRS) _package_set_include_dir(${pkg_name} ${${_prefix}_INCLUDE_DIRS}) + list(APPEND _include_dirs ${${_prefix}_INCLUDE_DIRS}) elseif(DEFINED ${_prefix}_INCLUDE_DIR) _package_set_include_dir(${pkg_name} ${${_prefix}_INCLUDE_DIR}) + list(APPEND _include_dirs ${${_prefix}_INCLUDE_DIR}) elseif(DEFINED ${_prefix}_INCLUDE_PATH) _package_set_include_dir(${pkg_name} ${${_prefix}_INCLUDE_PATH}) + list(APPEND _include_dirs ${${_prefix}_INCLUDE_PATH}) endif() # Generate the libraries for the package if(_opt_pkg_LINK_LIBRARIES) _package_set_libraries(${pkg_name} ${_opt_pkg_LINK_LIBRARIES}) + list(APPEND _libraries ${${_prefix}_LINK_LIBRARIES}) elseif(DEFINED ${_prefix}_LIBRARIES) _package_set_libraries(${pkg_name} ${${_prefix}_LIBRARIES}) + list(APPEND _libraries ${${_prefix}_LIBRARIES}) elseif(DEFINED ${_prefix}_LIBRARY) _package_set_libraries(${pkg_name} ${${_prefix}_LIBRARY}) + list(APPEND _libraries ${${_prefix}_LIBRARY}) endif() endforeach() + if(_required STREQUAL "QUIET") + if(_library) + set(_msg ${_library}) + else() + set(_msg ${_include_dirs}) + endif() + + set(_version "") + if(${_real_name}_VERSION) + set(_version " (${${_real_name}_VERSION})") + endif() + message(STATUS "Found ${_real_name}: ${_msg}${_version}") + endif() _package_get_callback_script(${pkg_name} _script_file) if(_script_file) include("${_script_file}") endif() endif() set(${activate} ${_act} PARENT_SCOPE) endfunction() # ------------------------------------------------------------------------------ # Sanity check functions # ------------------------------------------------------------------------------ function(_package_check_files_exists) set(_message FALSE) package_get_all_packages(_pkg_list) foreach(_pkg_name ${_pkg_list}) set(_pkg_files ${${_pkg_name}_SRCS} ${${_pkg_name}_PUBLIC_HEADERS} ${${_pkg_name}_PRIVATE_HEADERS} ) _package_get_real_name(${_pkg_name} _real_name) foreach(_file ${_pkg_files}) if(NOT EXISTS "${_file}") if(NOT _message) set(_message TRUE) message("This file(s) is(are) present in a package but are not present on disk.") endif() message(" PACKAGE ${_real_name} FILE ${_file}") endif() endforeach() endforeach() if(_message) message(SEND_ERROR "Please check the content of your packages to correct this warnings") endif() endfunction() # ------------------------------------------------------------------------------ function(_package_check_files_registered) set(_pkg_files) package_get_all_packages(_pkg_list) # generates a file list of registered files foreach(_pkg_name ${_pkg_list}) list(APPEND _pkg_files ${${_pkg_name}_SRCS} ${${_pkg_name}_PUBLIC_HEADERS} ${${_pkg_name}_PRIVATE_HEADERS} ) endforeach() # generates the list of files in the source folders set(_all_src_files) foreach(_src_folder ${ARGN}) foreach(_ext "cc" "hh" "c" "h" "hpp") file(GLOB_RECURSE _src_files "${_src_folder}/*.${_ext}") list(APPEND _all_src_files ${_src_files}) endforeach() endforeach() if(_all_src_files) list(REMOVE_DUPLICATES _all_src_files) endif() set(_not_registerd_files) # check only sources files in the source folders foreach(_src_folder ${ARGN}) foreach(_file ${_all_src_files}) if("${_file}" MATCHES "${_src_folder}") list(FIND _pkg_files "${_file}" _index) if (_index EQUAL -1) list(APPEND _not_registerd_files ${_file}) endif() endif() endforeach() endforeach() if(AUTO_MOVE_UNKNOWN_FILES) file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/unknown_files) endif() # warn the user and move the files if needed if(_not_registerd_files) if(EXISTS ${PROJECT_BINARY_DIR}/missing_files_in_packages) file(REMOVE ${PROJECT_BINARY_DIR}/missing_files_in_packages) endif() message("This files are present in the source folders but are not registered in any package") foreach(_file ${_not_registerd_files}) message(" ${_file}") if(AUTO_MOVE_UNKNOWN_FILES) get_filename_component(_file_name ${_file} NAME) file(RENAME ${_file} ${PROJECT_BINARY_DIR}/unknown_files/${_file_name}) endif() file(APPEND ${PROJECT_BINARY_DIR}/missing_files_in_packages "${_file} ") endforeach() if(AUTO_MOVE_UNKNOWN_FILES) message(SEND_ERROR "The files where moved in the followinf folder ${PROJECT_BINARY_DIR}/unknown_files\n Please register them in the good package or clean the sources") else() message(SEND_ERROR "Please register them in the good package or clean the sources") endif() endif() endfunction() # ------------------------------------------------------------------------------ diff --git a/cmake/Modules/FindPythonLibsNew.cmake b/cmake/Modules/FindPythonLibsNew.cmake deleted file mode 100644 index b29b287de..000000000 --- a/cmake/Modules/FindPythonLibsNew.cmake +++ /dev/null @@ -1,195 +0,0 @@ -# - Find python libraries -# This module finds the libraries corresponding to the Python interpreter -# FindPythonInterp provides. -# This code sets the following variables: -# -# PYTHONLIBS_FOUND - have the Python libs been found -# PYTHON_PREFIX - path to the Python installation -# PYTHON_LIBRARIES - path to the python library -# PYTHON_INCLUDE_DIRS - path to where Python.h is found -# PYTHON_MODULE_EXTENSION - lib extension, e.g. '.so' or '.pyd' -# PYTHON_MODULE_PREFIX - lib name prefix: usually an empty string -# PYTHON_SITE_PACKAGES - path to installation site-packages -# PYTHON_IS_DEBUG - whether the Python interpreter is a debug build -# -# Thanks to talljimbo for the patch adding the 'LDVERSION' config -# variable usage. - -#============================================================================= -# Copyright 2001-2009 Kitware, Inc. -# Copyright 2012 Continuum Analytics, Inc. -# -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# * Neither the names of Kitware, Inc., the Insight Software Consortium, -# nor the names of their contributors may be used to endorse or promote -# products derived from this software without specific prior written -# permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#============================================================================= - -# Checking for the extension makes sure that `LibsNew` was found and not just `Libs`. -if(PYTHONLIBS_FOUND AND PYTHON_MODULE_EXTENSION) - return() -endif() - -# Use the Python interpreter to find the libs. -if(PythonLibsNew_FIND_REQUIRED) - find_package(PythonInterp ${PythonLibsNew_FIND_VERSION} REQUIRED) -else() - find_package(PythonInterp ${PythonLibsNew_FIND_VERSION}) -endif() - -if(NOT PYTHONINTERP_FOUND) - set(PYTHONLIBS_FOUND FALSE) - return() -endif() - -# According to http://stackoverflow.com/questions/646518/python-how-to-detect-debug-interpreter -# testing whether sys has the gettotalrefcount function is a reliable, cross-platform -# way to detect a CPython debug interpreter. -# -# The library suffix is from the config var LDVERSION sometimes, otherwise -# VERSION. VERSION will typically be like "2.7" on unix, and "27" on windows. -execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" - "from distutils import sysconfig as s;import sys;import struct; -print('.'.join(str(v) for v in sys.version_info)); -print(sys.prefix); -print(s.get_python_inc(plat_specific=True)); -print(s.get_python_lib(plat_specific=True)); -print(s.get_config_var('SO')); -print(hasattr(sys, 'gettotalrefcount')+0); -print(struct.calcsize('@P')); -print(s.get_config_var('LDVERSION') or s.get_config_var('VERSION')); -print(s.get_config_var('LIBDIR') or ''); -print(s.get_config_var('MULTIARCH') or ''); -" - RESULT_VARIABLE _PYTHON_SUCCESS - OUTPUT_VARIABLE _PYTHON_VALUES - ERROR_VARIABLE _PYTHON_ERROR_VALUE) - -if(NOT _PYTHON_SUCCESS MATCHES 0) - if(PythonLibsNew_FIND_REQUIRED) - message(FATAL_ERROR - "Python config failure:\n${_PYTHON_ERROR_VALUE}") - endif() - set(PYTHONLIBS_FOUND FALSE) - return() -endif() - -# Convert the process output into a list -string(REGEX REPLACE ";" "\\\\;" _PYTHON_VALUES ${_PYTHON_VALUES}) -string(REGEX REPLACE "\n" ";" _PYTHON_VALUES ${_PYTHON_VALUES}) -list(GET _PYTHON_VALUES 0 _PYTHON_VERSION_LIST) -list(GET _PYTHON_VALUES 1 PYTHON_PREFIX) -list(GET _PYTHON_VALUES 2 PYTHON_INCLUDE_DIR) -list(GET _PYTHON_VALUES 3 PYTHON_SITE_PACKAGES) -list(GET _PYTHON_VALUES 4 PYTHON_MODULE_EXTENSION) -list(GET _PYTHON_VALUES 5 PYTHON_IS_DEBUG) -list(GET _PYTHON_VALUES 6 PYTHON_SIZEOF_VOID_P) -list(GET _PYTHON_VALUES 7 PYTHON_LIBRARY_SUFFIX) -list(GET _PYTHON_VALUES 8 PYTHON_LIBDIR) -list(GET _PYTHON_VALUES 9 PYTHON_MULTIARCH) - -# Make sure the Python has the same pointer-size as the chosen compiler -# Skip if CMAKE_SIZEOF_VOID_P is not defined -if(CMAKE_SIZEOF_VOID_P AND (NOT "${PYTHON_SIZEOF_VOID_P}" STREQUAL "${CMAKE_SIZEOF_VOID_P}")) - if(PythonLibsNew_FIND_REQUIRED) - math(EXPR _PYTHON_BITS "${PYTHON_SIZEOF_VOID_P} * 8") - math(EXPR _CMAKE_BITS "${CMAKE_SIZEOF_VOID_P} * 8") - message(FATAL_ERROR - "Python config failure: Python is ${_PYTHON_BITS}-bit, " - "chosen compiler is ${_CMAKE_BITS}-bit") - endif() - set(PYTHONLIBS_FOUND FALSE) - return() -endif() - -# The built-in FindPython didn't always give the version numbers -string(REGEX REPLACE "\\." ";" _PYTHON_VERSION_LIST ${_PYTHON_VERSION_LIST}) -list(GET _PYTHON_VERSION_LIST 0 PYTHON_VERSION_MAJOR) -list(GET _PYTHON_VERSION_LIST 1 PYTHON_VERSION_MINOR) -list(GET _PYTHON_VERSION_LIST 2 PYTHON_VERSION_PATCH) - -# Make sure all directory separators are '/' -string(REGEX REPLACE "\\\\" "/" PYTHON_PREFIX ${PYTHON_PREFIX}) -string(REGEX REPLACE "\\\\" "/" PYTHON_INCLUDE_DIR ${PYTHON_INCLUDE_DIR}) -string(REGEX REPLACE "\\\\" "/" PYTHON_SITE_PACKAGES ${PYTHON_SITE_PACKAGES}) - -if(CMAKE_HOST_WIN32) - set(PYTHON_LIBRARY - "${PYTHON_PREFIX}/libs/Python${PYTHON_LIBRARY_SUFFIX}.lib") - - # when run in a venv, PYTHON_PREFIX points to it. But the libraries remain in the - # original python installation. They may be found relative to PYTHON_INCLUDE_DIR. - if(NOT EXISTS "${PYTHON_LIBRARY}") - get_filename_component(_PYTHON_ROOT ${PYTHON_INCLUDE_DIR} DIRECTORY) - set(PYTHON_LIBRARY - "${_PYTHON_ROOT}/libs/Python${PYTHON_LIBRARY_SUFFIX}.lib") - endif() - - # raise an error if the python libs are still not found. - if(NOT EXISTS "${PYTHON_LIBRARY}") - message(FATAL_ERROR "Python libraries not found") - endif() - -else() - if(PYTHON_MULTIARCH) - set(_PYTHON_LIBS_SEARCH "${PYTHON_LIBDIR}/${PYTHON_MULTIARCH}" "${PYTHON_LIBDIR}") - else() - set(_PYTHON_LIBS_SEARCH "${PYTHON_LIBDIR}") - endif() - #message(STATUS "Searching for Python libs in ${_PYTHON_LIBS_SEARCH}") - # Probably this needs to be more involved. It would be nice if the config - # information the python interpreter itself gave us were more complete. - find_library(PYTHON_LIBRARY - NAMES "python${PYTHON_LIBRARY_SUFFIX}" - PATHS ${_PYTHON_LIBS_SEARCH} - NO_DEFAULT_PATH) - - # If all else fails, just set the name/version and let the linker figure out the path. - if(NOT PYTHON_LIBRARY) - set(PYTHON_LIBRARY python${PYTHON_LIBRARY_SUFFIX}) - endif() -endif() - -MARK_AS_ADVANCED( - PYTHON_LIBRARY - PYTHON_INCLUDE_DIR -) - -# We use PYTHON_INCLUDE_DIR, PYTHON_LIBRARY and PYTHON_DEBUG_LIBRARY for the -# cache entries because they are meant to specify the location of a single -# library. We now set the variables listed by the documentation for this -# module. -SET(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}") -SET(PYTHON_LIBRARIES "${PYTHON_LIBRARY}") -SET(PYTHON_DEBUG_LIBRARIES "${PYTHON_DEBUG_LIBRARY}") - -find_package_message(PYTHON - "Found PythonLibs: ${PYTHON_LIBRARY}" - "${PYTHON_EXECUTABLE}${PYTHON_VERSION}") - -set(PYTHONLIBS_FOUND TRUE) diff --git a/packages/blas.cmake b/packages/blas.cmake deleted file mode 100644 index 591058bf2..000000000 --- a/packages/blas.cmake +++ /dev/null @@ -1,75 +0,0 @@ -#=============================================================================== -# @file blas.cmake -# -# @author Nicolas Richart -# -# @date creation: Tue Oct 16 2012 -# @date last modification: Thu May 11 2017 -# -# @brief package description for blas support -# -# -# @section LICENSE -# -# Copyright (©) 2010-2021 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_declare(BLAS EXTERNAL - DESCRIPTION "Use BLAS for arithmetic operations" - EXTRA_PACKAGE_OPTIONS LANGUAGE Fortran) - -set(_default_blas $ENV{BLA_VENDOR}) -if(NOT _default_blas) - set(_default_blas All) -endif() - -set(AKANTU_USE_BLAS_VENDOR "${_default_blas}" CACHE STRING "Version of blas to use") -mark_as_advanced(AKANTU_USE_BLAS_VENDOR) -set_property(CACHE AKANTU_USE_BLAS_VENDOR PROPERTY STRINGS - All - ACML - ACML_GPU - ACML_MP - ATLAS - Apple - CXML - DXML - Generic - Goto - IBMESSL - Intel - Intel10_32 - Intel10_64lp - Intel10_64lp_seq - NAS - OpenBLAS - PhiPACK - SCSL - SGIMATH - SunPerf - ) - -set(ENV{BLA_VENDOR} ${AKANTU_USE_BLAS_VENDOR}) - -if(BLAS_mkl_core_LIBRARY) - set(AKANTU_USE_BLAS_MKL CACHE INTERNAL "" FORCE) -endif() - -package_set_package_system_dependency(BLAS deb libblas3) -package_set_package_system_dependency(BLAS deb-src libblas3) diff --git a/packages/core.cmake b/packages/core.cmake index f0e50d4c1..3369118a3 100644 --- a/packages/core.cmake +++ b/packages/core.cmake @@ -1,368 +1,367 @@ #=============================================================================== # @file core.cmake # # @author Guillaume Anciaux # @author Nicolas Richart # # @date creation: Mon Nov 21 2011 # @date last modification: Fri Apr 09 2021 # # @brief package description for core # # # @section LICENSE # # Copyright (©) 2010-2021 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_declare(core NOT_OPTIONAL DESCRIPTION "core package for Akantu" DEPENDS INTERFACE akantu_iterators Boost Eigen3 ) if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") package_set_compile_flags(core CXX "-Wall -Wextra -pedantic") else() package_set_compile_flags(core CXX "-Wall") endif() if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0.0) package_set_compile_flags(core CXX "-Wall -Wextra -pedantic -Wno-attributes") endif() if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.9)) package_set_compile_flags(core CXX "-Wall -Wextra -pedantic -Wno-undefined-var-template -Wno-unknown-attributes") endif() package_declare_sources(core common/aka_array.cc common/aka_array.hh common/aka_array_filter.hh common/aka_array_tmpl.hh common/aka_array_printer.hh common/aka_bbox.hh - common/aka_blas_lapack.hh common/aka_circular_array.hh common/aka_circular_array_inline_impl.hh common/aka_common.cc common/aka_common.hh common/aka_common_inline_impl.hh common/aka_constexpr_map.hh common/aka_csr.hh common/aka_element_classes_info.hh common/aka_element_classes_info_inline_impl.hh common/aka_enum_macros.hh common/aka_error.cc common/aka_error.hh common/aka_event_handler_manager.hh common/aka_extern.cc common/aka_factory.hh common/aka_fwd.hh common/aka_grid_dynamic.hh common/aka_math.cc common/aka_math.hh common/aka_math_tmpl.hh common/aka_named_argument.hh common/aka_random_generator.hh common/aka_safe_enum.hh common/aka_tensor.hh common/aka_types.hh common/aka_types_eigen_matrix_plugin.hh common/aka_types_eigen_matrix_base_plugin.hh common/aka_types_eigen_plain_object_base_plugin.hh common/aka_view_iterators.hh common/aka_voigthelper.hh common/aka_voigthelper_tmpl.hh common/aka_voigthelper.cc common/aka_warning.hh common/aka_warning_restore.hh fe_engine/element_class.hh fe_engine/element_class_helper.hh fe_engine/element_class_tmpl.hh fe_engine/element_classes/element_class_hexahedron_8_inline_impl.hh fe_engine/element_classes/element_class_hexahedron_20_inline_impl.hh fe_engine/element_classes/element_class_pentahedron_6_inline_impl.hh fe_engine/element_classes/element_class_pentahedron_15_inline_impl.hh fe_engine/element_classes/element_class_point_1_inline_impl.hh fe_engine/element_classes/element_class_quadrangle_4_inline_impl.hh fe_engine/element_classes/element_class_quadrangle_8_inline_impl.hh fe_engine/element_classes/element_class_segment_2_inline_impl.hh fe_engine/element_classes/element_class_segment_3_inline_impl.hh fe_engine/element_classes/element_class_tetrahedron_10_inline_impl.hh fe_engine/element_classes/element_class_tetrahedron_4_inline_impl.hh fe_engine/element_classes/element_class_triangle_3_inline_impl.hh fe_engine/element_classes/element_class_triangle_6_inline_impl.hh fe_engine/element_type_conversion.hh fe_engine/fe_engine.cc fe_engine/fe_engine.hh fe_engine/fe_engine_inline_impl.hh fe_engine/fe_engine_template.hh fe_engine/fe_engine_template_tmpl_field.hh fe_engine/fe_engine_template_tmpl.hh fe_engine/geometrical_element_property.hh fe_engine/geometrical_element_property.cc fe_engine/gauss_integration.cc fe_engine/gauss_integration_tmpl.hh fe_engine/integrator.hh fe_engine/integrator_gauss.hh fe_engine/integrator_gauss_inline_impl.hh fe_engine/interpolation_element_tmpl.hh fe_engine/integration_point.hh fe_engine/shape_functions.hh fe_engine/shape_functions.cc fe_engine/shape_functions_inline_impl.hh fe_engine/shape_lagrange_base.cc fe_engine/shape_lagrange_base.hh fe_engine/shape_lagrange_base_inline_impl.hh fe_engine/shape_lagrange.hh fe_engine/shape_lagrange_inline_impl.hh fe_engine/element.hh io/dumper/dumpable.hh io/dumper/dumpable.cc io/dumper/dumpable_dummy.hh io/dumper/dumpable_inline_impl.hh io/dumper/dumper_field.hh io/dumper/dumper_material_padders.hh io/dumper/dumper_filtered_connectivity.hh io/dumper/dumper_element_partition.hh io/mesh_io.cc io/mesh_io.hh io/mesh_io/mesh_io_diana.cc io/mesh_io/mesh_io_diana.hh io/mesh_io/mesh_io_msh.cc io/mesh_io/mesh_io_msh.hh #io/model_io.cc #io/model_io.hh io/parser/algebraic_parser.hh io/parser/input_file_parser.hh io/parser/parsable.cc io/parser/parsable.hh io/parser/parser.cc io/parser/parser_real.cc io/parser/parser_random.cc io/parser/parser_types.cc io/parser/parser_input_files.cc io/parser/parser.hh io/parser/parser_tmpl.hh io/parser/parser_grammar_tmpl.hh io/parser/cppargparse/cppargparse.hh io/parser/cppargparse/cppargparse.cc io/parser/cppargparse/cppargparse_tmpl.hh io/parser/parameter_registry.cc io/parser/parameter_registry.hh io/parser/parameter_registry_tmpl.hh mesh/element_group.cc mesh/element_group.hh mesh/element_group_inline_impl.hh mesh/element_type_map.cc mesh/element_type_map.hh mesh/element_type_map_tmpl.hh mesh/element_type_map_filter.hh mesh/group_manager.cc mesh/group_manager.hh mesh/group_manager_inline_impl.hh mesh/mesh.cc mesh/mesh.hh mesh/mesh_periodic.cc mesh/mesh_accessor.hh mesh/mesh_events.hh mesh/mesh_filter.hh mesh/mesh_global_data_updater.hh mesh/mesh_data.cc mesh/mesh_data.hh mesh/mesh_data_tmpl.hh mesh/mesh_inline_impl.hh mesh/node_group.cc mesh/node_group.hh mesh/node_group_inline_impl.hh mesh/mesh_iterators.hh mesh_utils/mesh_partition.cc mesh_utils/mesh_partition.hh mesh_utils/mesh_partition/mesh_partition_mesh_data.cc mesh_utils/mesh_partition/mesh_partition_mesh_data.hh mesh_utils/mesh_partition/mesh_partition_scotch.hh mesh_utils/mesh_utils_pbc.cc mesh_utils/mesh_utils.cc mesh_utils/mesh_utils.hh mesh_utils/mesh_utils_distribution.cc mesh_utils/mesh_utils_distribution.hh mesh_utils/mesh_utils.hh mesh_utils/mesh_utils_inline_impl.hh mesh_utils/global_ids_updater.hh mesh_utils/global_ids_updater.cc mesh_utils/global_ids_updater_inline_impl.hh model/common/boundary_condition/boundary_condition.hh model/common/boundary_condition/boundary_condition_functor.hh model/common/boundary_condition/boundary_condition_functor_inline_impl.hh model/common/boundary_condition/boundary_condition_tmpl.hh model/common/non_local_toolbox/neighborhood_base.hh model/common/non_local_toolbox/neighborhood_base.cc model/common/non_local_toolbox/neighborhood_base_inline_impl.hh model/common/non_local_toolbox/neighborhoods_criterion_evaluation/neighborhood_max_criterion.hh model/common/non_local_toolbox/neighborhoods_criterion_evaluation/neighborhood_max_criterion.cc model/common/non_local_toolbox/neighborhoods_criterion_evaluation/neighborhood_max_criterion_inline_impl.hh model/common/non_local_toolbox/non_local_manager.hh model/common/non_local_toolbox/non_local_manager.cc model/common/non_local_toolbox/non_local_manager_inline_impl.hh model/common/non_local_toolbox/non_local_manager_callback.hh model/common/non_local_toolbox/non_local_neighborhood_base.hh model/common/non_local_toolbox/non_local_neighborhood_base.cc model/common/non_local_toolbox/non_local_neighborhood.hh model/common/non_local_toolbox/non_local_neighborhood_tmpl.hh model/common/non_local_toolbox/non_local_neighborhood_inline_impl.hh model/common/non_local_toolbox/base_weight_function.hh model/common/non_local_toolbox/base_weight_function.cc model/common/non_local_toolbox/base_weight_function_inline_impl.hh model/common/model_solver.cc model/common/model_solver.hh model/common/solver_callback.hh model/common/solver_callback.cc model/common/dof_manager/dof_manager.cc model/common/dof_manager/dof_manager.hh model/common/dof_manager/dof_manager_default.cc model/common/dof_manager/dof_manager_default.hh model/common/dof_manager/dof_manager_default_inline_impl.hh model/common/dof_manager/dof_manager_inline_impl.hh model/common/non_linear_solver/non_linear_solver.cc model/common/non_linear_solver/non_linear_solver.hh model/common/non_linear_solver/non_linear_solver_default.hh model/common/non_linear_solver/non_linear_solver_lumped.cc model/common/non_linear_solver/non_linear_solver_lumped.hh model/common/time_step_solvers/time_step_solver.hh model/common/time_step_solvers/time_step_solver.cc model/common/time_step_solvers/time_step_solver_default.cc model/common/time_step_solvers/time_step_solver_default.hh model/common/time_step_solvers/time_step_solver_default_explicit.hh model/common/integration_scheme/generalized_trapezoidal.cc model/common/integration_scheme/generalized_trapezoidal.hh model/common/integration_scheme/integration_scheme.cc model/common/integration_scheme/integration_scheme.hh model/common/integration_scheme/integration_scheme_1st_order.cc model/common/integration_scheme/integration_scheme_1st_order.hh model/common/integration_scheme/integration_scheme_2nd_order.cc model/common/integration_scheme/integration_scheme_2nd_order.hh model/common/integration_scheme/newmark-beta.cc model/common/integration_scheme/newmark-beta.hh model/common/integration_scheme/pseudo_time.cc model/common/integration_scheme/pseudo_time.hh model/model.cc model/model.hh model/model_inline_impl.hh model/model_options.hh solver/solver_vector.hh solver/solver_vector_default.hh solver/solver_vector_default_tmpl.hh solver/solver_vector_distributed.cc solver/solver_vector_distributed.hh solver/sparse_matrix.cc solver/sparse_matrix.hh solver/sparse_matrix_aij.cc solver/sparse_matrix_aij.hh solver/sparse_matrix_aij_inline_impl.hh solver/sparse_matrix_inline_impl.hh solver/sparse_solver.cc solver/sparse_solver.hh solver/sparse_solver_inline_impl.hh solver/terms_to_assemble.hh synchronizer/communication_buffer_inline_impl.hh synchronizer/communication_descriptor.hh synchronizer/communication_descriptor_tmpl.hh synchronizer/communication_request.hh synchronizer/communication_tag.hh synchronizer/communications.hh synchronizer/communications_tmpl.hh synchronizer/communicator.cc synchronizer/communicator.hh synchronizer/communicator_dummy_inline_impl.hh synchronizer/communicator_event_handler.hh synchronizer/communicator_inline_impl.hh synchronizer/data_accessor.cc synchronizer/data_accessor.hh synchronizer/dof_synchronizer.cc synchronizer/dof_synchronizer.hh synchronizer/dof_synchronizer_inline_impl.hh synchronizer/element_info_per_processor.cc synchronizer/element_info_per_processor.hh synchronizer/element_info_per_processor_tmpl.hh synchronizer/element_synchronizer.cc synchronizer/element_synchronizer.hh synchronizer/facet_synchronizer.cc synchronizer/facet_synchronizer.hh synchronizer/facet_synchronizer_inline_impl.hh synchronizer/grid_synchronizer.cc synchronizer/grid_synchronizer.hh synchronizer/grid_synchronizer_tmpl.hh synchronizer/master_element_info_per_processor.cc synchronizer/node_info_per_processor.cc synchronizer/node_info_per_processor.hh synchronizer/node_synchronizer.cc synchronizer/node_synchronizer.hh synchronizer/node_synchronizer_inline_impl.hh synchronizer/periodic_node_synchronizer.cc synchronizer/periodic_node_synchronizer.hh synchronizer/slave_element_info_per_processor.cc synchronizer/synchronizer.cc synchronizer/synchronizer.hh synchronizer/synchronizer_impl.hh synchronizer/synchronizer_impl_tmpl.hh synchronizer/synchronizer_registry.cc synchronizer/synchronizer_registry.hh synchronizer/synchronizer_tmpl.hh synchronizer/communication_buffer.hh ) set(AKANTU_SPIRIT_SOURCES io/mesh_io/mesh_io_abaqus.cc io/parser/parser_real.cc io/parser/parser_random.cc io/parser/parser_types.cc io/parser/parser_input_files.cc PARENT_SCOPE ) find_program(READLINK_COMMAND readlink) find_program(ADDR2LINE_COMMAND addr2line) find_program(PATCH_COMMAND patch) mark_as_advanced(READLINK_COMMAND) mark_as_advanced(ADDR2LINE_COMMAND) package_declare_extra_files_to_package(core SOURCES common/aka_element_classes_info.hh.in common/aka_config.hh.in ) diff --git a/packages/lapack.cmake b/packages/lapack.cmake deleted file mode 100644 index 1a7f9387f..000000000 --- a/packages/lapack.cmake +++ /dev/null @@ -1,39 +0,0 @@ -#=============================================================================== -# @file lapack.cmake -# -# @author Guillaume Anciaux -# @author Nicolas Richart -# -# @date creation: Fri Oct 19 2012 -# @date last modification: Mon Mar 30 2015 -# -# @brief package description for lapack support -# -# -# @section LICENSE -# -# Copyright (©) 2010-2021 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_declare(LAPACK EXTERNAL - DESCRIPTION "Use LAPACK for arithmetic operations" - EXTRA_PACKAGE_OPTIONS LANGUAGE Fortran) - -package_set_package_system_dependency(LAPACK deb liblapack3) -package_set_package_system_dependency(LAPACK deb-src liblapack-dev) diff --git a/packages/pybind11.cmake b/packages/pybind11.cmake deleted file mode 100644 index 5931ac988..000000000 --- a/packages/pybind11.cmake +++ /dev/null @@ -1,47 +0,0 @@ -#=============================================================================== -# @file pybind11.cmake -# -# @author Guillaume Anciaux -# @author Nicolas Richart -# -# @date creation: Fri Dec 22 2017 -# @date last modification: Wed Dec 04 2019 -# -# @brief package description for the pybind11 binding -# -# -# @section LICENSE -# -# Copyright (©) 2016-2021 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(PYBIND11_PYTHON_VERSION ${AKANTU_PREFERRED_PYTHON_VERSION} CACHE INTERNAL "") - -package_declare(pybind11 EXTERNAL - EXTRA_PACKAGE_OPTIONS ARGS "2.4.2;CONFIG" LINK_LIBRARIES pybind11::embed PREFIX pybind11 - DESCRIPTION "Akantu's pybind11 interface" - SYSTEM AUTO third-party/cmake/pybind11.cmake - DEPENDS python - EXCLUDE_FROM_ALL - ) - -package_add_third_party_script_variable(pybind11 - PYBIND11_VERSION "v2.4.2") -package_add_third_party_script_variable(pybind11 - PYBIND11_GIT "https://github.com/pybind/pybind11.git") diff --git a/packages/python.cmake b/packages/python.cmake deleted file mode 100644 index 4d78889a4..000000000 --- a/packages/python.cmake +++ /dev/null @@ -1,80 +0,0 @@ -#=============================================================================== -# @file python_interpreter.cmake -# -# @author Nicolas Richart -# -# @date creation: Wed Oct 31 2018 -# @date last modification: Wed Oct 31 2018 -# -# @brief packages description for the external dependency to the python interpreted -# -# -# @section LICENSE -# -# Copyright (©) 2018-2021 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(FALSE AND CMAKE_VERSION VERSION_GREATER 3.21) - if (PYTHON_EXECUTABLE) - get_filename_component(_python_bin_dir "${PYTHON_EXECUTABLE}" DIRECTORY) - get_filename_component(_python_root_dir "${_python_bin_dir}" DIRECTORY) - set(Python_ROOT_DIR "${_python_bin_dir}" CACHE INTERNAL "") - message(STATUS "Python hint: ${Python_ROOT_DIR}") - endif() - - - package_declare(Python EXTERNAL DESCRIPTION "Akantu's python dependency" - EXTRA_PACKAGE_OPTIONS ARGS - COMPONENTS Interpreter;Development - ) - - package_on_enabled_script(Python - "set(Python_SITELIB \${Python_SITELIB} CACHE INTERNAL \"\") -set(Python_EXECUTABLE \${Python_EXECUTABLE} CACHE INTERNAL \"\") -set(Python_INCLUDE_DIRS \${Python_INCLUDE_DIRS} CACHE INTERNAL \"\") -set(Python_VERSION_MAJOR \${Python_VERSION_MAJOR} CACHE INTERNAL \"\") -set(Python_VERSION_MINOR \${Python_VERSION_MINOR} CACHE INTERNAL \"\") -") -else() - if (PYTHON_LIBRARY MATCHES "\\.a$") - set(PYTHON_LIBRARY NOTFOUND CACHE INTERNAL "") - endif() - package_declare(Python ADVANCED META DESCRIPTION "Akantu's python dependency" - DEPENDS PythonLibsNew PythonInterp - ) - - package_declare(PythonInterp EXTERNAL - DESCRIPTION "Akantu's python Interpreter" - ) - - package_on_enabled_script(PythonInterp - "set(Python_EXECUTABLE \${PYTHON_EXECUTABLE} CACHE INTERNAL \"\")") - - package_declare(PythonLibsNew EXTERNAL - DESCRIPTION "Akantu's python Development" - ) - - package_on_enabled_script(PythonLibsNew - "set(Python_INCLUDE_DIRS \${PYTHON_INCLUDE_DIRS} CACHE INTERNAL \"\") -set(Python_VERSION_MAJOR \${PYTHON_VERSION_MAJOR} CACHE INTERNAL \"\") -set(Python_VERSION_MINOR \${PYTHON_VERSION_MINOR} CACHE INTERNAL \"\") -") - - # package_declare(Numpy EXTERNAL - # DESCRIPTION "Akantu's python Numpy" - # ) -endif() diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 97f9e0114..824892831 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -1,150 +1,148 @@ #=============================================================================== # @file CMakeLists.txt # # @author Guillaume Anciaux # @author Nicolas Richart # # @date creation: Fri Dec 12 2014 # @date last modification: Fri May 07 2021 # # @brief CMake file for the python wrapping of akantu # # # @section LICENSE # # Copyright (©) 2015-2021 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(PYBIND11_PYTHON_VERSION ${AKANTU_PREFERRED_PYTHON_VERSION} CACHE INTERNAL "") - if(NOT SKBUILD) package_get_all_include_directories( AKANTU_LIBRARY_INCLUDE_DIRS ) package_get_all_external_informations( PRIVATE_INCLUDE AKANTU_PRIVATE_EXTERNAL_INCLUDE_DIR INTERFACE_INCLUDE AKANTU_INTERFACE_EXTERNAL_INCLUDE_DIR LIBRARIES AKANTU_EXTERNAL_LIBRARIES ) endif() set(PYAKANTU_SRCS py_aka_common.cc py_aka_error.cc py_akantu.cc py_boundary_conditions.cc py_dof_manager.cc py_fe_engine.cc py_group_manager.cc py_integration_scheme.cc py_mesh.cc py_model.cc py_parser.cc py_solver.cc py_dumpable.cc ) package_is_activated(solid_mechanics _is_activated) if (_is_activated) list(APPEND PYAKANTU_SRCS py_solid_mechanics_model.cc py_material.cc py_material_selector.cc ) endif() package_is_activated(cohesive_element _is_activated) if (_is_activated) list(APPEND PYAKANTU_SRCS py_solid_mechanics_model_cohesive.cc py_fragment_manager.cc ) endif() package_is_activated(heat_transfer _is_activated) if (_is_activated) list(APPEND PYAKANTU_SRCS py_heat_transfer_model.cc ) endif() package_is_activated(contact_mechanics _is_activated) if(_is_activated) list(APPEND PYAKANTU_SRCS py_contact_mechanics_model.cc py_model_couplers.cc ) endif() package_is_activated(phase_field _is_activated) if (_is_activated) list(APPEND PYAKANTU_SRCS py_phase_field_model.cc ) endif() package_is_activated(structural_mechanics _is_activated) if (_is_activated) list(APPEND PYAKANTU_SRCS py_structural_mechanics_model.cc ) endif() pybind11_add_module(py11_akantu ${PYAKANTU_SRCS}) # to avoid compilation warnings from pybind11 target_include_directories(py11_akantu SYSTEM BEFORE PRIVATE ${PYBIND11_INCLUDE_DIR} PRIVATE ${pybind11_INCLUDE_DIR} PRIVATE ${Python_INCLUDE_DIRS}) target_link_libraries(py11_akantu PUBLIC akantu) set_target_properties(py11_akantu PROPERTIES DEBUG_POSTFIX "" LIBRARY_OUTPUT_DIRECTORY akantu) if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") target_compile_options(py11_akantu PUBLIC -fsized-deallocation) endif() file(COPY akantu DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) if(NOT Python_MAJOR) set(Python_VERSION_MAJOR ${PYTHON_VERSION_MAJOR}) set(Python_VERSION_MINOR ${PYTHON_VERSION_MINOR}) endif() if(NOT SKBUILD) set(_python_install_dir ${CMAKE_INSTALL_LIBDIR}/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages/akantu) else() set(_python_install_dir python/akantu) endif() install(TARGETS py11_akantu LIBRARY DESTINATION ${_python_install_dir}) if(NOT SKBUILD) install(DIRECTORY akantu DESTINATION ${_python_install_dir} FILES_MATCHING PATTERN "*.py") endif() diff --git a/src/common/aka_blas_lapack.hh b/src/common/aka_blas_lapack.hh deleted file mode 100644 index 67cda6a0a..000000000 --- a/src/common/aka_blas_lapack.hh +++ /dev/null @@ -1,346 +0,0 @@ -/** - * @file aka_blas_lapack.hh - * - * @author Nicolas Richart - * - * @date creation: Wed Mar 06 2013 - * @date last modification: Tue Sep 29 2020 - * - * @brief Interface of the Fortran BLAS/LAPACK libraries - * - * - * @section LICENSE - * - * Copyright (©) 2014-2021 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 . - * - */ - -/* -------------------------------------------------------------------------- */ -#include "aka_error.hh" -/* -------------------------------------------------------------------------- */ - -#ifndef AKANTU_AKA_BLAS_LAPACK_HH_ -#define AKANTU_AKA_BLAS_LAPACK_HH_ - -/* -------------------------------------------------------------------------- */ -#ifdef AKANTU_USE_BLAS -#include "aka_fortran_mangling.hh" -extern "C" { - -/* ------------------------------------------------------------------------ */ -/* Double precision */ -/* ------------------------------------------------------------------------ */ -// LEVEL 1 -double AKA_FC_GLOBAL(ddot, DDOT)(int *, double *, int *, double *, int *); -void AKA_FC_GLOBAL(daxpy, DAXPY)(int *, double *, double *, int *, double *, - int *); - -// LEVEL 2 -void AKA_FC_GLOBAL(dgemv, DGEMV)(char *, int *, int *, double *, double *, - int *, double *, int *, double *, double *, - int *); -// LEVEL 3 -void AKA_FC_GLOBAL(dgemm, DGEMM)(char *, char *, int *, int *, int *, double *, - double *, int *, double *, int *, double *, - double *, int *); -/* ------------------------------------------------------------------------ */ -/* Simple precision */ -/* ------------------------------------------------------------------------ */ -// LEVEL 1 -float AKA_FC_GLOBAL(sdot, SDOT)(int *, float *, int *, float *, int *); -void AKA_FC_GLOBAL(saxpy, SAXPY)(int *, float *, float *, int *, float *, - int *); - -// LEVEL 2 -void AKA_FC_GLOBAL(sgemv, SGEMV)(char *, int *, int *, float *, float *, int *, - float *, int *, float *, float *, int *); -// LEVEL 3 -void AKA_FC_GLOBAL(sgemm, SGEMM)(char *, char *, int *, int *, int *, float *, - float *, int *, float *, int *, float *, - float *, int *); -} -#endif - -namespace akantu { - -#define AKANTU_WARNING_IGNORE_UNUSED_PARAMETER -#include "aka_warning.hh" - -/// Wrapper around the S/DDOT BLAS function that returns the dot product of two -/// vectors -template -inline T aka_dot(int * n, T * x, int * incx, T * y, int * incy) { - AKANTU_ERROR(debug::demangle(typeid(T).name()) - << "is not a type recognized, or you didn't activated " - "BLAS in the compilation options!"); -} - -/// Wrapper around the S/DAXPY BLAS function that computes \f$y := \alpha x + -/// y\f$ -template -inline void aka_axpy(int * n, T * alpha, T * x, int * incx, T * y, int * incy) { - AKANTU_ERROR(debug::demangle(typeid(T).name()) - << "is not a type recognized, or you didn't activated " - "BLAS in the compilation options!"); -} - -/// Wrapper around the S/DGEMV BLAS function that computes matrix-vector product -/// \f$y := \alpha A^{(T)}x + \beta y \f$ -template -inline void aka_gemv(char * trans, int * m, int * n, T * alpha, T * a, - int * lda, T * x, int * incx, T * beta, T * y, - int * incy) { - AKANTU_ERROR(debug::demangle(typeid(T).name()) - << "is not a type recognized, or you didn't activated " - "BLAS in the compilation options!"); -} - -/// Wrapper around the S/DGEMM BLAS function that computes the product of two -/// matrices \f$C := \alpha A^{(T)} B^{(T)} + \beta C \f$ -template -inline void aka_gemm(char * transa, char * transb, int * m, int * n, int * k, - T * alpha, T * a, int * lda, T * b, int * ldb, T * beta, - T * c, int * ldc) { - AKANTU_ERROR(debug::demangle(typeid(T).name()) - << "is not a type recognized, or you didn't activated " - "BLAS in the compilation options!"); -} - -#if defined(AKANTU_USE_BLAS) -template <> -inline double aka_dot(int * n, double * x, int * incx, double * y, - int * incy) { - return AKA_FC_GLOBAL(ddot, DDOT)(n, x, incx, y, incy); -} - -template <> -inline void aka_axpy(int * n, double * alpha, double * x, int * incx, - double * y, int * incy) { - return AKA_FC_GLOBAL(daxpy, DAXPY)(n, alpha, x, incx, y, incy); -} - -template <> -inline void aka_gemv(char * trans, int * m, int * n, double * alpha, - double * a, int * lda, double * x, int * incx, - double * beta, double * y, int * incy) { - return AKA_FC_GLOBAL(dgemv, DGEMV)(trans, m, n, alpha, a, lda, x, incx, beta, - y, incy); -} - -template <> -inline void aka_gemm(char * transa, char * transb, int * m, int * n, - int * k, double * alpha, double * a, int * lda, - double * b, int * ldb, double * beta, double * c, - int * ldc) { - AKA_FC_GLOBAL(dgemm, DGEMM) - (transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc); -} - -/* -------------------------------------------------------------------------- */ -/* -------------------------------------------------------------------------- */ - -template <> -inline float aka_dot(int * n, float * x, int * incx, float * y, - int * incy) { - return AKA_FC_GLOBAL(sdot, SDOT)(n, x, incx, y, incy); -} - -template <> -inline void aka_axpy(int * n, float * alpha, float * x, int * incx, float * y, - int * incy) { - return AKA_FC_GLOBAL(daxpy, DAXPY)(n, alpha, x, incx, y, incy); -} - -template <> -inline void aka_gemv(char * trans, int * m, int * n, float * alpha, - float * a, int * lda, float * x, int * incx, - float * beta, float * y, int * incy) { - AKA_FC_GLOBAL(sgemv, SGEMV) - (trans, m, n, alpha, a, lda, x, incx, beta, y, incy); -} - -template <> -inline void aka_gemm(char * transa, char * transb, int * m, int * n, - int * k, float * alpha, float * a, int * lda, - float * b, int * ldb, float * beta, float * c, - int * ldc) { - AKA_FC_GLOBAL(sgemm, SGEMM) - (transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc); -} - -#endif - -} // namespace akantu - -#ifdef AKANTU_USE_LAPACK -#include "aka_fortran_mangling.hh" -extern "C" { -/* ------------------------------------------------------------------------ */ -/* Double general matrix */ -/* ------------------------------------------------------------------------ */ -/// compute the eigenvalues/vectors -void AKA_FC_GLOBAL(dgeev, DGEEV)(char * jobvl, char * jobvr, int * n, - double * a, int * lda, double * wr, - double * wi, double * vl, int * ldvl, - double * vr, int * ldvr, double * work, - int * lwork, int * info); - -/// LU decomposition of a general matrix -void AKA_FC_GLOBAL(dgetrf, DGETRF)(int * m, int * n, double * a, int * lda, - int * ipiv, int * info); - -/// generate inverse of a matrix given its LU decomposition -void AKA_FC_GLOBAL(dgetri, DGETRI)(int * n, double * a, int * lda, int * ipiv, - double * work, int * lwork, int * info); - -/// solving A x = b using a LU factorization -void AKA_FC_GLOBAL(dgetrs, DGETRS)(char * trans, int * n, int * nrhs, - double * A, int * lda, int * ipiv, - double * b, int * ldb, int * info); - -/* ------------------------------------------------------------------------ */ -/* Simple general matrix */ -/* ------------------------------------------------------------------------ */ -/// compute the eigenvalues/vectors -void AKA_FC_GLOBAL(sgeev, SGEEV)(char * jobvl, char * jobvr, int * n, float * a, - int * lda, float * wr, float * wi, float * vl, - int * ldvl, float * vr, int * ldvr, - float * work, int * lwork, int * info); - -/// LU decomposition of a general matrix -void AKA_FC_GLOBAL(sgetrf, SGETRF)(int * m, int * n, float * a, int * lda, - int * ipiv, int * info); - -/// generate inverse of a matrix given its LU decomposition -void AKA_FC_GLOBAL(sgetri, SGETRI)(int * n, float * a, int * lda, int * ipiv, - float * work, int * lwork, int * info); - -/// solving A x = b using a LU factorization -void AKA_FC_GLOBAL(sgetrs, SGETRS)(char * trans, int * n, int * nrhs, float * A, - int * lda, int * ipiv, float * b, int * ldb, - int * info); -} -#endif // AKANTU_USE_LAPACK - -namespace akantu { - -/// Wrapper around the S/DGEEV BLAS function that computes the eigenvalues and -/// eigenvectors of a matrix -template -inline void aka_geev(char * jobvl, char * jobvr, int * n, T * a, int * lda, - T * wr, T * wi, T * vl, int * ldvl, T * vr, int * ldvr, - T * work, int * lwork, int * info) { - AKANTU_ERROR(debug::demangle(typeid(T).name()) - << "is not a type recognized, or you didn't activated " - "LAPACK in the compilation options!"); -} - -/// Wrapper around the S/DGETRF BLAS function that computes the LU decomposition -/// of a matrix -template -inline void aka_getrf(int * m, int * n, T * a, int * lda, int * ipiv, - int * info) { - AKANTU_ERROR(debug::demangle(typeid(T).name()) - << "is not a type recognized, or you didn't activated " - "LAPACK in the compilation options!"); -} - -/// Wrapper around the S/DGETRI BLAS function that computes the inverse of a -/// matrix given its LU decomposition -template -inline void aka_getri(int * n, T * a, int * lda, int * ipiv, T * work, - int * lwork, int * info) { - AKANTU_ERROR(debug::demangle(typeid(T).name()) - << "is not a type recognized, or you didn't activated " - "LAPACK in the compilation options!"); -} - -/// Wrapper around the S/DGETRS BLAS function that solves \f$A^{(T)}x = b\f$ -/// using LU decomposition -template -inline void aka_getrs(char * trans, int * n, int * nrhs, T * A, int * lda, - int * ipiv, T * b, int * ldb, int * info) { - AKANTU_ERROR(debug::demangle(typeid(T).name()) - << "is not a type recognized, or you didn't activated " - "LAPACK in the compilation options!"); -} - -#include "aka_warning_restore.hh" - -#ifdef AKANTU_USE_LAPACK -template <> -inline void aka_geev(char * jobvl, char * jobvr, int * n, double * a, - int * lda, double * wr, double * wi, double * vl, - int * ldvl, double * vr, int * ldvr, double * work, - int * lwork, int * info) { - AKA_FC_GLOBAL(dgeev, DGEEV) - (jobvl, jobvr, n, a, lda, wr, wi, vl, ldvl, vr, ldvr, work, lwork, info); -} - -template <> -inline void aka_getrf(int * m, int * n, double * a, int * lda, - int * ipiv, int * info) { - AKA_FC_GLOBAL(dgetrf, DGETRF)(m, n, a, lda, ipiv, info); -} - -template <> -inline void aka_getri(int * n, double * a, int * lda, int * ipiv, - double * work, int * lwork, int * info) { - AKA_FC_GLOBAL(dgetri, DGETRI)(n, a, lda, ipiv, work, lwork, info); -} - -template <> -inline void aka_getrs(char * trans, int * n, int * nrhs, double * A, - int * lda, int * ipiv, double * b, int * ldb, - int * info) { - AKA_FC_GLOBAL(dgetrs, DGETRS)(trans, n, nrhs, A, lda, ipiv, b, ldb, info); -} - -/* -------------------------------------------------------------------------- */ -/* -------------------------------------------------------------------------- */ -template <> -inline void aka_geev(char * jobvl, char * jobvr, int * n, float * a, - int * lda, float * wr, float * wi, float * vl, - int * ldvl, float * vr, int * ldvr, float * work, - int * lwork, int * info) { - AKA_FC_GLOBAL(sgeev, SGEEV) - (jobvl, jobvr, n, a, lda, wr, wi, vl, ldvl, vr, ldvr, work, lwork, info); -} - -template <> -inline void aka_getrf(int * m, int * n, float * a, int * lda, int * ipiv, - int * info) { - AKA_FC_GLOBAL(sgetrf, SGETRF)(m, n, a, lda, ipiv, info); -} - -template <> -inline void aka_getri(int * n, float * a, int * lda, int * ipiv, - float * work, int * lwork, int * info) { - AKA_FC_GLOBAL(sgetri, SGETRI)(n, a, lda, ipiv, work, lwork, info); -} - -template <> -inline void aka_getrs(char * trans, int * n, int * nrhs, float * A, - int * lda, int * ipiv, float * b, int * ldb, - int * info) { - AKA_FC_GLOBAL(sgetrs, SGETRS)(trans, n, nrhs, A, lda, ipiv, b, ldb, info); -} -#endif - -} // namespace akantu - -#endif /* AKANTU_AKA_BLAS_LAPACK_HH_ */ diff --git a/src/common/aka_math_tmpl.hh b/src/common/aka_math_tmpl.hh index b306f9f83..d584e7da7 100644 --- a/src/common/aka_math_tmpl.hh +++ b/src/common/aka_math_tmpl.hh @@ -1,234 +1,233 @@ /** * @file aka_math_tmpl.hh * * @author Ramin Aghababaei * @author Guillaume Anciaux * @author Alejandro M. Aragón * @author Emil Gallyamov * @author David Simon Kammer * @author Daniel Pino Muñoz * @author Mohit Pundir * @author Mathilde Radiguet * @author Nicolas Richart * @author Leonardo Snozzi * @author Peter Spijker * @author Marco Vocialta * * @date creation: Wed Aug 04 2010 * @date last modification: Fri Dec 11 2020 * * @brief Implementation of the inline functions of the math toolkit * * * @section LICENSE * * Copyright (©) 2010-2021 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 . * */ /* -------------------------------------------------------------------------- */ -#include "aka_blas_lapack.hh" #include "aka_math.hh" #include "aka_types.hh" /* -------------------------------------------------------------------------- */ #include #include /* -------------------------------------------------------------------------- */ namespace akantu { namespace Math { /* ------------------------------------------------------------------------ */ template > *> inline Vector normal(const Eigen::MatrixBase & vec) { Vector normal_(vec); normal_[0] = vec[1]; normal_[1] = -vec[0]; normal_.normalize(); return normal_; } /* ------------------------------------------------------------------------ */ template *> inline Vector normal(const Eigen::MatrixBase & vec1, const Eigen::MatrixBase & vec2) { AKANTU_DEBUG_ASSERT(vec1.cols() == 1 and vec1.rows() == 3, "Vec is not of the proper size"); AKANTU_DEBUG_ASSERT(vec2.cols() == 1 and vec2.rows() == 3, "Vec is not of the proper size"); Vector vec1_(vec1); Vector vec2_(vec2); Vector normal_ = (vec1_.cross(vec2_)).normalized(); return normal_; } /* ------------------------------------------------------------------------ */ template inline Real triangle_inradius(const Eigen::MatrixBase & coord1, const Eigen::MatrixBase & coord2, const Eigen::MatrixBase & coord3) { auto a = coord1.distance(coord2); auto b = coord2.distance(coord3); auto c = coord1.distance(coord3); auto s = (a + b + c) / 2.; return std::sqrt((s - a) * (s - b) * (s - c) / s); } /* ------------------------------------------------------------------------ */ template inline Real tetrahedron_volume(const Eigen::MatrixBase & coord1, const Eigen::MatrixBase & coord2, const Eigen::MatrixBase & coord3, const Eigen::MatrixBase & coord4) { Matrix xx; xx.col(0) = coord2; xx.col(1) = coord3; xx.col(2) = coord4; auto vol = xx.determinant(); xx.col(0) = coord1; vol -= xx.determinant(); xx.col(1) = coord2; vol += xx.determinant(); xx.col(2) = coord3; vol -= xx.determinant(); vol /= 6; return vol; } /* ------------------------------------------------------------------------ */ template inline Real tetrahedron_inradius(const Eigen::MatrixBase & coord1, const Eigen::MatrixBase & coord2, const Eigen::MatrixBase & coord3, const Eigen::MatrixBase & coord4) { auto l12 = coord1.distance(coord2); auto l13 = coord1.distance(coord3); auto l14 = coord1.distance(coord4); auto l23 = coord2.distance(coord3); auto l24 = coord2.distance(coord4); auto l34 = coord3.distance(coord4); auto s1 = (l12 + l23 + l13) * 0.5; s1 = std::sqrt(s1 * (s1 - l12) * (s1 - l23) * (s1 - l13)); auto s2 = (l12 + l24 + l14) * 0.5; s2 = std::sqrt(s2 * (s2 - l12) * (s2 - l24) * (s2 - l14)); auto s3 = (l23 + l34 + l24) * 0.5; s3 = std::sqrt(s3 * (s3 - l23) * (s3 - l34) * (s3 - l24)); auto s4 = (l13 + l34 + l14) * 0.5; s4 = std::sqrt(s4 * (s4 - l13) * (s4 - l34) * (s4 - l14)); auto volume = Math::tetrahedron_volume(coord1, coord2, coord3, coord4); return 3 * volume / (s1 + s2 + s3 + s4); } /* ------------------------------------------------------------------------ */ template inline void barycenter(const Eigen::MatrixBase & coord, Eigen::MatrixBase & barycenter) { barycenter.zero(); for (auto && x : coord) { barycenter += x; } barycenter /= (Real)coord.cols(); } /* ------------------------------------------------------------------------ */ /// Combined absolute and relative tolerance test proposed in /// Real-time collision detection by C. Ericson (2004) inline bool are_float_equal(const Real x, const Real y) { Real abs_max = std::max(std::abs(x), std::abs(y)); abs_max = std::max(abs_max, Real(1.)); return std::abs(x - y) <= (tolerance * abs_max); } /* ------------------------------------------------------------------------ */ inline bool isnan(Real x) { #if defined(__INTEL_COMPILER) #pragma warning(push) #pragma warning(disable : 1572) #endif // defined(__INTEL_COMPILER) // x = x return false means x = quiet_NaN return !(x == x); #if defined(__INTEL_COMPILER) #pragma warning(pop) #endif // defined(__INTEL_COMPILER) } /* ------------------------------------------------------------------------ */ inline bool are_vector_equal(Int n, Real * x, Real * y) { bool test = true; for (Int i = 0; i < n; ++i) { test &= are_float_equal(x[i], y[i]); } return test; } /* ------------------------------------------------------------------------ */ inline bool intersects(Real x_min, Real x_max, Real y_min, Real y_max) { return not((x_max < y_min) or (x_min > y_max)); } /* ------------------------------------------------------------------------ */ inline bool is_in_range(Real a, Real x_min, Real x_max) { return ((a >= x_min) and (a <= x_max)); } /* ------------------------------------------------------------------------ */ template inline T pow(T x) { return (pow

(x) * x); } template <> inline Int pow<0, Int>(Int /*x*/) { return (1); } template <> inline Real pow<0, Real>(Real /*x*/) { return (1.); } /* ------------------------------------------------------------------------ */ template template T NewtonRaphson::solve(const Functor & funct, const T & x_0) { T x = x_0; T f_x = funct.f(x); Int iter = 0; while (std::abs(f_x) > this->tolerance && iter < this->max_iteration) { x -= f_x / funct.f_prime(x); f_x = funct.f(x); iter++; } AKANTU_DEBUG_ASSERT(iter < this->max_iteration, "Newton Raphson (" << funct.name << ") solve did not converge in " << this->max_iteration << " iterations (tolerance: " << this->tolerance << ")"); return x; } } // namespace Math } // namespace akantu diff --git a/third-party/cmake/pybind11.cmake b/third-party/cmake/pybind11.cmake index cd2f0c53c..2ab700dcb 100644 --- a/third-party/cmake/pybind11.cmake +++ b/third-party/cmake/pybind11.cmake @@ -1,35 +1,40 @@ set(_working_dir ${PROJECT_BINARY_DIR}/third-party/src/pybind11-download) configure_file(${PROJECT_SOURCE_DIR}/third-party/pybind11.cmake.in ${_working_dir}/CMakeLists.txt) if(NOT EXISTS ${PROJECT_SOURCE_DIR}/third-party/pybind11/CMakeLists.txt) message(STATUS "Downloading pybind11") execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . RESULT_VARIABLE result WORKING_DIRECTORY ${_working_dir} OUTPUT_FILE ${_working_dir}/configure-out.log ERROR_FILE ${_working_dir}/configure-error.log) execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY ${_working_dir} OUTPUT_FILE ${_working_dir}/build-out.log ERROR_FILE ${_working_dir}/build-error.log) endif() set(PYBIND11_PYTHON_VERSION ${AKANTU_PREFERRED_PYTHON_VERSION}) add_subdirectory(${PROJECT_SOURCE_DIR}/third-party/pybind11) set_property(TARGET pybind11 APPEND PROPERTY INTERFACE_SYSTEM_INCLUDE_DIRECTORIES $ $ $ ) if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") target_compile_options(pybind11 INTERFACE -fsized-deallocation) endif() set(pybind11_FOUND TRUE CACHE INTERNAL "" FORCE) set(PYBIND11_INCLUDE_DIR "${PYBIND11_INCLUDE_DIR};${PYTHON_INCLUDE_DIRS}" CACHE INTERNAL "") set(PYBIND11_LIBRARIES "${PYTHON_LIBRARIES}" CACHE INTERNAL "") mask_package_options(PYBIND11) mark_as_advanced(USE_PYTHON_INCLUDE_DIR) + +include (FindPackageHandleStandardArgs) +find_package_handle_standard_args(pybind11 + REQUIRED_VARS PYBIND11_LIBRARIES PYBIND11_INCLUDE_DIR + VERSION_VAR PYBIND11_VERSION)