diff --git a/CMake/VTKmCheckPyexpander.cmake b/CMake/VTKmCheckPyexpander.cmake index b747fbb8e..062739c4b 100644 --- a/CMake/VTKmCheckPyexpander.cmake +++ b/CMake/VTKmCheckPyexpander.cmake @@ -63,9 +63,22 @@ execute_process( if(${diff_result}) # If diff returned non-zero, it failed and the two files are different. - file(REMOVE ${GENERATED_FILE}) get_filename_component(filename ${SOURCE_FILE} NAME) + # Move the generated file so that the build does not confuse it with the + # files in the source directory. + file(REMOVE ${GENERATED_FILE}.save) + file(RENAME ${GENERATED_FILE} ${GENERATED_FILE}.save) message(SEND_ERROR "The source file ${filename} does not match the generated file. If you have modified this file directly, then you have messed up. Modify the ${filename}.in file instead and then copy the pyexpander result to ${filename}. If you modified ${filename}.in, then you might just need to copy the pyresult back to the source directory. If you have not modifed either, then you have likely checked out an inappropriate change. Check the git logs to see what changes were made. -If the changes have resulted from modifying ${filename}.in, then you can finish by copying ${GENERATED_FILE} to ${SOURCE_FILE}.") +If the changes have resulted from modifying ${filename}.in, then you can finish by moving ${GENERATED_FILE}.save over ${SOURCE_FILE}") +else() + # Now that we have done the comparison, remove the generated file so there is + # no confusion between the generated files and the source files checked into + # the repository. + file(REMOVE ${GENERATED_FILE}) + # Pyexpander successfully checked, so touch a file to tell make when the + # check was last successfully performed. + execute_process( + COMMAND ${CMAKE_COMMAND} -E touch ${GENERATED_FILE}.checked + ) endif() diff --git a/CMake/VTKmMacros.cmake b/CMake/VTKmMacros.cmake index b1ef5525b..22c5705c8 100644 --- a/CMake/VTKmMacros.cmake +++ b/CMake/VTKmMacros.cmake @@ -135,7 +135,7 @@ function(vtkm_pyexpander_generated_file generated_file_name) # If pyexpander is available, add targets to build and check if(PYEXPANDER_FOUND) add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${generated_file_name} + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${generated_file_name}.checked COMMAND ${CMAKE_COMMAND} -DPYEXPANDER_COMMAND=${PYEXPANDER_COMMAND} -DSOURCE_FILE=${CMAKE_CURRENT_SOURCE_DIR}/${generated_file_name} @@ -143,10 +143,10 @@ function(vtkm_pyexpander_generated_file generated_file_name) -P ${CMAKE_SOURCE_DIR}/CMake/VTKmCheckPyexpander.cmake MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/${generated_file_name}.in DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${generated_file_name} + COMMENT "Checking validity of ${generated_file_name}" ) add_custom_target(check_${generated_file_name} ALL - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${generated_file_name} - COMMENT "Checking validity of ${generated_file_name}" + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${generated_file_name}.checked ) endif() endfunction(vtkm_pyexpander_generated_file) diff --git a/vtkm/internal/FunctionInterface.h b/vtkm/internal/FunctionInterface.h index 2b9d0ecf6..d68eedfdc 100644 --- a/vtkm/internal/FunctionInterface.h +++ b/vtkm/internal/FunctionInterface.h @@ -17,8 +17,8 @@ // Laboratory (LANL), the U.S. Government retains certain rights in // this software. //============================================================================ -#ifndef vtk_m_cont_internal_FunctionInterface_h -#define vtk_m_cont_internal_FunctionInterface_h +#ifndef vtk_m_internal_FunctionInterface_h +#define vtk_m_internal_FunctionInterface_h #include #include @@ -753,4 +753,4 @@ private: #include -#endif //vtk_m_cont_internal_FunctionInterface_h +#endif //vtk_m_internal_FunctionInterface_h diff --git a/vtkm/internal/FunctionInterfaceDetailPost.h b/vtkm/internal/FunctionInterfaceDetailPost.h index 0d00b7e04..7adbf6197 100644 --- a/vtkm/internal/FunctionInterfaceDetailPost.h +++ b/vtkm/internal/FunctionInterfaceDetailPost.h @@ -20,10 +20,10 @@ // **** DO NOT EDIT THIS FILE!!! **** // This file is automatically generated by FunctionInterfaceDetailPost.h.in -#ifndef vtk_m_cont_internal_FunctionInterfaceDetailPost_h -#define vtk_m_cont_internal_FunctionInterfaceDetailPost_h +#ifndef vtk_m_internal_FunctionInterfaceDetailPost_h +#define vtk_m_internal_FunctionInterfaceDetailPost_h -#if !defined(vtk_m_cont_internal_FunctionInterface_h) && !defined(VTKM_TEST_HEADER_BUILD) +#if !defined(vtk_m_internal_FunctionInterface_h) && !defined(VTKM_TEST_HEADER_BUILD) #error FunctionInterfaceDetailPre.h must be included from FunctionInterface.h #endif @@ -644,4 +644,4 @@ make_FunctionInterface( } } // namespace vtkm::internal -#endif //vtk_m_cont_internal_FunctionInterfaceDetailPost_h +#endif //vtk_m_internal_FunctionInterfaceDetailPost_h diff --git a/vtkm/internal/FunctionInterfaceDetailPost.h.in b/vtkm/internal/FunctionInterfaceDetailPost.h.in index 71ab593b3..19a9e06ef 100644 --- a/vtkm/internal/FunctionInterfaceDetailPost.h.in +++ b/vtkm/internal/FunctionInterfaceDetailPost.h.in @@ -32,10 +32,10 @@ $# Ignore the following comment. It is meant for the generated file. // **** DO NOT EDIT THIS FILE!!! **** // This file is automatically generated by FunctionInterfaceDetailPost.h.in -#ifndef vtk_m_cont_internal_FunctionInterfaceDetailPost_h -#define vtk_m_cont_internal_FunctionInterfaceDetailPost_h +#ifndef vtk_m_internal_FunctionInterfaceDetailPost_h +#define vtk_m_internal_FunctionInterfaceDetailPost_h -#if !defined(vtk_m_cont_internal_FunctionInterface_h) && !defined(VTKM_TEST_HEADER_BUILD) +#if !defined(vtk_m_internal_FunctionInterface_h) && !defined(VTKM_TEST_HEADER_BUILD) #error FunctionInterfaceDetailPre.h must be included from FunctionInterface.h #endif @@ -139,4 +139,4 @@ $endfor\ } } // namespace vtkm::internal -#endif //vtk_m_cont_internal_FunctionInterfaceDetailPost_h +#endif //vtk_m_internal_FunctionInterfaceDetailPost_h diff --git a/vtkm/internal/FunctionInterfaceDetailPre.h b/vtkm/internal/FunctionInterfaceDetailPre.h index 3abda47cd..69fefc2bc 100644 --- a/vtkm/internal/FunctionInterfaceDetailPre.h +++ b/vtkm/internal/FunctionInterfaceDetailPre.h @@ -20,10 +20,10 @@ // **** DO NOT EDIT THIS FILE!!! **** // This file is automatically generated by FunctionInterfaceDetailPre.h.in -#ifndef vtk_m_cont_internal_FunctionInterfaceDetailPre_h -#define vtk_m_cont_internal_FunctionInterfaceDetailPre_h +#ifndef vtk_m_internal_FunctionInterfaceDetailPre_h +#define vtk_m_internal_FunctionInterfaceDetailPre_h -#if !defined(vtk_m_cont_internal_FunctionInterface_h) && !defined(VTKM_TEST_HEADER_BUILD) +#if !defined(vtk_m_internal_FunctionInterface_h) && !defined(VTKM_TEST_HEADER_BUILD) #error FunctionInterfaceDetailPre.h must be included from FunctionInterface.h #endif @@ -3672,4 +3672,4 @@ void DoForEachExec( } } // namespace vtkm::internal -#endif //vtk_m_cont_internal_FunctionInterfaceDetailPre_h +#endif //vtk_m_internal_FunctionInterfaceDetailPre_h diff --git a/vtkm/internal/FunctionInterfaceDetailPre.h.in b/vtkm/internal/FunctionInterfaceDetailPre.h.in index c8a22d054..9665d6683 100644 --- a/vtkm/internal/FunctionInterfaceDetailPre.h.in +++ b/vtkm/internal/FunctionInterfaceDetailPre.h.in @@ -32,10 +32,10 @@ $# Ignore the following comment. It is meant for the generated file. // **** DO NOT EDIT THIS FILE!!! **** // This file is automatically generated by FunctionInterfaceDetailPre.h.in -#ifndef vtk_m_cont_internal_FunctionInterfaceDetailPre_h -#define vtk_m_cont_internal_FunctionInterfaceDetailPre_h +#ifndef vtk_m_internal_FunctionInterfaceDetailPre_h +#define vtk_m_internal_FunctionInterfaceDetailPre_h -#if !defined(vtk_m_cont_internal_FunctionInterface_h) && !defined(VTKM_TEST_HEADER_BUILD) +#if !defined(vtk_m_internal_FunctionInterface_h) && !defined(VTKM_TEST_HEADER_BUILD) #error FunctionInterfaceDetailPre.h must be included from FunctionInterface.h #endif @@ -269,4 +269,4 @@ $endfor\ } } // namespace vtkm::internal -#endif //vtk_m_cont_internal_FunctionInterfaceDetailPre_h +#endif //vtk_m_internal_FunctionInterfaceDetailPre_h