Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Commit 9b5ba8d

Browse files
Monolithic plugins (#74)
* [hypre, petsc]: plugins are fully integrated in repository plugins no longer export their own Config.cmake file. * [hypre, petsc]: rename target to tpl_wrapper instead of previous `alien_tpl` * [hypre]: simplify examples CMakeLists.txt * [doc]: how to use Alien's CMake * update CHANGELOG.md
1 parent 3433e1b commit 9b5ba8d

File tree

18 files changed

+114
-655
lines changed

18 files changed

+114
-655
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22

33
All notable changes to this project will be documented in this file.
44

5-
## Unreleased
5+
## 1.1.2
6+
7+
**Changes:**
8+
9+
- plugins are now part of Alien distribution. That means that only `find_package(Alien)` is necessary.
610

711
## 1.1.1
812

CMakeLists.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,30 @@ if (ALIEN_GENERATE_DOCUMENTATION)
126126
set(DOXYGEN_GENERATE_XML YES)
127127
endif(ALIEN_GENERATE_DOCUMENTATION)
128128

129+
# Use Arccon functions and macros
130+
find_package(Arccon REQUIRED)
131+
list(APPEND CMAKE_MODULE_PATH ${ARCCON_MODULE_PATH})
132+
133+
# use arccon commands otherwise a
134+
include(${ARCCON_CMAKE_COMMANDS})
135+
include(ArcconSetInstallDirs)
136+
137+
# ----------------------------------------------------------------------------
138+
# Configure installation layout.
139+
# Layout. This works for all platforms:
140+
# * <prefix>/lib*/cmake/<PROJECT-NAME>
141+
# * <prefix>/lib*/
142+
# * <prefix>/include/
143+
set(config_install_dir "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
144+
145+
set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
146+
147+
# Configuration
148+
set(version_config "${generated_dir}/${PROJECT_NAME}ConfigVersion.cmake")
149+
set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake")
150+
set(namespace "Alien::")
151+
152+
129153
add_subdirectory(src)
130154

131155
if (ALIEN_PLUGIN_HYPRE)

docs/sphinx/user/build.rst

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
.. _user_build:
2+
3+
========================
4+
Building and Using Alien
5+
========================
6+
7+
Building Alien
8+
==============
9+
10+
Alien's build system is based on CMake.
11+
12+
Getting the sources
13+
-------------------
14+
15+
One can use Alien's github repository https://github.com/arcaneframework/alien
16+
to either get an archive of a released version https://github.com/arcaneframework/alien/releases or
17+
to clone the repository.
18+
19+
Configuring
20+
-----------
21+
22+
When using a released version, Arccon and Arccore must be installed before being able to compile Alien.
23+
Their install paths can be passed to cmake using `CMAKE_PREFIX_PATH`.
24+
25+
Optional dependencies are:
26+
- HDF5, enabled by setting `ALIEN_USE_HDF5` to `ON`
27+
- libxml2, enabled by setting `ALIEN_USE_xml2` to `ON`
28+
- GoogleTest, enabled by setting `ALIEN_UNIT_TESTS` to `ON`
29+
30+
`ALIEN_DEFAULT_OPTIONS` allows to try detecting installed dependencies and automatically enable them.
31+
32+
Backend librairies are:
33+
- hypre, enabled by setting `ALIEN_PLUGIN_HYPRE` to `ON`
34+
- PETSc, enabled by setting `ALIEN_PLUGIN_PETSC` to `ON`
35+
36+
Example
37+
-------
38+
39+
Configuring, compiling Alien, using hypre and petsc.
40+
41+
.. code-block:: bash
42+
43+
cmake -DALIEN_DEFAULT_OPTIONS:BOOL=ON -DALIEN_PLUGIN_HYPRE:BOOL=ON -DALIEN_PLUGIN_PETSC:BOOL=ON -B <build_dir> <alien_src_path>
44+
cmake --build <build_dir>
45+
cmake --install <build_dir>
46+
47+
Using Alien from a CMake project
48+
================================
49+
50+
Example using hypre and move semantic:
51+
52+
.. code-block:: cmake
53+
54+
find_package(Alien REQUIRED)
55+
56+
add_library(foo <your_src>)
57+
target_link_libraries(foo PRIVATE Alien::hypre_wrapper Alien::semantic_move)
58+
59+

docs/sphinx/user/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ Alien user documentation
55

66
.. toctree::
77
:maxdepth: 2
8+
build
89
concepts
910
move

plugins/hypre/.gitignore

Lines changed: 0 additions & 24 deletions
This file was deleted.

plugins/hypre/CMake/AlienHypreConfig.cmake.in

Lines changed: 0 additions & 17 deletions
This file was deleted.

plugins/hypre/CMake/FindAlienHypre.cmake

Whitespace-only changes.

plugins/hypre/CMakeLists.txt

Lines changed: 11 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,13 @@
1-
# Copyright 2020 IFPEN-CEA
2-
#
3-
# Licensed under the Apache License, Version 2.0 (the "License");
4-
# you may not use this file except in compliance with the License.
5-
# You may obtain a copy of the License at
6-
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
8-
#
9-
# Unless required by applicable law or agreed to in writing, software
10-
# distributed under the License is distributed on an "AS IS" BASIS,
11-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
# See the License for the specific language governing permissions and
13-
# limitations under the License.
14-
#
15-
# SPDX-License-Identifier: Apache-2.0
16-
17-
cmake_minimum_required(VERSION 3.13)
18-
19-
# To properly handle VERSION directive in PROJECT
20-
cmake_policy(SET CMP0048 NEW)
21-
cmake_policy(SET CMP0023 NEW)
22-
23-
# To export dependencies
24-
cmake_policy(SET CMP0022 NEW)
25-
26-
# for find_package with Foo_ROOT
27-
cmake_policy(SET CMP0074 NEW)
28-
29-
# ----------------------------------------------------------------------------
30-
# ----------------------------------------------------------------------------
31-
32-
project(AlienHypre
33-
VERSION 1.0)
34-
35-
# ----------------------------------------------------------------------------
36-
# ----------------------------------------------------------------------------
37-
381
option(ALIEN_HYPRE_UNIT_TESTS "Enable Hypre wrapper tests" ${ALIEN_UNIT_TESTS})
392

40-
set(BUILD_SHARED_LIBS True)
41-
42-
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMake)
43-
44-
# ----------------------------------------------------------------------------
45-
# ----------------------------------------------------------------------------
46-
47-
find_package(Arccon REQUIRED)
48-
list(APPEND CMAKE_MODULE_PATH ${ARCCON_MODULE_PATH})
49-
include(${ARCCON_CMAKE_COMMANDS})
50-
51-
find_package(Arccore REQUIRED)
52-
53-
find_package(Alien REQUIRED)
3+
find_package(Hypre REQUIRED)
544

555
find_package(MPI REQUIRED)
566

57-
find_package(Hypre REQUIRED)
58-
597
# ----------------------------------------------------------------------------
608
# ----------------------------------------------------------------------------
619

62-
add_library(alien_hypre
10+
add_library(hypre_wrapper
6311
include/alien/hypre/backend.h
6412
include/alien/hypre/options.h
6513
src/hypre_vector.cpp
@@ -73,11 +21,11 @@ add_library(alien_hypre
7321
src/converters/simplecsr_to_hypre_matrix.cpp
7422
)
7523

76-
target_link_libraries(alien_hypre PUBLIC
24+
target_link_libraries(hypre_wrapper PUBLIC
7725
Alien::alien_core
7826
)
7927

80-
target_link_libraries(alien_hypre PRIVATE
28+
target_link_libraries(hypre_wrapper PRIVATE
8129
MPI::MPI_CXX
8230
Arccore::arccore_trace
8331
Arccore::arccore_collections
@@ -86,17 +34,18 @@ target_link_libraries(alien_hypre PRIVATE
8634
arccon::Hypre
8735
)
8836

89-
target_include_directories(alien_hypre PUBLIC
90-
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
37+
target_include_directories(hypre_wrapper PUBLIC
38+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
9139
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
9240
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
9341
)
9442

95-
add_library(Alien::alien_hypre ALIAS alien_hypre)
43+
add_library(Alien::hypre_wrapper ALIAS hypre_wrapper)
9644

9745
include(GenerateExportHeader)
9846

99-
generate_export_header(alien_hypre
47+
generate_export_header(hypre_wrapper
48+
BASE_NAME ALIEN_HYPRE
10049
EXPORT_FILE_NAME include/alien/hypre/export.h
10150
)
10251

@@ -119,7 +68,7 @@ install(DIRECTORY include/alien/hypre
11968
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alien
12069
)
12170

122-
install(TARGETS alien_hypre EXPORT ${ALIENHYPRE_EXPORT_TARGET}
71+
install(TARGETS hypre_wrapper EXPORT ${ALIENHYPRE_EXPORT_TARGET}
12372
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
12473
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
12574
)
@@ -129,28 +78,10 @@ install(
12978
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alien/hypre
13079
)
13180

132-
set(alien_install_lib "${CMAKE_INSTALL_LIBDIR}/alien")
133-
set(config_install_dir "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
134-
13581
install(EXPORT ${ALIENHYPRE_EXPORT_TARGET}
136-
NAMESPACE Alien::
82+
NAMESPACE ${namespace}
13783
DESTINATION ${config_install_dir})
13884

139-
include(CMakePackageConfigHelpers)
140-
141-
set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
142-
set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake")
143-
144-
configure_package_config_file(
145-
CMake/${PROJECT_NAME}Config.cmake.in
146-
"${project_config}"
147-
INSTALL_DESTINATION "${config_install_dir}"
148-
)
149-
150-
install(FILES "${project_config}"
151-
DESTINATION "${config_install_dir}"
152-
)
153-
15485
install(DIRECTORY examples/ DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples/hypre)
15586
# ----------------------------------------------------------------------------
15687
# ----------------------------------------------------------------------------

0 commit comments

Comments
 (0)