-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #110 from Florent2305/PatchITK4NewGcc
Fix COMP: ITK build error with GCC 13
- Loading branch information
Showing
6 changed files
with
106 additions
and
0 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 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,14 @@ | ||
## ############################################################################# | ||
## Generate patch command for an external project. To use with ExternalProject_Add | ||
## ############################################################################# | ||
function(ep_GeneratePatchCommand ep OutVar patch) | ||
set(PATCH_COMMAND ${CMAKE_COMMAND} | ||
-Dep:STRING=${ep} | ||
-DANIMA_SOURCE_DIR:STRING=${CMAKE_SOURCE_DIR} | ||
-DEP_PATH_SOURCE:STRING=${EP_PATH_SOURCE} | ||
-Dpatch:STRING=${patch} | ||
-P | ||
${CMAKE_SOURCE_DIR}/superbuild/EP_PatcherScript.cmake) | ||
|
||
set(${OutVar} ${PATCH_COMMAND} PARENT_SCOPE) | ||
endfunction() |
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,66 @@ | ||
## ############################################################################# | ||
## Check if a patch should be applied and apply it if needed | ||
## ############################################################################# | ||
macro(directory_count_elements ep_path elements_count_res) | ||
file(GLOB RESULT ${ep_path}/*) | ||
list(LENGTH RESULT ${elements_count_res}) | ||
endmacro() | ||
|
||
function(ep_GenerateValidPatcherScript ep OutVar patch) | ||
find_program(GIT_BIN NAMES git) | ||
|
||
set(PATCHES_TO_APPLY_CUR ${ANIMA_SOURCE_DIR}/superbuild/patches/${patch}) | ||
directory_count_elements(${EP_PATH_SOURCE}/${ep} count) | ||
|
||
if(NOT ${count} EQUAL 0) #Check if external_project is already cloned | ||
execute_process(COMMAND ${GIT_BIN} apply --reverse --ignore-whitespace --check ${ANIMA_SOURCE_DIR}/superbuild/patches/${patch} | ||
WORKING_DIRECTORY ${EP_PATH_SOURCE}/${ep} | ||
RESULT_VARIABLE PATCH_ALREADY_APPLIED | ||
OUTPUT_QUIET | ||
ERROR_QUIET) | ||
|
||
if (PATCH_ALREADY_APPLIED EQUAL 0) #As all OS system commands: 0 is Ok, not 0 is bad. | ||
# The patch is already applied | ||
message("The patch ${patch} for the external project ${ep} is already applied") | ||
set (PATCHES_TO_APPLY_CUR "") #Then erase PATCHES_TO_APPLY_CUR | ||
else() | ||
execute_process(COMMAND ${GIT_BIN} apply --ignore-whitespace --check ${ANIMA_SOURCE_DIR}/superbuild/patches/${patch} | ||
WORKING_DIRECTORY ${EP_PATH_SOURCE}/${ep} | ||
RESULT_VARIABLE PATCH_APPLICABLE) | ||
#OUTPUT_QUIET | ||
#ERROR_QUIET) | ||
if(PATCH_APPLICABLE EQUAL 0) #As all OS system commands: 0 is Ok, not 0 is bad. | ||
#Do nothing, the value is already set | ||
message("The patch ${patch} will be applied on pre-existing ${EP_PATH_SOURCE}/${ep}") | ||
else() | ||
message("*****************************************************************************************************\n") | ||
message("***** The patch ${patch} for the external project ${ep} is NOT APPLICABLE") | ||
message("***** EP PATH = ${EP_PATH_SOURCE}/${ep}") | ||
message("***** PATCH file = ${ANIMA_SOURCE_DIR}/superbuild/patches/${patch}") | ||
message("*****************************************************************************************************\n") | ||
message(FATAL_ERROR "") | ||
|
||
endif() | ||
endif() | ||
else() | ||
message("The patch ${patch} will be applied after ${ep} cloning into ${EP_PATH_SOURCE}/${ep}") | ||
endif() | ||
set(PATCHES_TO_APPLY ${PATCHES_TO_APPLY} ${PATCHES_TO_APPLY_CUR}) | ||
|
||
|
||
set(PATCH_COMMAND "") | ||
if (NOT "${PATCHES_TO_APPLY}" STREQUAL "") | ||
set(PATCH_COMMAND ${GIT_BIN} apply --ignore-whitespace ${PATCHES_TO_APPLY}) | ||
endif() | ||
|
||
set(${OutVar} ${PATCH_COMMAND} PARENT_SCOPE) | ||
endfunction() | ||
|
||
|
||
ep_GenerateValidPatcherScript(${ep} patchCommand ${patch}) | ||
|
||
if(patchCommand) | ||
execute_process(COMMAND ${patchCommand} WORKING_DIRECTORY ${EP_PATH_SOURCE}/${ep}) | ||
else() | ||
message(DEBUG "No patch treatment for ${ep}") | ||
endif() |
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,12 @@ | ||
unchanged: | ||
--- a/Modules/Filtering/MathematicalMorphology/include/itkMathematicalMorphologyEnums.h | ||
+++ b/Modules/Filtering/MathematicalMorphology/include/itkMathematicalMorphologyEnums.h | ||
@@ -19,6 +19,7 @@ | ||
#define itkMathematicalMorphologyEnums_h | ||
|
||
#include <iostream> | ||
+#include <cstdint> | ||
#include "ITKMathematicalMorphologyExport.h" | ||
|
||
|
||
|