Skip to content

Commit 757315a

Browse files
[arcane,config] Renomme le 'FindTrilinos.cmake' en 'FindTrilinosAleph.cmake'.
Ce package n'est utilisé que par 'Aleph'. Cela évite d'avoir un conflit avec le vrai package Trilinos.
1 parent c3a3808 commit 757315a

File tree

3 files changed

+79
-69
lines changed

3 files changed

+79
-69
lines changed

arcane/cmake/Modules/FindTrilinos.cmake

Lines changed: 0 additions & 63 deletions
This file was deleted.
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#
2+
# Cherche les composants de Trilinos nécessaires pour Aleph.
3+
#
4+
# Afin de ne pas interférer avec la package Trilinos, on nomme ce
5+
# package 'TrilinosAleph'. Il n'est utilisé que pour Aleph
6+
#
7+
# À la date de novembre 2023, L'utilisation de CMake
8+
# avec Trilinos est assez compliqué car Trilinos fournit
9+
# des fichiers de configuration CMake pour chaque composant
10+
# mais ces derniers ne sont pas facilement utilisables pour deux raisons:
11+
# - le nom de la cible peut varier suivant l'installation.
12+
# Par exemple, pour un composant 'ifpack', le nom
13+
# de la cible peut être 'ifpack' (si compilé avec Spack)
14+
# ou 'trilinos_ifpack' (si package système ubuntu)
15+
# - la cible importée ne contient pas la liste des fichiers
16+
# d'en-tête nécessaires.
17+
#
18+
# Le seul moyen qui semble identique quelles que soient les
19+
# installations est d'utilier les variables '<pkg>_INCLUDE_DIRS'
20+
# et '<pkg>_LIBRARIES'. On utilise donc ce mécanisme.
21+
#
22+
arccon_return_if_package_found(TrilinosAleph)
23+
24+
set(Trilinos_TARGETS_IMPORTED 1)
25+
find_package(AztecOO QUIET)
26+
find_package(ML QUIET)
27+
find_package(Ifpack QUIET)
28+
find_package(Epetra QUIET)
29+
30+
message(STATUS "AztecOO_FOUND " ${AztecOO_FOUND})
31+
message(STATUS "ML_FOUND " ${ML_FOUND})
32+
message(STATUS "Ifpack_FOUND " ${Ifpack_FOUND})
33+
message(STATUS "Epetra_FOUND " ${Epetra_FOUND})
34+
35+
set(TrilinosAleph_FOUND "NO")
36+
37+
if (AztecOO_FOUND AND ML_FOUND AND Ifpack_FOUND AND Epetra_FOUND)
38+
message(STATUS "Found Trilinos components for Aleph")
39+
SET(TrilinosAleph_INCLUDE_DIRS "${AztecOO_INCLUDE_DIRS}" "${ML_INCLUDE_DIRS}" "${Ifpack_INCLUDE_DIRS}" "${Epetra_INCLUDE_DIRS}")
40+
SET(TrilinosAleph_LIBRARIES "${AztecOO_LIBRARIES}" "${ML_LIBRARIES}" "${Ifpack_LIBRARIES}" "${Epetra_LIBRARIES}")
41+
if (TrilinosAleph_INCLUDE_DIRS AND TrilinosAleph_LIBRARIES)
42+
set(TrilinosAleph_FOUND YES)
43+
endif()
44+
endif()
45+
46+
# Remove duplicate libraries, keeping the last (for linking)
47+
if (TrilinosAleph_FOUND)
48+
set(TrilinosAleph_FOUND TRUE)
49+
LIST(REVERSE TrilinosAleph_LIBRARIES)
50+
LIST(REMOVE_DUPLICATES TrilinosAleph_LIBRARIES)
51+
LIST(REVERSE TrilinosAleph_LIBRARIES)
52+
arccon_register_package_library(TrilinosAleph TrilinosAleph)
53+
endif ()
54+
55+
message(STATUS "TrilinosAleph_LIBRARIES = ${TrilinosAleph_LIBRARIES}")
56+
message(STATUS "TrilinosAleph_INCLUDE_DIRS = '${TrilinosAleph_INCLUDE_DIRS}'")
57+
message(STATUS "TrilinosAleph_FOUND = '${TrilinosAleph_FOUND}'")
58+
59+
if (NOT TrilinosAleph_FOUND)
60+
unset(TrilinosAleph_INCLUDE_DIRS)
61+
unset(TrilinosAleph_LIBRARIES)
62+
endif()
63+
64+
# ----------------------------------------------------------------------------
65+
# Local Variables:
66+
# tab-width: 2
67+
# indent-tabs-mode: nil
68+
# coding: utf-8-with-signature
69+
# End:

arcane/src/arcane/aleph/trilinos/CMakeLists.txt

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
message(STATUS "ALEPH_TRILINOS subdirectory")
2-
set(PKGS Trilinos MPI)
3-
arcane_find_package(Trilinos)
4-
if (NOT TARGET arcconpkg_Trilinos)
5-
return()
6-
endif()
1+
message(STATUS "'arcane_aleph_trilinos' subdirectory")
2+
3+
set(PKGS TrilinosAleph MPI)
4+
foreach(package ${PKGS})
5+
arcane_find_package(${package})
6+
if (NOT ${package}_FOUND)
7+
message(STATUS "Disabling 'arcane_aleph_trilinos' because package '${package}' is not found")
8+
return()
9+
endif()
10+
endforeach()
711

812
include(srcs.cmake)
913

0 commit comments

Comments
 (0)