-
Notifications
You must be signed in to change notification settings - Fork 315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[LinearSolver.Direct] Fix metis dependency #4450
Merged
bakpaul
merged 17 commits into
sofa-framework:master
from
olivier-roussel:metis_dyn_link_2
Feb 27, 2024
Merged
Changes from 3 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
a32727d
Link dynamically with embedded metis to comply conda-forge rules
olivier-roussel 804bd07
export all symbols (for MSVC)
fredroy 58275b5
Use external 5.1.0 metis or fallback to embedded code linked dynamically
olivier-roussel b5439ba
fix comments in metis cmake module
olivier-roussel fb334ff
Merge branch 'master' into metis_dyn_link_2
bakpaul d961994
ADD find or fetch mechanism
bakpaul b6aa3c2
Remove embeded metis and put linkage to private
bakpaul 750cc6b
Fix metis dependency but still not the best fix
bakpaul e2b4a1d
test
bakpaul 71baa47
Put back public linkage
bakpaul 6a44fe3
Revert "Put back public linkage"
bakpaul b9b0b43
Clean
bakpaul 34d4c09
cleaning #2
bakpaul f5003d2
Use SOFA_ALLOW_FETCH_DEPENDENCIES cmake option for metis
olivier-roussel c9dc6be
Add missing CImg to list of fetchable dependencies in doc
olivier-roussel 949b828
Update applications/plugins/SofaMatrix/CMakeLists.txt
bakpaul 16ab45c
Merge branch 'master' into metis_dyn_link_2
bakpaul File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
# Find the metis headers and libraries | ||
# Behavior is to first look for config files, such as the one installed by some package | ||
# managers who provides their own cmake files. | ||
# Most of them and official sources does not provide cmake finders, so if no config files | ||
# were found, this tries to find the library by looking at headers / lib file. | ||
# | ||
# Defines: | ||
# Metis_FOUND : True if metis is found | ||
# Metis_FOUND : True if metis is found | ||
# | ||
# Provides both targets metis and metis::metis. | ||
# Target metis::metis is just an alias to metis. | ||
# We chose to create an alias to provide a unified interface usable whatever the package manager | ||
# was used to provide the library, as some package managers (such vcpkg) defines only short name | ||
# for the target, whereas others (such as conan) defines a fully qualified name. | ||
|
||
find_package(metis NO_MODULE QUIET) | ||
|
||
if(NOT Metis_FIND_VERSION) | ||
if(NOT Metis_FIND_VERSION_MAJOR) | ||
set(Metis_FIND_VERSION_MAJOR 0) | ||
endif(NOT Metis_FIND_VERSION_MAJOR) | ||
if(NOT Metis_FIND_VERSION_MINOR) | ||
set(Metis_FIND_VERSION_MINOR 0) | ||
endif(NOT Metis_FIND_VERSION_MINOR) | ||
if(NOT Metis_FIND_VERSION_PATCH) | ||
set(Metis_FIND_VERSION_PATCH 0) | ||
endif(NOT Metis_FIND_VERSION_PATCH) | ||
set(Metis_FIND_VERSION "${Metis_FIND_VERSION_MAJOR}.${Metis_FIND_VERSION_MINOR}.${Metis_FIND_VERSION_PATCH}") | ||
endif() | ||
|
||
macro(_metis_check_version) | ||
if(EXISTS "${Metis_INCLUDE_DIR}/metis.h") | ||
file(READ "${Metis_INCLUDE_DIR}/metis.h" _metis_version_header) | ||
endif() | ||
|
||
string(REGEX MATCH "define[ \t]+METIS_VER_MAJOR[ \t]+([0-9]+)" _metis_major_version_match "${_metis_version_header}") | ||
set(Metis_VERSION_MAJOR "${CMAKE_MATCH_1}") | ||
string(REGEX MATCH "define[ \t]+METIS_VER_MINOR[ \t]+([0-9]+)" _metis_minor_version_match "${_metis_version_header}") | ||
set(Metis_VERSION_MINOR "${CMAKE_MATCH_1}") | ||
string(REGEX MATCH "define[ \t]+METIS_VER_SUBMINOR[ \t]+([0-9]+)" _metis_patch_version_match "${_metis_version_header}") | ||
set(Metis_VERSION_PATCH "${CMAKE_MATCH_1}") | ||
|
||
set(Metis_VERSION ${Metis_VERSION_MAJOR}.${Metis_VERSION_MINOR}.${Metis_VERSION_PATCH}) | ||
set(Metis_VERSION_OK TRUE) | ||
if(${Metis_VERSION} VERSION_LESS ${Metis_FIND_VERSION}) | ||
set(Metis_VERSION_OK FALSE) | ||
message(SEND_ERROR "Metis version ${Metis_VERSION} found in ${Metis_INCLUDE_DIR}, " | ||
"but at least version ${Metis_FIND_VERSION} is required") | ||
endif() | ||
if(${Metis_FIND_VERSION_EXACT} AND NOT ${Metis_VERSION} VERSION_EQUAL ${Metis_FIND_VERSION}) | ||
set(Metis_VERSION_OK FALSE) | ||
message(SEND_ERROR "Metis version ${Metis_VERSION} found in ${Metis_INCLUDE_DIR}, " | ||
"but exact version ${Metis_FIND_VERSION} is required") | ||
endif() | ||
# message(STATUS "Metis version found: ${Metis_VERSION} in ${Metis_INCLUDE_DIR}, ${Metis_FIND_VERSION} was required ") | ||
endmacro() | ||
|
||
if(TARGET metis) | ||
set(Metis_FOUND TRUE) # only metis_FOUND has been set | ||
if(Metis_INCLUDE_DIR AND NOT DEFINED Metis_VERSION) | ||
_metis_check_version() | ||
endif() | ||
set(Metis_FOUND ${Metis_VERSION_OK}) | ||
add_library(metis::metis ALIAS metis) | ||
else() | ||
|
||
if(NOT Metis_INCLUDE_DIR) | ||
find_path(Metis_INCLUDE_DIR | ||
NAMES metis.h | ||
PATH_SUFFIXES include | ||
) | ||
endif() | ||
|
||
if(NOT Metis_LIBRARY) | ||
find_library(Metis_LIBRARY | ||
NAMES metis | ||
PATH_SUFFIXES lib | ||
) | ||
endif() | ||
|
||
if(Metis_INCLUDE_DIR AND Metis_LIBRARY) | ||
_metis_check_version() | ||
set(Metis_FOUND ${Metis_VERSION_OK}) | ||
endif() | ||
|
||
if(Metis_FOUND) | ||
set(Metis_LIBRARIES ${Metis_LIBRARY}) | ||
set(Metis_INCLUDE_DIRS ${Metis_INCLUDE_DIR}) | ||
|
||
if(NOT Metis_FIND_QUIETLY) | ||
message(STATUS "Found Metis: ${Metis_LIBRARIES} (version ${Metis_VERSION} from ${Metis_INCLUDE_DIR}/metis.h)") | ||
endif() | ||
|
||
if(NOT TARGET metis) | ||
add_library(metis INTERFACE IMPORTED) | ||
set_property(TARGET metis PROPERTY INTERFACE_LINK_LIBRARIES "${Metis_LIBRARIES}") | ||
set_property(TARGET metis PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${Metis_INCLUDE_DIR}") | ||
endif() | ||
add_library(metis::metis ALIAS metis) | ||
else() | ||
endif() | ||
mark_as_advanced(Metis_INCLUDE_DIR Metis_LIBRARY) | ||
endif() | ||
|
||
if(NOT Metis_FOUND AND Metis_FIND_REQUIRED) | ||
message(FATAL_ERROR "Cannot find metis") | ||
endif() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to message or not? If not, please remove this line