Skip to content
Open
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
4 changes: 0 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ endif()
# ... before doing a final find_package to make it available.
find_package( ecbuild ${MINIMUM_ECBUILD_VERSION} REQUIRED )

# We set the <PNAME>_ECBUILD_COMPILE_FLAGS variable to an empty file. This ensures that we can
# specify a default set of compilation flags as well as per-file overwrites as part of the CMake config.
set( ECRAD_ECBUILD_COMPILE_FLAGS ${CMAKE_CURRENT_SOURCE_DIR}/cmake/ecrad_init_flags.cmake CACHE FILEPATH "")

project( ecrad LANGUAGES Fortran )
ecbuild_enable_fortran( REQUIRED )
set( CMAKE_EXPORT_COMPILE_COMMANDS ON )
Expand Down
27 changes: 9 additions & 18 deletions cmake/ecrad_compile_flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
# granted to it by virtue of its status as an intergovernmental organisation
# nor does it submit to any jurisdiction.

# Capture ecbuild defaults and/or flags set by a toolchain
set( ${PNAME}_Fortran_FLAGS "${${PNAME}_Fortran_FLAGS} ${ECBUILD_Fortran_FLAGS}" )
set( ${PNAME}_Fortran_FLAGS_BIT "${${PNAME}_Fortran_FLAGS_BIT} ${ECBUILD_Fortran_FLAGS_BIT}" )
set( ${PNAME}_Fortran_FLAGS_DEBUG "${${PNAME}_Fortran_FLAGS_DEBUG} ${ECBUILD_Fortran_FLAGS_DEBUG}" )

if(CMAKE_Fortran_COMPILER_ID MATCHES "Cray")
set(checkbounds_flags "-Rb")
set(fpe_flags "-Ktrap=fp")
Expand Down Expand Up @@ -42,12 +37,11 @@ elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Intel")
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "PGI|NVHPC")
set(fpe_flags "-Ktrap=fp")
set(vectorization_flags "-O3 -fast")
string(REPLACE "-O2" "" ${PNAME}_Fortran_FLAGS_BIT ${${PNAME}_Fortran_FLAGS_BIT})
string(REPLACE "-O2" "" CMAKE_Fortran_FLAGS_BIT ${CMAKE_Fortran_FLAGS_BIT})
set(checkbounds_flags "-Mbounds")

endif()

ecbuild_add_fortran_flags( "-g -O0" NAME base_debug BUILD DEBUG )
if( DEFINED align_flags )
ecbuild_add_fortran_flags( "${align_flags}" NAME align )
endif()
Expand All @@ -58,8 +52,7 @@ if( DEFINED convert_flags )
ecbuild_add_fortran_flags( "${convert_flags}" NAME convert )
endif()
if( DEFINED vectorization_flags )
# vectorization flags must be per-sourcefile overrideable, so are set via ${PNAME}_Fortran_FLAGS
set( ${PNAME}_Fortran_FLAGS_BIT "${${PNAME}_Fortran_FLAGS_BIT} ${vectorization_flags}" )
ecbuild_add_fortran_flags( "${vectorization_flags}" NAME vectorization BUILD BIT )
endif()
if( DEFINED fpmodel_flags )
ecbuild_add_fortran_flags( "${fpmodel_flags}" NAME fpmodel BUILD BIT )
Expand All @@ -68,14 +61,12 @@ if( DEFINED inline_flags )
ecbuild_add_fortran_flags( "${inline_flags}" NAME inline BUILD BIT )
endif()

if( CMAKE_BUILD_TYPE MATCHES "Debug" )
foreach( debug_flag fpe initsnan checkbounds )
if( ${debug_flag}_flags )
set( ${PNAME}_Fortran_FLAGS_DEBUG "${${PNAME}_Fortran_FLAGS_DEBUG} ${${debug_flag}_flags}" )
endif()
endforeach()
if(CMAKE_Fortran_COMPILER_ID MATCHES "Intel")
# In case '-check all' has been added, we need to remove the '-check arg_temp_created' warnings
set( ${PNAME}_Fortran_FLAGS_DEBUG "${${PNAME}_Fortran_FLAGS_DEBUG} -check noarg_temp_created" )
foreach( debug_flag fpe initsnan checkbounds )
if( ${debug_flag}_flags )
ecbuild_add_fortran_flags( "${${debug_flag}_flags}" NAME ${debug_flag} BUILD DEBUG )
endif()
endforeach()
if(CMAKE_Fortran_COMPILER_ID MATCHES "Intel")
# In case '-check all' has been added, we need to remove the '-check arg_temp_created' warnings
ecbuild_add_fortran_flags( "-check noarg_temp_created" NAME noarg BUILD DEBUG)
endif()
9 changes: 0 additions & 9 deletions cmake/ecrad_init_flags.cmake

This file was deleted.

6 changes: 3 additions & 3 deletions driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,17 @@ if( CMAKE_BUILD_TYPE MATCHES "Debug" )
if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
set_source_files_properties(
"ecrad_ifs_driver_blocked.F90"
PROPERTIES COMPILE_FLAGS "-fcheck=no-bounds"
PROPERTIES COMPILE_OPTIONS "-fcheck=no-bounds"
)
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Intel")
set_source_files_properties(
"ecrad_ifs_driver_blocked.F90"
PROPERTIES COMPILE_FLAGS "-check nobounds"
PROPERTIES COMPILE_OPTIONS "-check nobounds"
)
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "PGI|NVHPC")
set_source_files_properties(
"ecrad_ifs_driver_blocked.F90"
PROPERTIES COMPILE_FLAGS "-Mnobounds"
PROPERTIES COMPILE_OPTIONS "-Mnobounds"
)
endif()
endif()
Expand Down