Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
amdis
amdis-core
Commits
dc6aa48e
Commit
dc6aa48e
authored
Oct 03, 2020
by
Praetorius, Simon
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/modern_cmake' into 'master'
modern cmake See merge request
!213
parents
a2b0f4b5
9be9ae1d
Pipeline
#4955
passed with stage
in 54 minutes and 47 seconds
Changes
12
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
118 additions
and
65 deletions
+118
-65
CMakeLists.txt
CMakeLists.txt
+27
-4
amdis/CMakeLists.txt
amdis/CMakeLists.txt
+1
-1
amdis/Environment.hpp
amdis/Environment.hpp
+1
-1
amdis/common/CMakeLists.txt
amdis/common/CMakeLists.txt
+1
-2
amdis/io/CMakeLists.txt
amdis/io/CMakeLists.txt
+1
-2
amdis/linearalgebra/istl/CMakeLists.txt
amdis/linearalgebra/istl/CMakeLists.txt
+1
-2
amdis/linearalgebra/istl/precompiled/CMakeLists.txt
amdis/linearalgebra/istl/precompiled/CMakeLists.txt
+1
-2
cmake/modules/AmdisMacros.cmake
cmake/modules/AmdisMacros.cmake
+6
-17
cmake/modules/FindHYPRE.cmake
cmake/modules/FindHYPRE.cmake
+10
-17
cmake/modules/FindMTL.cmake
cmake/modules/FindMTL.cmake
+13
-13
cmake/pkg/amdis-config.cmake.in
cmake/pkg/amdis-config.cmake.in
+53
-0
libs/CMakeLists.txt
libs/CMakeLists.txt
+3
-4
No files found.
CMakeLists.txt
View file @
dc6aa48e
cmake_minimum_required
(
VERSION 3.1
)
cmake_minimum_required
(
VERSION 3.1
3
)
project
(
amdis LANGUAGES CXX VERSION 0.2
)
#find dune-common and set the module path
...
...
@@ -11,8 +11,9 @@ include(DuneMacros)
# start a dune project with information from dune.module
dune_project
()
dune_enable_all_packages
(
MODULE_LIBRARIES amdis fmt
)
dune_add_library
(
amdis
)
add_dune_all_flags
(
amdis
)
target_link_dune_default_libraries
(
amdis
)
add_subdirectory
(
"amdis"
)
add_subdirectory
(
"bin"
)
...
...
@@ -21,9 +22,30 @@ add_subdirectory("examples" EXCLUDE_FROM_ALL)
add_subdirectory
(
"libs"
)
add_subdirectory
(
"test"
)
target_link_libraries
(
amdis fmt
)
dune_
target_link_libraries
(
amdis fmt
)
target_compile_options
(
amdis PUBLIC
"-Wall"
"-Wpedantic"
)
if
(
MTL_FOUND
)
dune_target_link_libraries
(
amdis MTL::MTL
)
target_compile_definitions
(
amdis PUBLIC ENABLE_MTL
)
endif
(
MTL_FOUND
)
if
(
HYPRE_FOUND
)
dune_target_link_libraries
(
amdis HYPRE::HYPRE
)
target_compile_definitions
(
amdis PUBLIC ENABLE_HYPRE
)
endif
(
HYPRE_FOUND
)
if
(
EIGEN3_FOUND
)
dune_target_link_libraries
(
amdis Eigen3::Eigen
)
target_compile_definitions
(
amdis PUBLIC ENABLE_EIGEN
)
endif
(
EIGEN3_FOUND
)
if
(
PETSc_FOUND
)
dune_target_link_libraries
(
amdis PETSc::PETSc
)
target_compile_definitions
(
amdis PUBLIC ENABLE_PETSC
)
endif
(
PETSc_FOUND
)
option
(
ENABLE_ALL_WARNINGS
"enable all meaningful warnings"
OFF
)
if
(
ENABLE_ALL_WARNINGS
)
target_compile_options
(
amdis PUBLIC
"-Wextra"
"-Wnon-virtual-dtor"
...
...
@@ -31,5 +53,6 @@ if (ENABLE_ALL_WARNINGS)
"-Woverloaded-virtual"
"-Wconversion"
)
endif
(
ENABLE_ALL_WARNINGS
)
# finalize the dune project, e.g. generating config.h etc.
finalize_dune_project
(
GENERATE_CONFIG_H_CMAKE
)
amdis/CMakeLists.txt
View file @
dc6aa48e
#install headers
dune_library_add
_sources
(
amdis
SOURCES
target
_sources
(
amdis
PRIVATE
AdaptInfo.cpp
AdaptInstationary.cpp
AdaptStationary.cpp
...
...
amdis/Environment.hpp
View file @
dc6aa48e
...
...
@@ -10,7 +10,7 @@ namespace AMDiS
{
/// Establishes an environment for sequential and parallel AMDiS programs
/**
* This object initializes the MPI environ
e
ment, parses initfiles and may
* This object initializes the MPI environment, parses initfiles and may
* initialize other external libraries. It is constructed with the program
* commandline arguments. In its destruction, the MPI environment is finalized.
* In the vast majority of AMDiS programs, an instance of Environment should
...
...
amdis/common/CMakeLists.txt
View file @
dc6aa48e
dune_library_add_sources
(
amdis
SOURCES
target_sources
(
amdis PRIVATE
Filesystem.cpp
String.cpp
)
...
...
amdis/io/CMakeLists.txt
View file @
dc6aa48e
dune_library_add_sources
(
amdis
SOURCES
target_sources
(
amdis PRIVATE
FileWriterBase.cpp
)
...
...
amdis/linearalgebra/istl/CMakeLists.txt
View file @
dc6aa48e
dune_library_add_sources
(
amdis
SOURCES
target_sources
(
amdis PRIVATE
PreconCreator.cpp
SolverCreator.cpp
)
...
...
amdis/linearalgebra/istl/precompiled/CMakeLists.txt
View file @
dc6aa48e
dune_library_add_sources
(
amdis
SOURCES
target_sources
(
amdis PRIVATE
Preconditioners.cpp
Solvers.cpp
)
...
...
cmake/modules/AmdisMacros.cmake
View file @
dc6aa48e
...
...
@@ -24,27 +24,19 @@ endif (NOT BACKEND)
if
(
BACKEND STREQUAL
"MTL"
OR BACKEND STREQUAL
"MTL4"
)
find_package
(
MTL REQUIRED
)
set
(
AMDIS_HAS_MTL TRUE
)
message
(
STATUS
" Found MTL, version:
${
MTL_VERSION
}
"
)
dune_register_package_flags
(
LIBRARIES MTL::MTL COMPILE_DEFINITIONS
"ENABLE_MTL=1"
)
find_package
(
HYPRE
)
if
(
HYPRE_FOUND
)
set
(
AMDIS_HAS_HYPRE TRUE
)
dune_register_package_flags
(
LIBRARIES HYPRE::HYPRE COMPILE_DEFINITIONS
"ENABLE_HYPRE=1"
)
endif
(
HYPRE_FOUND
)
set
(
AMDIS_HAS_HYPRE
${
HYPRE_FOUND
}
)
elseif
(
BACKEND STREQUAL
"EIGEN"
OR BACKEND STREQUAL
"EIGEN3"
)
find_package
(
Eigen3 REQUIRED 3.3.5
)
set
(
AMDIS_HAS_EIGEN TRUE
)
if
(
EIGEN3_FOUND
)
message
(
STATUS
" Found Eigen3, version:
${
Eigen3_VERSION
}
"
)
dune_register_package_flags
(
LIBRARIES Eigen3::Eigen COMPILE_DEFINITIONS
"ENABLE_EIGEN=1"
)
endif
(
EIGEN3_FOUND
)
message
(
STATUS
" Found Eigen3, version:
${
Eigen3_VERSION
}
"
)
elseif
(
BACKEND STREQUAL
"PETSC"
)
find_package
(
PETSc REQUIRED
)
if
(
PETSc_FOUND
)
set
(
AMDIS_HAS_PETSC TRUE
)
dune_register_package_flags
(
LIBRARIES PETSc::PETSc COMPILE_DEFINITIONS
"ENABLE_PETSC=1"
)
endif
(
PETSc_FOUND
)
set
(
AMDIS_HAS_PETSC TRUE
)
elseif
(
BACKEND STREQUAL
"ISTL"
)
if
(
NOT dune-istl_FOUND
)
message
(
FATAL_ERROR
"Need dune-istl, MTL, PETSc, or Eigen3 as linear algebra backend. Change flag BACKEND!"
)
...
...
@@ -52,6 +44,3 @@ elseif (BACKEND STREQUAL "ISTL")
else
()
message
(
FATAL_ERROR
"BACKEND must be one of MTL, EIGEN, PETSC, ISTL"
)
endif
()
set
(
DUNE_CUSTOM_PKG_CONFIG_SECTION
"set(BACKEND
\"
${
BACKEND
}
\"
)"
)
\ No newline at end of file
cmake/modules/FindHYPRE.cmake
View file @
dc6aa48e
...
...
@@ -15,31 +15,21 @@
# Author: Simon Praetorius <simon.praetorius@tu-dresden.de>
mark_as_advanced
(
HYPRE_FOUND HYPRE_INCLUDE_DIR HYPRE_LIBRARIES
)
find_path
(
HYPRE_INCLUDE_DIR HYPRE.h
PATHS
/opt/software/hypre
${
HYPRE_DIR
}
${
HYPRE_ROOT
}
ENV HYPRE_DIR ENV HYPRE_ROOT
/opt/software
${
HYPRE_DIR
}
ENV HYPRE_DIR
ENV EBROOTHYPRE
PATH_SUFFIXES
hypre include include/hypre
NO_DEFAULT_PATH
)
find_path
(
HYPRE_INCLUDE_DIR HYPRE.h
PATH_SUFFIXES hypre include include/hypre
)
hypre
)
find_library
(
HYPRE_LIBRARY HYPRE
PATHS
/opt/software/hypre
${
HYPRE_DIR
}
${
HYPRE_ROOT
}
ENV HYPRE_DIR ENV HYPRE_ROOT
/opt/software
${
HYPRE_DIR
}
ENV HYPRE_DIR
ENV EBROOTHYPRE
PATH_SUFFIXES
lib
NO_DEFAULT_PATH
)
find_library
(
HYPRE_LIBRARY HYPRE
PATH_SUFFIXES lib
)
hypre
)
if
(
HYPRE_LIBRARY
)
set
(
HYPRE_LIBRARIES
${
HYPRE_LIBRARY
}
)
...
...
@@ -56,9 +46,12 @@ if (HYPRE_LIBRARY)
endforeach
()
endif
(
HYPRE_LIBRARY
)
mark_as_advanced
(
HYPRE_FOUND HYPRE_INCLUDE_DIR HYPRE_LIBRARIES
)
include
(
FindPackageHandleStandardArgs
)
find_package_handle_standard_args
(
HYPRE
REQUIRED_VARS HYPRE_INCLUDE_DIR HYPRE_LIBRARIES
REQUIRED_VARS
HYPRE_INCLUDE_DIR HYPRE_LIBRARIES
)
# text for feature summary
...
...
cmake/modules/FindMTL.cmake
View file @
dc6aa48e
...
...
@@ -15,18 +15,16 @@
# Author: Simon Praetorius <simon.praetorius@tu-dresden.de>
mark_as_advanced
(
MTL_FOUND
MTL_COMPILE_DEFINITIONS MTL_INCLUDE_DIR
)
mark_as_advanced
(
MTL_COMPILE_DEFINITIONS MTL_INCLUDE_DIR
)
find_path
(
MTL_INCLUDE_DIR boost/numeric/mtl/mtl.hpp
PATHS
/opt/software/mtl
/opt/sources/mtl
/opt/development/mtl
${
MTL_DIR
}
${
MTL_ROOT
}
ENV MTL_DIR ENV MTL_ROOT
HINTS
/opt/software
/opt/sources
/opt/development
ENV EBROOTMTL
PATH_SUFFIXES
include
mtl mtl4
)
set
(
MTL_COMPILE_DEFINITIONS MTL_ASSERT_FOR_THROW=1
)
...
...
@@ -46,15 +44,17 @@ set_package_properties("MTL" PROPERTIES
if
(
MTL_FOUND AND NOT TARGET MTL::MTL
)
add_library
(
MTL::MTL INTERFACE IMPORTED
)
find_package
(
SuiteSparse
QUIET
)
if
(
SuiteSparse_FOUND
)
find_package
(
SuiteSparse
COMPONENTS UMFPACK
)
if
(
SuiteSparse_
UMFPACK_
FOUND
)
list
(
APPEND MTL_COMPILE_DEFINITIONS
"MTL_HAS_UMFPACK"
)
endif
(
SuiteSparse_FOUND
)
target_link_libraries
(
MTL::MTL INTERFACE SuiteSparse::UMFPACK
)
endif
()
find_package
(
HYPRE
QUIET
)
find_package
(
HYPRE
)
if
(
HYPRE_FOUND
)
list
(
APPEND MTL_COMPILE_DEFINITIONS
"MTL_HAS_HYPRE"
)
endif
(
HYPRE_FOUND
)
target_link_libraries
(
MTL::MTL INTERFACE HYPRE::HYPRE
)
endif
()
set_target_properties
(
MTL::MTL PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES
"
${
MTL_INCLUDE_DIR
}
"
...
...
cmake/pkg/amdis-config.cmake.in
0 → 100644
View file @
dc6aa48e
if (NOT amdis_FOUND)
# Whether this module is installed or not
set(amdis_INSTALLED @MODULE_INSTALLED@)
# Settings specific to the module
@amdis_INIT@
@PACKAGE_INIT@
#report other information
set_and_check(amdis_PREFIX "${PACKAGE_PREFIX_DIR}")
set_and_check(amdis_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")
set(amdis_CXX_FLAGS "@CMAKE_CXX_FLAGS@")
set(amdis_CXX_FLAGS_DEBUG "@CMAKE_CXX_FLAGS_DEBUG@")
set(amdis_CXX_FLAGS_MINSIZEREL "@CMAKE_CXX_FLAGS_MINSIZEREL@")
set(amdis_CXX_FLAGS_RELEASE "@CMAKE_CXX_FLAGS_RELEASE@")
set(amdis_CXX_FLAGS_RELWITHDEBINFO "@CMAKE_CXX_FLAGS_RELWITHDEBINFO@")
set(amdis_LIBRARIES "@DUNE_MODULE_LIBRARIES@")
set(amdis_DEPENDS "@amdis_DEPENDS@")
set(amdis_SUGGESTS "@amdis_SUGGESTS@")
set_and_check(amdis_MODULE_PATH "@PACKAGE_DUNE_INSTALL_MODULEDIR@")
list(APPEND CMAKE_MODULE_PATH ${dune-common_MODULE_PATH})
list(APPEND CMAKE_MODULE_PATH ${amdis_MODULE_PATH})
# import the target
if (amdis_LIBRARIES)
get_filename_component(_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
include("${_dir}/amdis-targets.cmake")
endif ()
set(BACKEND @BACKEND@)
include(CMakeFindDependencyMacro)
if (@MTL_FOUND@)
set(MTL_INCLUDE_DIR @MTL_INCLUDE_DIR@ CACHE PATH "")
find_dependency(MTL)
endif ()
if (@HYPRE_FOUND@)
set(HYPRE_INCLUDE_DIR @HYPRE_INCLUDE_DIR@ CACHE PATH "")
set(HYPRE_LIBRARY @HYPRE_LIBRARY@ CACHE FILEPATH "")
find_dependency(HYPRE)
endif ()
if (@Eigen3_FOUND@)
find_dependency(Eigen3 @Eigen3_VERSION@)
endif ()
if (@PETSc_FOUND@)
find_dependency(PETSc)
endif ()
endif (NOT amdis_FOUND)
libs/CMakeLists.txt
View file @
dc6aa48e
...
...
@@ -16,12 +16,11 @@ if (NOT EXISTS "${PROJECT_SOURCE_DIR}/libs/fmt/CMakeLists.txt")
message
(
FATAL_ERROR
"The submodules were not downloaded! GIT_SUBMODULE was turned off or failed. Please update submodules and try again."
)
endif
()
dune_library_add_sources
(
fmt SOURCES
dune_add_library
(
fmt SOURCES
fmt/src/format.cc
fmt/src/posix.cc
)
target_compile_features
(
fmt PRIVATE cxx_std_17
)
target_include_directories
(
fmt PUBLIC
$<BUILD_INTERFACE:
${
CMAKE_SOURCE_DIR
}
/libs/fmt/include>
)
...
...
@@ -34,4 +33,4 @@ install(FILES
fmt/include/fmt/printf.h
fmt/include/fmt/ranges.h
fmt/include/fmt/time.h
DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
/fmt
)
\ No newline at end of file
DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
/fmt
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment