Skip to content

Commit

Permalink
Apply to CMakeLists.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
francesco-ballarin committed Nov 27, 2023
1 parent aec9639 commit 0ab26a2
Show file tree
Hide file tree
Showing 15 changed files with 159 additions and 147 deletions.
52 changes: 28 additions & 24 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ cmake_minimum_required(VERSION 3.19)
project(DOLFINX VERSION "0.8.0.0")

set(DOXYGEN_DOLFINX_VERSION
${DOLFINX_VERSION}
CACHE STRING "Version for Doxygen" FORCE
${DOLFINX_VERSION}
CACHE STRING "Version for Doxygen" FORCE
)

# ------------------------------------------------------------------------------
Expand Down Expand Up @@ -56,7 +56,7 @@ add_feature_info(
)

option(DOLFINX_SKIP_BUILD_TESTS
"Skip build tests for testing usability of dependency packages." OFF
"Skip build tests for testing usability of dependency packages." OFF
)
add_feature_info(
DOLFINX_SKIP_BUILD_TESTS DOLFINX_SKIP_BUILD_TESTS
Expand All @@ -65,7 +65,7 @@ add_feature_info(

# Add shared library paths so shared libs in non-system paths are found
option(CMAKE_INSTALL_RPATH_USE_LINK_PATH
"Add paths to linker search and installed rpath." ON
"Add paths to linker search and installed rpath." ON
)
add_feature_info(
CMAKE_INSTALL_RPATH_USE_LINK_PATH CMAKE_INSTALL_RPATH_USE_LINK_PATH
Expand Down Expand Up @@ -104,11 +104,11 @@ find_package(MPI 3 REQUIRED)
# Default build type (can be overridden by user)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE
"RelWithDebInfo"
CACHE
STRING
"Choose the type of build, options are: Debug Developer MinSizeRel Release RelWithDebInfo."
FORCE
"RelWithDebInfo"
CACHE
STRING
"Choose the type of build, options are: Debug Developer MinSizeRel Release RelWithDebInfo."
FORCE
)
endif()

Expand Down Expand Up @@ -172,11 +172,11 @@ find_package(
# Check for Basix Note: Basix may be installed as a standalone C++ library, or
# in the Basix Python module tree
if(Python3_Interpreter_FOUND)
MESSAGE(STATUS "Checking for basix hints with ${Python3_EXECUTABLE}")
message(STATUS "Checking for basix hints with ${Python3_EXECUTABLE}")
execute_process(
COMMAND
${Python3_EXECUTABLE} -c
"import basix, os, sys; sys.stdout.write(os.path.dirname(basix.__file__))"
${Python3_EXECUTABLE} -c
"import basix, os, sys; sys.stdout.write(os.path.dirname(basix.__file__))"
OUTPUT_VARIABLE BASIX_PY_DIR
RESULT_VARIABLE BASIX_PY_COMMAND_RESULT
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
Expand All @@ -203,7 +203,7 @@ set_package_properties(
# Check for PETSc
find_package(PkgConfig REQUIRED)
set(ENV{PKG_CONFIG_PATH}
"$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib/pkgconfig:$ENV{PETSC_DIR}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}"
"$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib/pkgconfig:$ENV{PETSC_DIR}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}"
)
pkg_search_module(PETSC REQUIRED IMPORTED_TARGET PETSc>=3.15 petsc>=3.15)

Expand All @@ -215,7 +215,9 @@ check_symbol_exists(PETSC_USE_COMPLEX petscsystypes.h HAVE_PETSC_SCALAR_COMPLEX)

# Setting for FeatureSummary
if(PETSC_FOUND)
message(STATUS "Found PETSc version ${PETSC_VERSION}, prefix: ${PETSC_PREFIX}")
message(
STATUS "Found PETSc version ${PETSC_VERSION}, prefix: ${PETSC_PREFIX}"
)
set_property(GLOBAL APPEND PROPERTY PACKAGES_FOUND PETSc)
else()
set_property(GLOBAL APPEND PROPERTY PACKAGES_NOT_FOUND PETSc)
Expand All @@ -237,7 +239,7 @@ find_package(HDF5 REQUIRED COMPONENTS C)
if(NOT HDF5_IS_PARALLEL)
message(
FATAL_ERROR
"Found serial HDF5 build, MPI HDF5 build required, try setting HDF5_DIR or HDF5_ROOT"
"Found serial HDF5 build, MPI HDF5 build required, try setting HDF5_DIR or HDF5_ROOT"
)
endif()

Expand Down Expand Up @@ -287,19 +289,21 @@ set_package_properties(
if(DOLFINX_ENABLE_SLEPC)
find_package(PkgConfig REQUIRED)
set(ENV{PKG_CONFIG_PATH}
"$ENV{SLEPC_DIR}/$ENV{PETSC_ARCH}/lib/pkgconfig:$ENV{SLEPC_DIR}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}"
"$ENV{SLEPC_DIR}/$ENV{PETSC_ARCH}/lib/pkgconfig:$ENV{SLEPC_DIR}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}"
)
set(ENV{PKG_CONFIG_PATH}
"$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib/pkgconfig:$ENV{PETSC_DIR}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}"
"$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib/pkgconfig:$ENV{PETSC_DIR}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}"
)
set(ENV{PKG_CONFIG_PATH}
"$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}:$ENV{PETSC_DIR}:$ENV{PKG_CONFIG_PATH}"
"$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}:$ENV{PETSC_DIR}:$ENV{PKG_CONFIG_PATH}"
)
pkg_search_module(SLEPC IMPORTED_TARGET slepc>=3.15)

# Setting for FeatureSummary
if(SLEPC_FOUND)
message(STATUS "Found SLEPc version ${SLEPC_VERSION}, prefix: ${SLEPC_PREFIX}")
message(
STATUS "Found SLEPc version ${SLEPC_VERSION}, prefix: ${SLEPC_PREFIX}"
)
set_property(GLOBAL APPEND PROPERTY PACKAGES_FOUND SLEPc)
else()
set_property(GLOBAL APPEND PROPERTY PACKAGES_NOT_FOUND SLEPc)
Expand All @@ -322,7 +326,7 @@ set_package_properties(
SCOTCH PROPERTIES
TYPE OPTIONAL
DESCRIPTION
"Programs and libraries for graph, mesh and hypergraph partitioning"
"Programs and libraries for graph, mesh and hypergraph partitioning"
URL "https://www.labri.fr/perso/pelegrin/scotch"
PURPOSE "Parallel graph partitioning"
)
Expand Down Expand Up @@ -353,12 +357,12 @@ set_package_properties(

# Check that at least one graph partitioner has been found
if(NOT SCOTCH_FOUND
AND NOT PARMETIS_FOUND
AND NOT KAHIP_FOUND
AND NOT PARMETIS_FOUND
AND NOT KAHIP_FOUND
)
message(
FATAL_ERROR
"No graph partitioner found. SCOTCH, ParMETIS or KaHIP is required."
"No graph partitioner found. SCOTCH, ParMETIS or KaHIP is required."
)
endif()

Expand Down Expand Up @@ -417,7 +421,7 @@ configure_file(

add_custom_target(
uninstall "${CMAKE_COMMAND}" -P
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
)

# ------------------------------------------------------------------------------
Expand Down
6 changes: 4 additions & 2 deletions cpp/demo/hyperelasticity/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ endif()
include(CheckSymbolExists)
set(CMAKE_REQUIRED_INCLUDES ${PETSC_INCLUDE_DIRS})
check_symbol_exists(PETSC_USE_COMPLEX petscsystypes.h PETSC_SCALAR_COMPLEX)
if (PETSC_SCALAR_COMPLEX EQUAL 1)
if(PETSC_SCALAR_COMPLEX EQUAL 1)
message(STATUS "** This demo does not support complex mode")
else()
check_symbol_exists(PETSC_USE_REAL_DOUBLE petscsystypes.h PETSC_REAL_DOUBLE)
Expand All @@ -40,7 +40,9 @@ else()

set(CMAKE_INCLUDE_CURRENT_DIR ON)

add_executable(${PROJECT_NAME} main.cpp ${CMAKE_CURRENT_BINARY_DIR}/hyperelasticity.c)
add_executable(
${PROJECT_NAME} main.cpp ${CMAKE_CURRENT_BINARY_DIR}/hyperelasticity.c
)
target_link_libraries(${PROJECT_NAME} dolfinx)

# Do not throw error for 'multi-line comments' (these are typical in rst which
Expand Down
2 changes: 1 addition & 1 deletion cpp/demo/interpolation-io/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file was generated by running
#
# python cmake/scripts/generate-cmakefiles from dolfinx/cpp
# python cmake/scripts/generate-cmakefiles.py from dolfinx/cpp
#
cmake_minimum_required(VERSION 3.19)

Expand Down
2 changes: 1 addition & 1 deletion cpp/demo/interpolation_different_meshes/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file was generated by running
#
# python cmake/scripts/generate-cmakefiles from dolfinx/cpp
# python cmake/scripts/generate-cmakefiles.py from dolfinx/cpp
#
cmake_minimum_required(VERSION 3.19)

Expand Down
2 changes: 1 addition & 1 deletion cpp/demo/mixed_topology/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file was generated by running
#
# python cmake/scripts/generate-cmakefiles from dolfinx/cpp
# python cmake/scripts/generate-cmakefiles.py from dolfinx/cpp
#
cmake_minimum_required(VERSION 3.19)

Expand Down
4 changes: 1 addition & 3 deletions cpp/demo/poisson/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ add_custom_command(

set(CMAKE_INCLUDE_CURRENT_DIR ON)

add_executable(
${PROJECT_NAME} main.cpp ${CMAKE_CURRENT_BINARY_DIR}/poisson.c
)
add_executable(${PROJECT_NAME} main.cpp ${CMAKE_CURRENT_BINARY_DIR}/poisson.c)
target_link_libraries(${PROJECT_NAME} dolfinx)

# Do not throw error for 'multi-line comments' (these are typical in rst which
Expand Down
4 changes: 1 addition & 3 deletions cpp/demo/poisson_matrix_free/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ add_custom_command(

set(CMAKE_INCLUDE_CURRENT_DIR ON)

add_executable(
${PROJECT_NAME} main.cpp ${CMAKE_CURRENT_BINARY_DIR}/poisson.c
)
add_executable(${PROJECT_NAME} main.cpp ${CMAKE_CURRENT_BINARY_DIR}/poisson.c)
target_link_libraries(${PROJECT_NAME} dolfinx)

# Do not throw error for 'multi-line comments' (these are typical in rst which
Expand Down
54 changes: 27 additions & 27 deletions cpp/dolfinx/common/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
set(HEADERS_common
${CMAKE_CURRENT_SOURCE_DIR}/defines.h
${CMAKE_CURRENT_SOURCE_DIR}/dolfinx_common.h
${CMAKE_CURRENT_SOURCE_DIR}/dolfinx_doc.h
${CMAKE_CURRENT_SOURCE_DIR}/IndexMap.h
${CMAKE_CURRENT_SOURCE_DIR}/log.h
${CMAKE_CURRENT_SOURCE_DIR}/loguru.hpp
${CMAKE_CURRENT_SOURCE_DIR}/sort.h
${CMAKE_CURRENT_SOURCE_DIR}/types.h
${CMAKE_CURRENT_SOURCE_DIR}/math.h
${CMAKE_CURRENT_SOURCE_DIR}/MPI.h
${CMAKE_CURRENT_SOURCE_DIR}/Scatterer.h
${CMAKE_CURRENT_SOURCE_DIR}/Table.h
${CMAKE_CURRENT_SOURCE_DIR}/Timer.h
${CMAKE_CURRENT_SOURCE_DIR}/TimeLogger.h
${CMAKE_CURRENT_SOURCE_DIR}/TimeLogManager.h
${CMAKE_CURRENT_SOURCE_DIR}/timing.h
${CMAKE_CURRENT_SOURCE_DIR}/utils.h
PARENT_SCOPE
${CMAKE_CURRENT_SOURCE_DIR}/defines.h
${CMAKE_CURRENT_SOURCE_DIR}/dolfinx_common.h
${CMAKE_CURRENT_SOURCE_DIR}/dolfinx_doc.h
${CMAKE_CURRENT_SOURCE_DIR}/IndexMap.h
${CMAKE_CURRENT_SOURCE_DIR}/log.h
${CMAKE_CURRENT_SOURCE_DIR}/loguru.hpp
${CMAKE_CURRENT_SOURCE_DIR}/sort.h
${CMAKE_CURRENT_SOURCE_DIR}/types.h
${CMAKE_CURRENT_SOURCE_DIR}/math.h
${CMAKE_CURRENT_SOURCE_DIR}/MPI.h
${CMAKE_CURRENT_SOURCE_DIR}/Scatterer.h
${CMAKE_CURRENT_SOURCE_DIR}/Table.h
${CMAKE_CURRENT_SOURCE_DIR}/Timer.h
${CMAKE_CURRENT_SOURCE_DIR}/TimeLogger.h
${CMAKE_CURRENT_SOURCE_DIR}/TimeLogManager.h
${CMAKE_CURRENT_SOURCE_DIR}/timing.h
${CMAKE_CURRENT_SOURCE_DIR}/utils.h
PARENT_SCOPE
)

target_sources(
dolfinx
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/defines.cpp
${CMAKE_CURRENT_SOURCE_DIR}/IndexMap.cpp
${CMAKE_CURRENT_SOURCE_DIR}/log.cpp
${CMAKE_CURRENT_SOURCE_DIR}/MPI.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Table.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Timer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/TimeLogger.cpp
${CMAKE_CURRENT_SOURCE_DIR}/TimeLogManager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/timing.cpp
)
${CMAKE_CURRENT_SOURCE_DIR}/IndexMap.cpp
${CMAKE_CURRENT_SOURCE_DIR}/log.cpp
${CMAKE_CURRENT_SOURCE_DIR}/MPI.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Table.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Timer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/TimeLogger.cpp
${CMAKE_CURRENT_SOURCE_DIR}/TimeLogManager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/timing.cpp
)
60 changes: 30 additions & 30 deletions cpp/dolfinx/fem/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
set(HEADERS_fem
${CMAKE_CURRENT_SOURCE_DIR}/Constant.h
${CMAKE_CURRENT_SOURCE_DIR}/CoordinateElement.h
${CMAKE_CURRENT_SOURCE_DIR}/DirichletBC.h
${CMAKE_CURRENT_SOURCE_DIR}/DofMap.h
${CMAKE_CURRENT_SOURCE_DIR}/ElementDofLayout.h
${CMAKE_CURRENT_SOURCE_DIR}/Expression.h
${CMAKE_CURRENT_SOURCE_DIR}/FiniteElement.h
${CMAKE_CURRENT_SOURCE_DIR}/Form.h
${CMAKE_CURRENT_SOURCE_DIR}/Function.h
${CMAKE_CURRENT_SOURCE_DIR}/FunctionSpace.h
${CMAKE_CURRENT_SOURCE_DIR}/assembler.h
${CMAKE_CURRENT_SOURCE_DIR}/assemble_matrix_impl.h
${CMAKE_CURRENT_SOURCE_DIR}/assemble_scalar_impl.h
${CMAKE_CURRENT_SOURCE_DIR}/assemble_vector_impl.h
${CMAKE_CURRENT_SOURCE_DIR}/discreteoperators.h
${CMAKE_CURRENT_SOURCE_DIR}/dofmapbuilder.h
${CMAKE_CURRENT_SOURCE_DIR}/dolfinx_fem.h
${CMAKE_CURRENT_SOURCE_DIR}/interpolate.h
${CMAKE_CURRENT_SOURCE_DIR}/petsc.h
${CMAKE_CURRENT_SOURCE_DIR}/sparsitybuild.h
${CMAKE_CURRENT_SOURCE_DIR}/utils.h
PARENT_SCOPE
${CMAKE_CURRENT_SOURCE_DIR}/Constant.h
${CMAKE_CURRENT_SOURCE_DIR}/CoordinateElement.h
${CMAKE_CURRENT_SOURCE_DIR}/DirichletBC.h
${CMAKE_CURRENT_SOURCE_DIR}/DofMap.h
${CMAKE_CURRENT_SOURCE_DIR}/ElementDofLayout.h
${CMAKE_CURRENT_SOURCE_DIR}/Expression.h
${CMAKE_CURRENT_SOURCE_DIR}/FiniteElement.h
${CMAKE_CURRENT_SOURCE_DIR}/Form.h
${CMAKE_CURRENT_SOURCE_DIR}/Function.h
${CMAKE_CURRENT_SOURCE_DIR}/FunctionSpace.h
${CMAKE_CURRENT_SOURCE_DIR}/assembler.h
${CMAKE_CURRENT_SOURCE_DIR}/assemble_matrix_impl.h
${CMAKE_CURRENT_SOURCE_DIR}/assemble_scalar_impl.h
${CMAKE_CURRENT_SOURCE_DIR}/assemble_vector_impl.h
${CMAKE_CURRENT_SOURCE_DIR}/discreteoperators.h
${CMAKE_CURRENT_SOURCE_DIR}/dofmapbuilder.h
${CMAKE_CURRENT_SOURCE_DIR}/dolfinx_fem.h
${CMAKE_CURRENT_SOURCE_DIR}/interpolate.h
${CMAKE_CURRENT_SOURCE_DIR}/petsc.h
${CMAKE_CURRENT_SOURCE_DIR}/sparsitybuild.h
${CMAKE_CURRENT_SOURCE_DIR}/utils.h
PARENT_SCOPE
)

target_sources(
dolfinx
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/DirichletBC.cpp
${CMAKE_CURRENT_SOURCE_DIR}/CoordinateElement.cpp
${CMAKE_CURRENT_SOURCE_DIR}/DofMap.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ElementDofLayout.cpp
${CMAKE_CURRENT_SOURCE_DIR}/FiniteElement.cpp
${CMAKE_CURRENT_SOURCE_DIR}/dofmapbuilder.cpp
${CMAKE_CURRENT_SOURCE_DIR}/petsc.cpp
${CMAKE_CURRENT_SOURCE_DIR}/sparsitybuild.cpp
${CMAKE_CURRENT_SOURCE_DIR}/utils.cpp
${CMAKE_CURRENT_SOURCE_DIR}/CoordinateElement.cpp
${CMAKE_CURRENT_SOURCE_DIR}/DofMap.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ElementDofLayout.cpp
${CMAKE_CURRENT_SOURCE_DIR}/FiniteElement.cpp
${CMAKE_CURRENT_SOURCE_DIR}/dofmapbuilder.cpp
${CMAKE_CURRENT_SOURCE_DIR}/petsc.cpp
${CMAKE_CURRENT_SOURCE_DIR}/sparsitybuild.cpp
${CMAKE_CURRENT_SOURCE_DIR}/utils.cpp
)
11 changes: 5 additions & 6 deletions cpp/dolfinx/geometry/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
set(HEADERS_geometry
${CMAKE_CURRENT_SOURCE_DIR}/BoundingBoxTree.h
${CMAKE_CURRENT_SOURCE_DIR}/gjk.h
${CMAKE_CURRENT_SOURCE_DIR}/dolfinx_geometry.h
${CMAKE_CURRENT_SOURCE_DIR}/utils.h
PARENT_SCOPE
${CMAKE_CURRENT_SOURCE_DIR}/BoundingBoxTree.h
${CMAKE_CURRENT_SOURCE_DIR}/gjk.h
${CMAKE_CURRENT_SOURCE_DIR}/dolfinx_geometry.h
${CMAKE_CURRENT_SOURCE_DIR}/utils.h
PARENT_SCOPE
)

16 changes: 8 additions & 8 deletions cpp/dolfinx/graph/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
set(HEADERS_graph
${CMAKE_CURRENT_SOURCE_DIR}/AdjacencyList.h
${CMAKE_CURRENT_SOURCE_DIR}/dolfinx_graph.h
${CMAKE_CURRENT_SOURCE_DIR}/ordering.h
${CMAKE_CURRENT_SOURCE_DIR}/partitioners.h
${CMAKE_CURRENT_SOURCE_DIR}/partition.h
PARENT_SCOPE
${CMAKE_CURRENT_SOURCE_DIR}/AdjacencyList.h
${CMAKE_CURRENT_SOURCE_DIR}/dolfinx_graph.h
${CMAKE_CURRENT_SOURCE_DIR}/ordering.h
${CMAKE_CURRENT_SOURCE_DIR}/partitioners.h
${CMAKE_CURRENT_SOURCE_DIR}/partition.h
PARENT_SCOPE
)

target_sources(
dolfinx
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ordering.cpp
${CMAKE_CURRENT_SOURCE_DIR}/partitioners.cpp
${CMAKE_CURRENT_SOURCE_DIR}/partition.cpp
${CMAKE_CURRENT_SOURCE_DIR}/partitioners.cpp
${CMAKE_CURRENT_SOURCE_DIR}/partition.cpp
)
Loading

0 comments on commit 0ab26a2

Please sign in to comment.