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

CMake set release flags properly #2138

Merged
merged 3 commits into from
Dec 20, 2024
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
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ if ( DEFINED CMAKE_TOOLCHAIN_FILE )
# include( ${WRF_CONFIG} )
endif()

# Import default flags now, get rid of any imported release flag
# we will handle that ourselves with WRF_FCOPTIM/WRF_FCNOOPT
set( CMAKE_Fortran_FLAGS_RELEASE "" CACHE STRING "" FORCE )
set( CMAKE_C_FLAGS_RELEASE "" CACHE STRING "" FORCE )

# list( APPEND CMAKE_MODULE_PATH )
list( APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/ ${PROJECT_SOURCE_DIR}/cmake/modules )

Expand Down
8 changes: 4 additions & 4 deletions cmake/template/arch_config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ set( CMAKE_Fortran_FLAGS_INIT "{SFC_FLAGS} {FCBASEOPTS} {BYTESWAPIO}" )
set( CMAKE_C_FLAGS_INIT "{SCC_FLAGS} {CFLAGS_LOCAL}" )

# https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_FLAGS_CONFIG_INIT.html
set( CMAKE_Fortran_FLAGS_Debug_INIT "{FCDEBUG}" )
set( CMAKE_Fortran_FLAGS_Release_INIT "" )
set( CMAKE_C_FLAGS_Debug_INIT "" )
set( CMAKE_C_FLAGS_Release_INIT "" )
set( CMAKE_Fortran_FLAGS_DEBUG_INIT "{FCDEBUG}" )
set( CMAKE_Fortran_FLAGS_RELEASE_INIT "" )
set( CMAKE_C_FLAGS_DEBUG_INIT "" )
set( CMAKE_C_FLAGS_RELEASE_INIT "" )

# Project specifics now
set( WRF_MPI_Fortran_FLAGS "{DM_FC_FLAGS}" )
Expand Down
2 changes: 2 additions & 0 deletions frame/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ target_sources(
# Disable optimizations on these files always
set_source_files_properties(
${nl_dyn_source}
module_comm_nesting_dm.F
DIRECTORY ${PROJECT_SOURCE_DIR}
PROPERTIES
COMPILE_OPTIONS_OPTIMIZATION
$<$<COMPILE_LANGUAGE:Fortran>:${WRF_FCNOOPT}>
Expand Down