Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to support Spack #170

Merged
merged 2 commits into from
Mar 18, 2022
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Updates to CMake to support Spack
- Moved CircleCI to use circleci-tools orb

### Removed
Expand Down
3 changes: 1 addition & 2 deletions DNA_GridComp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ set (srcs
DNA_GridCompMod.F90
)

esma_add_library (${this} SRCS ${srcs} DEPENDENCIES MAPL)
esma_add_library (${this} SRCS ${srcs} DEPENDENCIES MAPL esmf NetCDF::NetCDF_Fortran)
target_compile_definitions (${this} PRIVATE MAPL_MODE GEOS5)
target_include_directories (${this} PUBLIC ${INC_ESMF} ${INC_NETCDF})

set (resource_files
DNA_ExtData.rc
Expand Down
3 changes: 1 addition & 2 deletions GAAS_GridComp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ set (srcs
)


esma_add_library (${this} SRCS ${srcs} DEPENDENCIES MAPL Chem_Base Chem_Shared GMAO_mpeu FVdycoreCubed_GridComp)
target_include_directories (${this} PUBLIC ${INC_NETCDF})
esma_add_library (${this} SRCS ${srcs} DEPENDENCIES MAPL Chem_Base Chem_Shared GMAO_mpeu FVdycoreCubed_GridComp NetCDF::NetCDF_Fortran)

esma_generate_gocart_code (${this} -F)

Expand Down
6 changes: 1 addition & 5 deletions GEOSCHEMchem_GridComp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,9 @@ endif ()
esma_add_library (${this}
SRCS ${srcs}
DEPENDENCIES MAPL MAPL_cfio_r4 Chem_Base Chem_Shared HEMCO
OpenMP::OpenMP_Fortran esmf NetCDF::NetCDF_Fortran
)

# Enable OpenMP
target_link_libraries(${this} PRIVATE OpenMP::OpenMP_Fortran)

target_include_directories (${this} PUBLIC ${INC_ESMF} ${INC_NETCDF})

target_compile_definitions(${this} PRIVATE
ESMF_ UCX EXTERNAL_GRID EXTERNAL_FORCING USE_REAL8 MODEL_GEOS)

Expand Down
5 changes: 2 additions & 3 deletions GEOSachem_GridComp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ set (srcs
${kpp_gas_dir}/kpp_achem_gas_Monitor.f90
${kpp_gas_dir}/kpp_achem_gas_Util.f90
${kpp_gas_dir}/kpp_achem_gas_LinearAlgebra.f90
${kpp_gas_dir}/kpp_achem_gas_Integrator.f90
${kpp_gas_dir}/kpp_achem_gas_Integrator.f90
GACL_ConstantsMod.F90
GACL_EmissionsMod.F90
GACL_ReactionRatesMod.F90
Expand All @@ -27,11 +27,10 @@ set (srcs
esma_add_library (
${this}
SRCS ${srcs}
DEPENDENCIES Chem_Shared MAPL GMAO_mpeu
DEPENDENCIES Chem_Shared MAPL GMAO_mpeu esmf NetCDF::NetCDF_Fortran
)
target_compile_definitions (${this} PRIVATE MAPL_MODE GEOS5)
set_target_properties (${this} PROPERTIES COMPILE_FLAGS ${PP})
target_include_directories (${this} PUBLIC ${INC_ESMF} ${INC_NETCDF})

new_esma_generate_automatic_code (
${this} GEOSachem_Registry.rc
Expand Down
3 changes: 1 addition & 2 deletions GEOSpchem_GridComp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ esma_set_this ()

esma_add_library (${this}
SRCS GEOS_PChemGridComp.F90
DEPENDENCIES MAPL MAPL_cfio_r4 Chem_Base)
target_include_directories (${this} PUBLIC ${INC_ESMF} ${INC_NETCDF})
DEPENDENCIES MAPL MAPL_cfio_r4 Chem_Base esmf NetCDF::NetCDF_Fortran)
5 changes: 2 additions & 3 deletions HEMCO_GridComp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ set (srcs
esma_add_library (
${this}
SRCS ${srcs}
DEPENDENCIES Chem_Shared MAPL HEMCO
DEPENDENCIES Chem_Shared MAPL HEMCO esmf NetCDF::NetCDF_Fortran
)
target_compile_definitions (${this} PRIVATE ESMF_ DEVEL GEOS_FP)
target_include_directories (${this} PUBLIC ${INC_ESMF} ${INC_NETCDF})

set (acg_headers
HEMCO_InternalSpec___.h HEMCO_DeclarePointer___.h HEMCO_GetPointer___.h
Expand All @@ -26,7 +25,7 @@ add_custom_command (
OUTPUT ${acg_headers}
COMMAND ${generator} ${acg_flags} -v -F ${CMAKE_CURRENT_SOURCE_DIR}/HEMCO_Registry.rc
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
MAIN_DEPENDENCY HEMCO_Registry.rc
MAIN_DEPENDENCY HEMCO_Registry.rc
# DEPENDS ${include_MAPL_Base}/mapl_acg.pl
COMMENT "Generating automated code for HEMCO"
)
Expand Down
3 changes: 1 addition & 2 deletions MAMchem_GridComp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,8 @@ set (srcs
)


set (dependencies MAPL Chem_Shared GMAO_mpeu)
set (dependencies MAPL Chem_Shared GMAO_mpeu esmf NetCDF::NetCDF_Fortran)
esma_add_library (${this} SRCS ${srcs} DEPENDENCIES ${dependencies} SUBDIRS optics)
target_include_directories (${this} PUBLIC ${INC_ESMF} ${INC_NETCDF})
target_compile_definitions (${this} PRIVATE GEOS5 MODAL_AERO MODAL_AERO_7MODE GEOS5_PORT)

esma_generate_gocart_code (${this} -F)
Expand Down
13 changes: 5 additions & 8 deletions Shared/Chem_Base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ set (srcs
Chem_AodMod.F90
Chem_SimpleBundleMod.F90
)
esma_add_library(${this} SRCS ${srcs} DEPENDENCIES GMAO_mpeu MAPL GMAO_gfio_r4)
target_include_directories (${this} PUBLIC ${INC_ESMF} ${INC_NETCDF})
esma_add_library(${this} SRCS ${srcs} DEPENDENCIES GMAO_mpeu MAPL GMAO_gfio_r4 esmf NetCDF::NetCDF_Fortran)
target_compile_definitions (${this} PRIVATE GEOS5)

ecbuild_add_executable(TARGET gogo.x SOURCES gogo.F90 LIBS ${this})
Expand All @@ -24,9 +23,9 @@ if (USE_F2PY)
if (F2PY2_FOUND)
add_f2py2_module(MieObs_ SOURCES MieObs_py.F90
DESTINATION lib/Python2
LIBRARIES Chem_Base MAPL GMAO_mpeu ${NETCDF_LIBRARIES} ${ESMF_LIBRARY}
INCLUDEDIRS ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR}/lib ${BASEDIR}/lib ${include_${this}} ${INC_NETCDF}
USE_MPI
LIBRARIES Chem_Base MAPL GMAO_mpeu ${ESMF_LIBRARY}
INCLUDEDIRS ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR}/lib ${include_${this}}
USE_MPI USE_NETCDF
)
add_dependencies(MieObs_ ${this})
endif ()
Expand All @@ -38,9 +37,7 @@ foreach (exe Chem_Aod.x Chem_Aod3d.x ctl_crst.x Chem_BundleToG5rs.x reff_calcula
ecbuild_add_executable (
TARGET ${exe}
SOURCES ${basename}.F90
LIBS ${this} ${OpenMP_Fortran_LIBRARIES})
# Do not know how to propagate the flags for OpenMP link step from lower libraries.
set_target_properties(${exe} PROPERTIES LINK_FLAGS "${OpenMP_Fortran_FLAGS}")
LIBS ${this} OpenMP::OpenMP_Fortran)
endforeach ()

# Copy RC files to build tree
Expand Down
11 changes: 5 additions & 6 deletions Shared/Chem_Shared/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ else ()
list (APPEND srcs Chem_UtilMod_geos4.F90)
endif ()

esma_add_library(${this}
SRCS ${srcs}
DEPENDENCIES GMAO_mpeu MAPL Chem_Base GEOS_Shared GMAO_hermes)
target_include_directories(${this} PUBLIC ${INC_ESMF} ${INC_NETCDF})
esma_add_library(${this}
SRCS ${srcs}
DEPENDENCIES GMAO_mpeu MAPL Chem_Base GEOS_Shared GMAO_hermes esmf NetCDF::NetCDF_Fortran)
#add_definitions(-DDEBUG)
add_definitions(-DSPMD -DFVCHEM)

Expand All @@ -48,5 +47,5 @@ install(
PROGRAMS bundleParser.py
DESTINATION bin
)


4 changes: 1 addition & 3 deletions Shared/HEMCO/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,8 @@ list (REMOVE_ITEM srcs

esma_add_library (${this}
SRCS ${srcs}
DEPENDENCIES MAPL
DEPENDENCIES MAPL esmf NetCDF::NetCDF_Fortran
)

target_include_directories (${this} PUBLIC ${INC_ESMF} ${INC_NETCDF})

target_compile_definitions (${this} PRIVATE ESMF_ USE_REAL8 MODEL_GEOS)
set_target_properties (${this} PROPERTIES Fortran_MODULE_DIRECTORY ${include_${this}})
3 changes: 1 addition & 2 deletions StratChem_GridComp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,8 @@ include_directories (${include_Chem_Shared})
include_directories (${CMAKE_CURRENT_BINARY_DIR})
include_directories (${include_GMAO_mpeu})

set (dependencies Chem_Shared MAPL MAPL_cfio_r4 GMAO_mpeu)
set (dependencies Chem_Shared MAPL MAPL_cfio_r4 GMAO_mpeu NetCDF::NetCDF_Fortran)
esma_add_library (${this} SRCS ${srcs} DEPENDENCIES ${dependencies})
target_include_directories (${this} PUBLIC ${INC_NETCDF})

if (STRATCHEM_REDUCED_MECHANISM)
target_compile_definitions(${this} PRIVATE REDUCED)
Expand Down