diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9a7d7f5..2000e01 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,92 +1,92 @@
-/**
- * @file CMakeLists.txt
- *
- * @brief Principal CMake configuration file
- *
- * @copyright
- * Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne)
- * SPC (Swiss Plasma Center)
- *
- * futils 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.
- *
- * futils 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 General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see .
- *
- * @authors
- * (in alphabetical order)
- * @author Nicolas Richart
- * @author Trach-Minh Tran
- */
+#
+# @file CMakeLists.txt
+#
+# @brief Principal CMake configuration file
+#
+# @copyright
+# Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne)
+# SPC (Swiss Plasma Center)
+#
+# futils 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.
+#
+# futils 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 General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see .
+#
+# @authors
+# (in alphabetical order)
+# @author Nicolas Richart
+# @author Trach-Minh Tran
+#
cmake_minimum_required (VERSION 2.8.8)
project(futils)
enable_language(Fortran)
enable_testing()
if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")
include(futilsTools)
if(NOT DEFINED FUTILS_EXAMPLES)
option(FUTILS_EXAMPLES "Activates examples" ON)
endif()
# Installation root directory
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
if($ENV{PREFIX})
set(${CMAKE_INSTALL_PREFIX} $ENV{PREFIX})
else()
set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH "..." FORCE)
endif()
message(STATUS "CMAKE_INSTALL_PREFIX is " ${CMAKE_INSTALL_PREFIX})
endif()
# Require parallel-HDF5 and MPI
find_package(HDF5 COMPONENTS Fortran REQUIRED)
mark_as_advanced_prefix(HDF5_Fortran)
find_package(MPI REQUIRED)
# Is slurm installed?
#find_path(SRUN srun)
#if (EXISTS ${SRUN})
# set(MPIEXEC "${SRUN}/srun")
# set(MPIEXEC_NUMPROC_FLAG "-n")
#endif()
#message("MPIEXEC is ${MPIEXEC}")
#message("MPIEXEC_NUMPROC_FLAG is ${MPIEXEC_NUMPROC_FLAG}")
if(NOT FUTILS_EXPORT_TARGETS)
set(FUTILS_EXPORT_TARGETS futils-targets)
endif()
# Add futils source and examples/tests directories
add_subdirectory(src)
if(FUTILS_EXAMPLES)
add_subdirectory(examples)
endif()
if(FUTILS_EXPORT_TARGETS MATCHES "futils-targets")
# Create and install package configuration files
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/cmake/futils-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/cmake/futils-config.cmake @ONLY
)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/cmake/futils-config.cmake
DESTINATION lib/cmake
)
endif()
diff --git a/cmake/CMakeFlagsHandling.cmake b/cmake/CMakeFlagsHandling.cmake
index cc5ef7e..68813b3 100644
--- a/cmake/CMakeFlagsHandling.cmake
+++ b/cmake/CMakeFlagsHandling.cmake
@@ -1,100 +1,100 @@
-/**
- * @file CMakeLists.txt
- *
- * @brief Principal CMake configuration file
- *
- * @copyright
- * Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne)
- * SPC (Swiss Plasma Center)
- *
- * futils 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.
- *
- * futils 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 General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see .
- *
- * @authors
- * (in alphabetical order)
- * @author Nicolas Richart
- */
+#
+# @file CMakeFlagsHandling.cmake
+#
+# @brief
+#
+# @copyright
+# Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne)
+# SPC (Swiss Plasma Center)
+#
+# futils 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.
+#
+# futils 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 General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see .
+#
+# @authors
+# (in alphabetical order)
+# @author Nicolas Richart
+#
if(_CMAKE_FLAGS_HANDLING)
return()
endif()
set(_CMAKE_FLAGS_HANDLING TRUE)
#===============================================================================
# Compilation options handling
#===============================================================================
macro(_get_flags_message lang type desc)
if(${lang} MATCHES "C.." OR ${lang} MATCHES "Fortran")
set(${desc} "Flags used by the compiler")
elseif(${lang} MATCHES ".*_LINKER")
set(${desc} "Flags used by the linker")
endif()
if(${lang} MATCHES "SHARED_LINKER")
set(${desc} "${desc} during the creation of shared libraries")
elseif(${lang} MATCHES "MODULE_LINKER")
set(${desc} "${desc} during the creation of modules")
elseif(${lang} MATCHES "STATIC_LINKER")
set(${desc} "${desc} linker during the creation of static libraries")
endif()
if(${type} MATCHES "ALL")
set(${desc} "${desc} during all build types")
else()
set(${desc} "${desc} during ${type} builds")
endif()
endmacro()
#===============================================================================
function(handle_flags)
include(CMakeParseArguments)
cmake_parse_arguments(_flags
"ADD;REMOVE" "LANG;TYPE" ""
${ARGN}
)
if(NOT _flags_LANG)
set(_flags_LANG ${FLAGS_HANDLING_DEFAULT_LANGUAGE})
endif()
set(_variable CMAKE_${_flags_LANG}_FLAGS)
if (_flags_TYPE)
set(_variable ${_variable}_${_flags_TYPE})
else()
set(_flags_TYPE "ALL")
endif()
_get_flags_message(${_flags_LANG} ${_flags_TYPE} _desc)
foreach(flag ${_flags_UNPARSED_ARGUMENTS})
if (_flags_ADD)
string(REPLACE "${flag}" "match" _temp_var "${${_variable}}")
if(NOT _temp_var MATCHES "match")
set(${_variable} "${flag} ${${_variable}}" CACHE STRING ${_desc} FORCE)
endif()
elseif(_flags_REMOVE)
string(REPLACE "${flag} " "" ${_variable} "${${_variable}}")
set(${_variable} "${${_variable}}" CACHE STRING ${_desc} FORCE)
endif()
endforeach()
endfunction()
#===============================================================================
function(add_flags)
handle_flags(ADD ${ARGN})
endfunction()
#===============================================================================
function(remove_flags)
handle_flags(REMOVE ${ARGN})
endfunction()
#===============================================================================
diff --git a/cmake/futils-config.cmake.in b/cmake/futils-config.cmake.in
index 9c880cb..0e9febd 100644
--- a/cmake/futils-config.cmake.in
+++ b/cmake/futils-config.cmake.in
@@ -1,48 +1,48 @@
-/**
- * @file CMakeLists.txt
- *
- * @brief Principal CMake configuration file
- *
- * @copyright
- * Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne)
- * SPC (Swiss Plasma Center)
- *
- * futils 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.
- *
- * futils 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 General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see .
- *
- * @authors
- * (in alphabetical order)
- * @author Trach-Minh Tran
- */
+#
+# @file futils-config.cmake.in
+#
+# @brief Config file for futils CMake
+#
+# @copyright
+# Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne)
+# SPC (Swiss Plasma Center)
+#
+# futils 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.
+#
+# futils 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 General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see .
+#
+# @authors
+# (in alphabetical order)
+# @author Trach-Minh Tran
+#
# - Config file for the FUTILS package
# It defines the target the following variables:
# FUTILS_MODS - include directories for futils modules
# FUTILS_LIBS - futils library
# FUTILS_EXTRA_INCS - additional include directories
# FUTILS_EXTRA_LIBS - additional libraries
# MPIEXEC - MPI launcher
# MPIEXEC_NUMPROC_FLAG - Number of MPI processes flag
# Compute paths
get_filename_component(_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_prefix "${_dir}/../.." ABSOLUTE)
# Import the targets
include("${_prefix}/lib/cmake/futils-targets.cmake")
# Report other information
set(FUTILS_MODS "${_prefix}/include")
set(FUTILS_LIBS futils)
set(FUTILS_EXTRA_INCS "@EXTRA_INCS@")
set(FUTILS_EXTRA_LIBS "@EXTRA_LIBS@")
set(MPIEXEC "@MPIEXEC@")
set(MPIEXEC_NUMPROC_FLAG "@MPIEXEC_NUMPROC_FLAG@")
diff --git a/cmake/futilsTools.cmake b/cmake/futilsTools.cmake
index d96bf4e..18dd4a0 100644
--- a/cmake/futilsTools.cmake
+++ b/cmake/futilsTools.cmake
@@ -1,33 +1,33 @@
-/**
- * @file CMakeLists.txt
- *
- * @brief Principal CMake configuration file
- *
- * @copyright
- * Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne)
- * SPC (Swiss Plasma Center)
- *
- * futils 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.
- *
- * futils 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 General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see .
- *
- * @authors
- * (in alphabetical order)
- * @author Nicolas Richart
- */
+#
+# @file futilsTools.cmake
+#
+# @brief
+#
+# @copyright
+# Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne)
+# SPC (Swiss Plasma Center)
+#
+# futils 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.
+#
+# futils 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 General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see .
+#
+# @authors
+# (in alphabetical order)
+# @author Nicolas Richart
+#
function(mark_as_advanced_prefix prefix)
get_property(_list DIRECTORY PROPERTY VARIABLES)
foreach(_var ${_list})
if(_var MATCHES "^${prefix}")
mark_as_advanced(${_var})
endif()
endforeach()
endfunction()
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index b69b067..fde6ad4 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,74 +1,74 @@
-/**
- * @file CMakeLists.txt
- *
- * @brief
- *
- * @copyright
- * Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne)
- * SPC (Swiss Plasma Center)
- *
- * futils 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.
- *
- * futils 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 General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see .
- *
- * @authors
- * (in alphabetical order)
- * @author Emmanuel Lanti
- * @author Nicolas Richart
- * @author Trach-Minh Tran
- */
+#
+# @file CMakeLists.txt
+#
+# @brief
+#
+# @copyright
+# Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne)
+# SPC (Swiss Plasma Center)
+#
+# futils 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.
+#
+# futils 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 General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see .
+#
+# @authors
+# (in alphabetical order)
+# @author Emmanuel Lanti
+# @author Nicolas Richart
+# @author Trach-Minh Tran
+#
set(SRCS
futils.f90
buffer.f90
cutils.c
)
add_library(futils ${SRCS})
set_property(TARGET futils
PROPERTY PUBLIC_HEADER ${CMAKE_CURRENT_BINARY_DIR}/futils.mod)
# MPI dependency
find_package(MPI COMPONENTS Fortran)
target_compile_options(futils PUBLIC ${MPI_Fortran_COMPILE_FLAGS})
target_link_libraries(futils
PUBLIC ${MPI_Fortran_LIBRARIES}
${HDF5_Fortran_LIBRARIES}
)
include(GNUInstallDirs)
target_include_directories(futils
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
${HDF5_Fortran_INCLUDE_DIRS}
${HDF5_Fortran_INCLUDE_DIR} # For backward compatibility with older versions of cmake
${MPI_Fortran_INCLUDE_PATH}
INTERFACE $
$
${HDF5_Fortran_INCLUDE_DIRS}
${HDF5_Fortran_INCLUDE_DIR}
${MPI_Fortran_INCLUDE_PATH}
)
install(TARGETS futils
EXPORT ${FUTILS_EXPORT_TARGETS}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
export(TARGETS futils
FILE "${CMAKE_BINARY_DIR}/futilsLibraryDepends.cmake")
export(PACKAGE futils)
if(FUTILS_EXPORT_TARGETS MATCHES "futils-targets")
install(EXPORT futils-targets
DESTINATION lib/cmake
)
endif()