-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into update_from_develop_2024-11-21
- Loading branch information
Showing
20 changed files
with
659 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
cmake_minimum_required(VERSION 3.10) | ||
cmake_minimum_required(VERSION 3.18) | ||
|
||
project(ccpp_framework | ||
VERSION 5.0.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
#------------------------------------------------------------------------------ | ||
cmake_minimum_required(VERSION 3.10) | ||
|
||
project(ccpp_unit_conv | ||
VERSION 1.0.0 | ||
LANGUAGES Fortran) | ||
|
||
#------------------------------------------------------------------------------ | ||
# Request a static build | ||
option(BUILD_SHARED_LIBS "Build a shared library" OFF) | ||
|
||
#------------------------------------------------------------------------------ | ||
# Set MPI flags for C/C++/Fortran with MPI F08 interface | ||
find_package(MPI REQUIRED Fortran) | ||
if(NOT MPI_Fortran_HAVE_F08_MODULE) | ||
message(FATAL_ERROR "MPI implementation does not support the Fortran 2008 mpi_f08 interface") | ||
endif() | ||
|
||
#------------------------------------------------------------------------------ | ||
# Set the sources: physics type definitions | ||
set(TYPEDEFS $ENV{CCPP_TYPEDEFS}) | ||
if(TYPEDEFS) | ||
message(STATUS "Got CCPP TYPEDEFS from environment variable: ${TYPEDEFS}") | ||
else(TYPEDEFS) | ||
include(${CMAKE_CURRENT_BINARY_DIR}/CCPP_TYPEDEFS.cmake) | ||
message(STATUS "Got CCPP TYPEDEFS from cmakefile include file: ${TYPEDEFS}") | ||
endif(TYPEDEFS) | ||
|
||
# Generate list of Fortran modules from the CCPP type | ||
# definitions that need need to be installed | ||
foreach(typedef_module ${TYPEDEFS}) | ||
list(APPEND MODULES_F90 ${CMAKE_CURRENT_BINARY_DIR}/${typedef_module}) | ||
endforeach() | ||
|
||
#------------------------------------------------------------------------------ | ||
# Set the sources: physics schemes | ||
set(SCHEMES $ENV{CCPP_SCHEMES}) | ||
if(SCHEMES) | ||
message(STATUS "Got CCPP SCHEMES from environment variable: ${SCHEMES}") | ||
else(SCHEMES) | ||
include(${CMAKE_CURRENT_BINARY_DIR}/CCPP_SCHEMES.cmake) | ||
message(STATUS "Got CCPP SCHEMES from cmakefile include file: ${SCHEMES}") | ||
endif(SCHEMES) | ||
|
||
# Set the sources: physics scheme caps | ||
set(CAPS $ENV{CCPP_CAPS}) | ||
if(CAPS) | ||
message(STATUS "Got CCPP CAPS from environment variable: ${CAPS}") | ||
else(CAPS) | ||
include(${CMAKE_CURRENT_BINARY_DIR}/CCPP_CAPS.cmake) | ||
message(STATUS "Got CCPP CAPS from cmakefile include file: ${CAPS}") | ||
endif(CAPS) | ||
|
||
# Set the sources: physics scheme caps | ||
set(API $ENV{CCPP_API}) | ||
if(API) | ||
message(STATUS "Got CCPP API from environment variable: ${API}") | ||
else(API) | ||
include(${CMAKE_CURRENT_BINARY_DIR}/CCPP_API.cmake) | ||
message(STATUS "Got CCPP API from cmakefile include file: ${API}") | ||
endif(API) | ||
|
||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -O0 -fno-unsafe-math-optimizations -frounding-math -fsignaling-nans -ffpe-trap=invalid,zero,overflow -fbounds-check -ggdb -fbacktrace -ffree-line-length-none") | ||
|
||
#------------------------------------------------------------------------------ | ||
add_library(ccpp_unit_conv STATIC ${SCHEMES} ${CAPS} ${API}) | ||
target_link_libraries(ccpp_unit_conv PRIVATE MPI::MPI_Fortran) | ||
# Generate list of Fortran modules from defined sources | ||
foreach(source_f90 ${CAPS} ${API}) | ||
get_filename_component(tmp_source_f90 ${source_f90} NAME) | ||
string(REGEX REPLACE ".F90" ".mod" tmp_module_f90 ${tmp_source_f90}) | ||
string(TOLOWER ${tmp_module_f90} module_f90) | ||
list(APPEND MODULES_F90 ${CMAKE_CURRENT_BINARY_DIR}/${module_f90}) | ||
endforeach() | ||
|
||
set_target_properties(ccpp_unit_conv PROPERTIES VERSION ${PROJECT_VERSION} | ||
SOVERSION ${PROJECT_VERSION_MAJOR}) | ||
|
||
add_executable(test_unit_conv.x main.F90) | ||
add_dependencies(test_unit_conv.x ccpp_unit_conv) | ||
target_link_libraries(test_unit_conv.x ccpp_unit_conv) | ||
set_target_properties(test_unit_conv.x PROPERTIES LINKER_LANGUAGE Fortran) | ||
|
||
# Define where to install the library | ||
install(TARGETS ccpp_unit_conv | ||
EXPORT ccpp_unit_conv-targets | ||
ARCHIVE DESTINATION lib | ||
LIBRARY DESTINATION lib | ||
RUNTIME DESTINATION lib | ||
) | ||
# Export our configuration | ||
install(EXPORT ccpp_unit_conv-targets | ||
FILE ccpp_unit_conv-config.cmake | ||
DESTINATION lib/cmake | ||
) | ||
# Define where to install the C headers and Fortran modules | ||
#install(FILES ${HEADERS_C} DESTINATION include) | ||
install(FILES ${MODULES_F90} DESTINATION include) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# How to build the unit conv test | ||
|
||
1. Set compiler environment as appropriate for your system | ||
2. Run the following commands: | ||
``` | ||
cd test_prebuild/test_unit_conv/ | ||
rm -fr build | ||
mkdir build | ||
../../scripts/ccpp_prebuild.py --config=ccpp_prebuild_config.py --builddir=build | ||
cd build | ||
cmake .. 2>&1 | tee log.cmake | ||
make 2>&1 | tee log.make | ||
./test_unit_conv.x | ||
# On systems where linking against the MPI library requires a parallel launcher, | ||
# use 'mpirun -np 1 ./test_unit_conv.x' or 'srun -n 1 ./test_unit_conv.x' etc. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module ccpp_kinds | ||
|
||
!! \section arg_table_ccpp_kinds | ||
!! \htmlinclude ccpp_kinds.html | ||
!! | ||
|
||
use iso_fortran_env, only: real64 | ||
|
||
implicit none | ||
|
||
integer, parameter :: kind_phys = real64 | ||
|
||
end module ccpp_kinds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[ccpp-table-properties] | ||
name = ccpp_kinds | ||
type = module | ||
dependencies = | ||
|
||
######################################################################## | ||
[ccpp-arg-table] | ||
name = ccpp_kinds | ||
type = module | ||
[kind_phys] | ||
standard_name = kind_phys | ||
long_name = definition of kind_phys | ||
units = none | ||
dimensions = () | ||
type = integer |
Oops, something went wrong.