Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

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

## Unreleased
## 1.1.2

**Changes:**

- plugins are now part of Alien distribution. That means that only `find_package(Alien)` is necessary.

## 1.1.1

Expand Down
24 changes: 24 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,30 @@ if (ALIEN_GENERATE_DOCUMENTATION)
set(DOXYGEN_GENERATE_XML YES)
endif(ALIEN_GENERATE_DOCUMENTATION)

# Use Arccon functions and macros
find_package(Arccon REQUIRED)
list(APPEND CMAKE_MODULE_PATH ${ARCCON_MODULE_PATH})

# use arccon commands otherwise a
include(${ARCCON_CMAKE_COMMANDS})
include(ArcconSetInstallDirs)

# ----------------------------------------------------------------------------
# Configure installation layout.
# Layout. This works for all platforms:
# * <prefix>/lib*/cmake/<PROJECT-NAME>
# * <prefix>/lib*/
# * <prefix>/include/
set(config_install_dir "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")

set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")

# Configuration
set(version_config "${generated_dir}/${PROJECT_NAME}ConfigVersion.cmake")
set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake")
set(namespace "Alien::")


add_subdirectory(src)

if (ALIEN_PLUGIN_HYPRE)
Expand Down
59 changes: 59 additions & 0 deletions docs/sphinx/user/build.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
.. _user_build:

========================
Building and Using Alien
========================

Building Alien
==============

Alien's build system is based on CMake.

Getting the sources
-------------------

One can use Alien's github repository https://github.com/arcaneframework/alien
to either get an archive of a released version https://github.com/arcaneframework/alien/releases or
to clone the repository.

Configuring
-----------

When using a released version, Arccon and Arccore must be installed before being able to compile Alien.
Their install paths can be passed to cmake using `CMAKE_PREFIX_PATH`.

Optional dependencies are:
- HDF5, enabled by setting `ALIEN_USE_HDF5` to `ON`
- libxml2, enabled by setting `ALIEN_USE_xml2` to `ON`
- GoogleTest, enabled by setting `ALIEN_UNIT_TESTS` to `ON`

`ALIEN_DEFAULT_OPTIONS` allows to try detecting installed dependencies and automatically enable them.

Backend librairies are:
- hypre, enabled by setting `ALIEN_PLUGIN_HYPRE` to `ON`
- PETSc, enabled by setting `ALIEN_PLUGIN_PETSC` to `ON`

Example
-------

Configuring, compiling Alien, using hypre and petsc.

.. code-block:: bash

cmake -DALIEN_DEFAULT_OPTIONS:BOOL=ON -DALIEN_PLUGIN_HYPRE:BOOL=ON -DALIEN_PLUGIN_PETSC:BOOL=ON -B <build_dir> <alien_src_path>
cmake --build <build_dir>
cmake --install <build_dir>

Using Alien from a CMake project
================================

Example using hypre and move semantic:

.. code-block:: cmake

find_package(Alien REQUIRED)

add_library(foo <your_src>)
target_link_libraries(foo PRIVATE Alien::hypre_wrapper Alien::semantic_move)


1 change: 1 addition & 0 deletions docs/sphinx/user/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ Alien user documentation

.. toctree::
:maxdepth: 2
build
concepts
move
24 changes: 0 additions & 24 deletions plugins/hypre/.gitignore

This file was deleted.

17 changes: 0 additions & 17 deletions plugins/hypre/CMake/AlienHypreConfig.cmake.in

This file was deleted.

Empty file.
91 changes: 11 additions & 80 deletions plugins/hypre/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,65 +1,13 @@
# Copyright 2020 IFPEN-CEA
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.13)

# To properly handle VERSION directive in PROJECT
cmake_policy(SET CMP0048 NEW)
cmake_policy(SET CMP0023 NEW)

# To export dependencies
cmake_policy(SET CMP0022 NEW)

# for find_package with Foo_ROOT
cmake_policy(SET CMP0074 NEW)

# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------

project(AlienHypre
VERSION 1.0)

# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------

option(ALIEN_HYPRE_UNIT_TESTS "Enable Hypre wrapper tests" ${ALIEN_UNIT_TESTS})

set(BUILD_SHARED_LIBS True)

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMake)

# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------

find_package(Arccon REQUIRED)
list(APPEND CMAKE_MODULE_PATH ${ARCCON_MODULE_PATH})
include(${ARCCON_CMAKE_COMMANDS})

find_package(Arccore REQUIRED)

find_package(Alien REQUIRED)
find_package(Hypre REQUIRED)

find_package(MPI REQUIRED)

find_package(Hypre REQUIRED)

# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------

add_library(alien_hypre
add_library(hypre_wrapper
include/alien/hypre/backend.h
include/alien/hypre/options.h
src/hypre_vector.cpp
Expand All @@ -73,11 +21,11 @@ add_library(alien_hypre
src/converters/simplecsr_to_hypre_matrix.cpp
)

target_link_libraries(alien_hypre PUBLIC
target_link_libraries(hypre_wrapper PUBLIC
Alien::alien_core
)

target_link_libraries(alien_hypre PRIVATE
target_link_libraries(hypre_wrapper PRIVATE
MPI::MPI_CXX
Arccore::arccore_trace
Arccore::arccore_collections
Expand All @@ -86,17 +34,18 @@ target_link_libraries(alien_hypre PRIVATE
arccon::Hypre
)

target_include_directories(alien_hypre PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
target_include_directories(hypre_wrapper PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)

add_library(Alien::alien_hypre ALIAS alien_hypre)
add_library(Alien::hypre_wrapper ALIAS hypre_wrapper)

include(GenerateExportHeader)

generate_export_header(alien_hypre
generate_export_header(hypre_wrapper
BASE_NAME ALIEN_HYPRE
EXPORT_FILE_NAME include/alien/hypre/export.h
)

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

install(TARGETS alien_hypre EXPORT ${ALIENHYPRE_EXPORT_TARGET}
install(TARGETS hypre_wrapper EXPORT ${ALIENHYPRE_EXPORT_TARGET}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
Expand All @@ -129,28 +78,10 @@ install(
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alien/hypre
)

set(alien_install_lib "${CMAKE_INSTALL_LIBDIR}/alien")
set(config_install_dir "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")

install(EXPORT ${ALIENHYPRE_EXPORT_TARGET}
NAMESPACE Alien::
NAMESPACE ${namespace}
DESTINATION ${config_install_dir})

include(CMakePackageConfigHelpers)

set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake")

configure_package_config_file(
CMake/${PROJECT_NAME}Config.cmake.in
"${project_config}"
INSTALL_DESTINATION "${config_install_dir}"
)

install(FILES "${project_config}"
DESTINATION "${config_install_dir}"
)

install(DIRECTORY examples/ DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples/hypre)
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
Loading