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

CCPP static build #161

Merged
merged 5 commits into from
Sep 18, 2018
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
26 changes: 23 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,12 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
endif()

#------------------------------------------------------------------------------
# By default we want a shared library
option(BUILD_SHARED_LIBS "Build a shared library" ON)
# By default we want a shared library (unless a static build is requested)
if(STATIC)
option(BUILD_SHARED_LIBS "Build a static library" OFF)
else(STATIC)
option(BUILD_SHARED_LIBS "Build a shared library" ON)
endif(STATIC)

#------------------------------------------------------------------------------
# Add the CCPP include/module directory
Expand Down Expand Up @@ -190,7 +194,18 @@ endif (PROJECT STREQUAL "CCPP-FV3")

#------------------------------------------------------------------------------

add_library(ccppphys ${SCHEMES} ${CAPS})
if(STATIC)
add_library(ccppphys STATIC ${SCHEMES} ${CAPS})
# Generate list of Fortran modules from defined sources
foreach(source_f90 ${CAPS})
string(REGEX REPLACE ".F90" ".mod" tmp_module_f90 ${source_f90})
string(TOLOWER ${tmp_module_f90} module_f90)
list(APPEND MODULES_F90 ${CMAKE_CURRENT_BINARY_DIR}/../${module_f90})
endforeach()
else(STATIC)
add_library(ccppphys ${SCHEMES} ${CAPS})
endif(STATIC)

if (PROJECT STREQUAL "CCPP-FV3")
target_link_libraries(ccppphys LINK_PUBLIC ${LIBS} sp_v2.0.2_d bacio_4 w3nco_d)
elseif (PROJECT STREQUAL "CCPP-SCM")
Expand Down Expand Up @@ -230,4 +245,9 @@ if (PROJECT STREQUAL "CCPP-FV3")
FILE ccppphys-config.cmake
DESTINATION lib/cmake
)
if(STATIC)
# Define where to install the C headers and Fortran modules
#install(FILES ${HEADERS_C} DESTINATION include)
install(FILES ${MODULES_F90} DESTINATION include)
endif(STATIC)
endif (PROJECT STREQUAL "CCPP-FV3")
68 changes: 68 additions & 0 deletions physics/GFS_suite_init_finalize_test.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
module GFS_suite_ini_fini_test

contains

!> \section arg_table_GFS_suite_ini_fini_test_init Argument Table
!! | local_name | standard_name | long_name | units | rank | type | kind | intent | optional |
!! |----------------|--------------------------------------------------------|---------------------------------------------------------|---------------|------|-----------------------|-----------|--------|----------|
!! | errmsg | ccpp_error_message | error message for error handling in CCPP | none | 0 | character | len=* | out | F |
!! | errflg | ccpp_error_flag | error flag for error handling in CCPP | flag | 0 | integer | | out | F |
!!
subroutine GFS_suite_ini_fini_test_init (errmsg, errflg)

implicit none

! interface variables
character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg

errmsg = ''
errflg = 0

write(0,*) "DH DEBUG: IN GFS_suite_ini_fini_test_init"

end subroutine GFS_suite_ini_fini_test_init

!> \section arg_table_GFS_suite_ini_fini_test_finalize Argument Table
!! | local_name | standard_name | long_name | units | rank | type | kind | intent | optional |
!! |----------------|--------------------------------------------------------|---------------------------------------------------------|---------------|------|-----------------------|-----------|--------|----------|
!! | errmsg | ccpp_error_message | error message for error handling in CCPP | none | 0 | character | len=* | out | F |
!! | errflg | ccpp_error_flag | error flag for error handling in CCPP | flag | 0 | integer | | out | F |
!!
subroutine GFS_suite_ini_fini_test_finalize(errmsg, errflg)

implicit none

! interface variables
character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg

errmsg = ''
errflg = 0

write(0,*) "DH DEBUG: IN GFS_suite_ini_fini_test_finalize"

end subroutine GFS_suite_ini_fini_test_finalize

!> \section arg_table_GFS_suite_ini_fini_test_run Argument Table
!! | local_name | standard_name | long_name | units | rank | type | kind | intent | optional |
!! |----------------|--------------------------------------------------------|---------------------------------------------------------|---------------|------|-----------------------|-----------|--------|----------|
!! | errmsg | ccpp_error_message | error message for error handling in CCPP | none | 0 | character | len=* | out | F |
!! | errflg | ccpp_error_flag | error flag for error handling in CCPP | flag | 0 | integer | | out | F |
!!
subroutine GFS_suite_ini_fini_test_run (errmsg, errflg)

use GFS_typedefs, only: GFS_interstitial_type

implicit none

! interface variables
character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg

write(errmsg,'(a)') "DH ERROR: GFS_suite_ini_fini_test_run should not be called"
errflg = 1

end subroutine GFS_suite_ini_fini_test_run

end module GFS_suite_ini_fini_test