Skip to content

Commit

Permalink
CMake: implement ENABLE_FORTRAN (BL_NO_FORT) option
Browse files Browse the repository at this point in the history
  • Loading branch information
mic84 committed Apr 9, 2020
1 parent 206a3c9 commit effc622
Show file tree
Hide file tree
Showing 10 changed files with 263 additions and 183 deletions.
10 changes: 8 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ project( AMReX
DESCRIPTION "A software framework for massively parallel, block-structured adaptive mesh refinement (AMR) applications"
VERSION ${AMREX_PKG_VERSION}
HOMEPAGE_URL "https://amrex-codes.github.io/amrex/"
LANGUAGES C CXX Fortran
LANGUAGES C CXX
)

message(STATUS "CMake version: ${CMAKE_VERSION}")
Expand All @@ -81,6 +81,13 @@ include( AMReX_Utils )
include( AMReX_Options )
include( AMReX_Machines )

#
# Enable Fortran if requested
#
if(ENABLE_FORTRAN)
enable_language(Fortran)
endif ()

#
# Enable CUDA if requested
#
Expand All @@ -94,7 +101,6 @@ endif ()
#
set_default_config_flags ()


#
# Source files for all binaries and libraries found under src
#
Expand Down
2 changes: 2 additions & 0 deletions Docs/sphinx_documentation/source/BuildingAMReX.rst
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,8 @@ below.
+------------------------------+-------------------------------------------------+-------------+-----------------+
| USE_XSDK_DEFAULTS | Use XSDK defaults settings | NO | YES, NO |
+------------------------------+-------------------------------------------------+-------------+-----------------+
| ENABLE_FORTRAN | Enable Fortran language | YES | YES, NO |
+------------------------------+-------------------------------------------------+-------------+-----------------+
| ENABLE_DP | Build with double-precision reals | YES | YES, NO |
+------------------------------+-------------------------------------------------+-------------+-----------------+
| ENABLE_PIC | Build Position Independent Code | NO | YES, NO |
Expand Down
14 changes: 10 additions & 4 deletions Src/Amr/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
target_include_directories(amrex PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>)

target_sources(amrex
PRIVATE
PRIVATE
AMReX_LevelBld.H
AMReX_Amr.H
AMReX_AmrLevel.H
Expand All @@ -14,8 +14,14 @@ target_sources(amrex
AMReX_PROB_AMR_F.H
AMReX_StateDescriptor.H
AMReX_AuxBoundaryData.H
AMReX_Extrapolater.H
AMReX_StateDescriptor.cpp
AMReX_AuxBoundaryData.cpp
AMReX_Extrapolater.cpp
AMReX_extrapolater_${DIM}d.f90 )
)

if (ENABLE_FORTRAN)
target_sources(amrex
PRIVATE
AMReX_Extrapolater.H
AMReX_Extrapolater.cpp
AMReX_extrapolater_${DIM}d.f90 )
endif ()
24 changes: 15 additions & 9 deletions Src/AmrCore/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
target_include_directories(amrex PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>)

target_sources(amrex
PRIVATE
PRIVATE
AMReX_AmrCore.cpp
AMReX_Cluster.cpp
AMReX_ErrorList.cpp
AMReX_ErrorList.cpp
AMReX_AmrCore.H
AMReX_Cluster.H
AMReX_ErrorList.H
Expand All @@ -18,18 +18,24 @@ target_sources(amrex
AMReX_AmrMesh.cpp
AMReX_Interpolater.H
AMReX_TagBox.H
AMReX_AmrMesh.H
AMReX_AmrMesh.H
AMReX_FluxReg_${DIM}D_C.H
AMReX_FluxReg_C.H
AMReX_FLUXREG_nd.F90
AMReX_INTERP_${DIM}D.F90
AMReX_FLUXREG_F.H
AMReX_INTERP_F.H
AMReX_Interp_C.H
AMReX_Interp_${DIM}D_C.H
AMReX_FillPatchUtil_${DIM}d.F90
AMReX_FillPatchUtil_F.H )
)

if (ENABLE_FORTRAN)
target_sources(amrex
PRIVATE
AMReX_FillPatchUtil_F.H
AMReX_FillPatchUtil_${DIM}d.F90
AMReX_FLUXREG_F.H
AMReX_FLUXREG_nd.F90
AMReX_INTERP_F.H
AMReX_INTERP_${DIM}D.F90
)
endif ()

# These files are neeeded only if Particles are enabled
if ( ENABLE_PARTICLES )
Expand Down
125 changes: 75 additions & 50 deletions Src/Base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if (ENABLE_MPI)
# Make imported target "global" so that it can be seen
# from other directories in the project.
# This is especially useful when get_target_properties_flattened()
# (see module AMReXTargetHelpers.cmake) is called to recover dependecy tree info
# (see module AMReXTargetHelpers.cmake) is called to recover dependecy tree info
# in projects that use amrex directly in the build (via add_subdirectory()).
# Without this, get_target_properties_flattened() would not recognize
# MPI::MPI_C and MPI::MPI_CXX as targets because they would be visibile only in this
Expand All @@ -20,15 +20,15 @@ if (ENABLE_MPI)
target_link_libraries(amrex PUBLIC MPI::MPI_C MPI::MPI_CXX)
endif ()

# We need threads
# We need threads
set( THREADS_PREFER_PTHREAD_FLAG on)
find_package(Threads REQUIRED)
set_target_properties( Threads::Threads PROPERTIES IMPORTED_GLOBAL True )
target_link_libraries(amrex PUBLIC Threads::Threads)


target_sources( amrex
PRIVATE
PRIVATE
# Utility classes ---------------------------------------------------------
AMReX_ccse-mpi.H
AMReX_Math.H
Expand Down Expand Up @@ -75,7 +75,7 @@ target_sources( amrex
AMReX_ParallelContext.H
AMReX_ParallelContext.cpp
AMReX_VisMF.H
AMReX_VisMF.cpp
AMReX_VisMF.cpp
AMReX_Arena.H
AMReX_Arena.cpp
AMReX_BArena.H
Expand All @@ -90,12 +90,12 @@ target_sources( amrex
AMReX_BLBackTrace.H
AMReX_BLFort.H
AMReX_NFiles.H
AMReX_NFiles.cpp
AMReX_NFiles.cpp
AMReX_parstream.H
AMReX_parstream.cpp
# I/O stuff --------------------------------------------------------------
AMReX_FabConv.H
AMReX_FabConv.cpp
AMReX_FabConv.H
AMReX_FabConv.cpp
AMReX_FPC.H
AMReX_FPC.cpp
AMReX_VectorIO.H
Expand All @@ -106,17 +106,17 @@ target_sources( amrex
# Index space -------------------------------------------------------------
AMReX_Box.H
AMReX_Box.cpp
AMReX_BoxIterator.H
AMReX_BoxIterator.H
AMReX_BoxIterator.cpp
AMReX_Dim3.H
AMReX_IntVect.H
AMReX_IntVect.cpp
AMReX_IndexType.H
AMReX_IndexType.cpp
AMReX_Loop.H
AMReX_Orientation.H
AMReX_Orientation.H
AMReX_Orientation.cpp
AMReX_Periodicity.H
AMReX_Periodicity.H
AMReX_Periodicity.cpp
# Real space --------------------------------------------------------------
AMReX_RealBox.H
Expand All @@ -125,16 +125,16 @@ target_sources( amrex
AMReX_RealVect.cpp
# Unions of rectangle -----------------------------------------------------
AMReX_BoxList.H
AMReX_BoxList.cpp
AMReX_BoxArray.H
AMReX_BoxList.cpp
AMReX_BoxArray.H
AMReX_BoxArray.cpp
AMReX_BoxDomain.H
AMReX_BoxDomain.cpp
# Fortran array data ------------------------------------------------------
AMReX_FArrayBox.H
AMReX_FArrayBox.cpp
AMReX_IArrayBox.H
AMReX_IArrayBox.cpp
AMReX_IArrayBox.cpp
AMReX_BaseFab.H
AMReX_BaseFab.cpp
AMReX_Array4.H
Expand All @@ -143,14 +143,14 @@ target_sources( amrex
AMReX_FabFactory.H
AMReX_BaseFabUtility.H
# Fortran data defined on unions of rectangles ----------------------------
AMReX_MultiFab.cpp
AMReX_MultiFab.cpp
AMReX_MultiFab.H
AMReX_MFCopyDescriptor.cpp
AMReX_MFCopyDescriptor.H
AMReX_iMultiFab.cpp
AMReX_iMultiFab.H
AMReX_FabArrayBase.cpp
AMReX_FabArrayBase.H
AMReX_FabArrayBase.H
AMReX_MFIter.cpp
AMReX_MFIter.H
AMReX_FabArray.H
Expand All @@ -161,51 +161,51 @@ target_sources( amrex
AMReX_FabArrayUtility.H
AMReX_LayoutData.H
# Geometry / Coordinate system routines -----------------------------------
AMReX_CoordSys.cpp
AMReX_CoordSys.cpp
AMReX_CoordSys.H
AMReX_Geometry.cpp
AMReX_Geometry.cpp
AMReX_Geometry.H
AMReX_MultiFabUtil.cpp
AMReX_MultiFabUtil.H
AMReX_MultiFabUtilI.H
# Boundary-related --------------------------------------------------------
AMReX_BCRec.cpp
AMReX_BCRec.H
AMReX_BCRec.H
AMReX_PhysBCFunct.cpp
AMReX_PhysBCFunct.H
AMReX_PhysBCFunct.H
AMReX_BCUtil.cpp
AMReX_BCUtil.H
AMReX_BC_TYPES.H
AMReX_BC_TYPES.H
# Plotfile ----------------------------------------------------------------
AMReX_PlotFileUtil.cpp
AMReX_PlotFileUtil.H
AMReX_PlotFileDataImpl.H
AMReX_PlotFileDataImpl.cpp
# Fortran interface routines.
# In GNUMake system, this is included only if BL_NO_FORT=FALSE ------------
AMReX_COORDSYS_${DIM}D_C.H
AMReX_COORDSYS_C.H
AMReX_filcc_f.H
AMReX_BLutil_F.F90
AMReX_BLProfiler_F.F90
AMReX_FILCC_${DIM}D.F90
AMReX_MultiFabUtil_${DIM}D_C.H
AMReX_MultiFabUtil_nd_C.H
AMReX_MultiFabUtil_C.H
AMReX_FilCC_${DIM}D_C.H
AMReX_FilCC_C.H
AMReX_FilCC_C.cpp
AMReX_filcc_mod.F90
AMReX_omp_mod.F90
AMReX_acc_mod.F90
AMReX_fort_mod.F90
AMReX_constants_mod.f90
AMReX_error_mod.F90
AMReX_parmparse_mod.F90
AMReX_string_mod.F90
AMReX_bc_types_mod.F90
AMReX_ParallelDescriptor_F.F90
AMReX_io_mod.F90
# # Fortran interface routines.
# # In GNUMake system, this is included only if BL_NO_FORT=FALSE ------------
# AMReX_COORDSYS_${DIM}D_C.H
# AMReX_COORDSYS_C.H
# AMReX_filcc_f.H
# AMReX_BLutil_F.F90
# AMReX_BLProfiler_F.F90
# AMReX_FILCC_${DIM}D.F90
# AMReX_MultiFabUtil_${DIM}D_C.H
# AMReX_MultiFabUtil_nd_C.H
# AMReX_MultiFabUtil_C.H
# AMReX_FilCC_${DIM}D_C.H
# AMReX_FilCC_C.H
# AMReX_FilCC_C.cpp
# AMReX_filcc_mod.F90
# AMReX_omp_mod.F90
# AMReX_acc_mod.F90
# AMReX_fort_mod.F90
# AMReX_constants_mod.f90
# AMReX_error_mod.F90
# AMReX_parmparse_mod.F90
# AMReX_string_mod.F90
# AMReX_bc_types_mod.F90
# AMReX_ParallelDescriptor_F.F90
# AMReX_io_mod.F90
# GPU --------------------------------------------------------------------
AMReX_Gpu.H
AMReX_GpuQualifiers.H
Expand Down Expand Up @@ -246,9 +246,38 @@ target_sources( amrex
AMReX_mempool_mod.F90 # if BL_NO_FORT = FALSE
# Profiling ---------------------------------------------------------------
AMReX_BLProfiler.cpp
AMReX_BLBackTrace.cpp
AMReX_BLBackTrace.cpp
)

# Fortran stuff
if (ENABLE_FORTRAN)
target_sources( amrex
PRIVATE
AMReX_COORDSYS_${DIM}D_C.H
AMReX_COORDSYS_C.H
AMReX_filcc_f.H
AMReX_BLutil_F.F90
AMReX_BLProfiler_F.F90
AMReX_FILCC_${DIM}D.F90
AMReX_MultiFabUtil_${DIM}D_C.H
AMReX_MultiFabUtil_nd_C.H
AMReX_MultiFabUtil_C.H
AMReX_FilCC_${DIM}D_C.H
AMReX_FilCC_C.H
AMReX_FilCC_C.cpp
AMReX_filcc_mod.F90
AMReX_omp_mod.F90
AMReX_acc_mod.F90
AMReX_fort_mod.F90
AMReX_constants_mod.f90
AMReX_error_mod.F90
AMReX_parmparse_mod.F90
AMReX_string_mod.F90
AMReX_bc_types_mod.F90
AMReX_ParallelDescriptor_F.F90
AMReX_io_mod.F90
)
endif ()
# LAZY mode not supported in CMake yet
# ifeq ($(LAZY),TRUE)
# C$(AMREX_BASE)_sources += AMReX_Lazy.cpp
Expand All @@ -264,7 +293,3 @@ endif ()
if (ENABLE_TINY_PROFILE)
target_sources(amrex PRIVATE AMReX_TinyProfiler.cpp AMReX_TinyProfiler.H )
endif ()




11 changes: 8 additions & 3 deletions Src/Boundary/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
target_include_directories(amrex PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>)

target_sources(amrex
PRIVATE
PRIVATE
AMReX_FabSet.cpp
AMReX_BndryRegister.cpp
AMReX_Mask.cpp
Expand All @@ -21,12 +21,17 @@ target_sources(amrex
AMReX_MacBndry.H
AMReX_InterpBndryData_K.H
AMReX_InterpBndryData_${DIM}D_K.H
AMReX_LO_UTIL.F90
AMReX_LOUtil_K.H
AMReX_YAFluxRegister.H
AMReX_YAFluxRegister_K.H
AMReX_YAFluxRegister_${DIM}D_K.H
AMReX_YAFluxRegister.cpp
AMReX_lo_bctypes_mod.F90
)

if (ENABLE_FORTRAN)
target_sources(amrex
PRIVATE
AMReX_LO_UTIL.F90
AMReX_lo_bctypes_mod.F90
)
endif ()
Loading

0 comments on commit effc622

Please sign in to comment.