-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Patch mom_cap.F90 source file on-the-fly instead of adding a full cop…
…y of the patched file.
- Loading branch information
1 parent
a22dbee
commit 6570fef
Showing
7 changed files
with
65 additions
and
2,748 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
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 was deleted.
Oops, something went wrong.
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,11 @@ | ||
--- MOM6/config_src/drivers/nuopc_cap/mom_cap.F90 2023-08-31 10:49:33.115826000 +1000 | ||
+++ MOM6/config_src/drivers/nuopc_cap/mom_cap.F90.new 2023-08-31 10:50:34.446781000 +1000 | ||
@@ -1672,7 +1672,7 @@ | ||
! determine restart filename | ||
call ESMF_ClockGetNextTime(clock, MyTime, rc=rc) | ||
if (ChkErr(rc,__LINE__,u_FILE_u)) return | ||
- call ESMF_TimeGet (MyTime, yy=year, mm=month, dd=day, h=hour, m=minute, s=seconds, rc=rc ) | ||
+ call ESMF_TimeGet (MyTime, yy=year, mm=month, dd=day, s=seconds, rc=rc ) | ||
if (ChkErr(rc,__LINE__,u_FILE_u)) return | ||
|
||
if (cesm_coupled) then |
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,22 @@ | ||
# Apply a patch to a source file and add the resulting file to the sources of a | ||
# given target. | ||
function(add_patched_source TARGET FILE) | ||
# This function makes the following assumptions: | ||
# - patches are stored in ${CMAKE_CURRENT_SOURCE_DIR}/patches | ||
# - all patches to a given file are kept in the same patch file | ||
# - patch files are named ${FILE}.patch | ||
|
||
get_filename_component(filename ${FILE} NAME) | ||
|
||
add_custom_command( | ||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${filename} | ||
COMMAND ${CMAKE_COMMAND} | ||
-Din_file:FILEPATH=${CMAKE_CURRENT_SOURCE_DIR}/${FILE} | ||
-Dpatch_file:FILEPATH=${CMAKE_CURRENT_SOURCE_DIR}/patches/${filename}.patch | ||
-Dout_file:FILEPATH=${CMAKE_CURRENT_BINARY_DIR}/${filename} | ||
-P ${CMAKE_SOURCE_DIR}/cmake/PatchFile.cmake | ||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE} | ||
) | ||
|
||
target_sources(${TARGET} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/${filename}) | ||
endfunction(add_patched_source) |
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,30 @@ | ||
# use GNU Patch from any platform | ||
|
||
if(WIN32) | ||
# prioritize Git Patch on Windows as other Patches may be very old and incompatible. | ||
find_package(Git) | ||
if(Git_FOUND) | ||
get_filename_component(GIT_DIR ${GIT_EXECUTABLE} DIRECTORY) | ||
get_filename_component(GIT_DIR ${GIT_DIR} DIRECTORY) | ||
endif() | ||
endif() | ||
|
||
find_program(PATCH | ||
NAMES patch | ||
HINTS ${GIT_DIR} | ||
PATH_SUFFIXES usr/bin | ||
) | ||
|
||
if(NOT PATCH) | ||
message(FATAL_ERROR "Did not find GNU Patch") | ||
endif() | ||
|
||
execute_process(COMMAND ${PATCH} ${in_file} --input=${patch_file} --output=${out_file} --ignore-whitespace | ||
TIMEOUT 15 | ||
COMMAND_ECHO STDOUT | ||
RESULT_VARIABLE ret | ||
) | ||
|
||
if(NOT ret EQUAL 0) | ||
message(FATAL_ERROR "Failed to apply patch ${patch_file} to ${in_file} with ${PATCH}") | ||
endif() |