[Cmake-commits] CMake branch, next, updated. v2.8.8-2746-gdd550af

David Cole david.cole at kitware.com
Sat Apr 28 15:37:35 EDT 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  dd550af8461ccfb0f99dbccb3064b3cd97a2fa44 (commit)
       via  08db81e00807c1dfc6846e9b3228c54dfe37a67f (commit)
       via  d14c02434a51fa9066febf15e336362d3adefd4a (commit)
      from  07a1ffb00d466a52a13d6a270496099bb46acc78 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dd550af8461ccfb0f99dbccb3064b3cd97a2fa44
commit dd550af8461ccfb0f99dbccb3064b3cd97a2fa44
Merge: 07a1ffb 08db81e
Author:     David Cole <david.cole at kitware.com>
AuthorDate: Sat Apr 28 15:37:33 2012 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Sat Apr 28 15:37:33 2012 -0400

    Merge topic 'fix-12564-avoid-git-re-clones' into next
    
    08db81e ExternalProject: Avoid repeated git clone operations (#12564)
    d14c024 ExternalProject: Refactor repeated code into function (#12564)


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=08db81e00807c1dfc6846e9b3228c54dfe37a67f
commit 08db81e00807c1dfc6846e9b3228c54dfe37a67f
Author:     David Cole <david.cole at kitware.com>
AuthorDate: Sat Apr 28 11:40:12 2012 -0400
Commit:     David Cole <david.cole at kitware.com>
CommitDate: Sat Apr 28 15:02:17 2012 -0400

    ExternalProject: Avoid repeated git clone operations (#12564)
    
    By tracking a stamp file within the git clone script itself.
    
    Avoids a 2nd git clone operation after switching from Debug
    to Release builds in Visual Studio, or vice-versa.

diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 1bca18c..0353e45 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -252,12 +252,23 @@ define_property(DIRECTORY PROPERTY "EP_STEP_TARGETS" INHERITED
   )
 
 
-function(_ep_write_gitclone_script script_filename source_dir git_EXECUTABLE git_repository git_tag src_name work_dir)
+function(_ep_write_gitclone_script script_filename source_dir git_EXECUTABLE git_repository git_tag src_name work_dir gitclone_infofile gitclone_stampfile)
   file(WRITE ${script_filename}
 "if(\"${git_tag}\" STREQUAL \"\")
   message(FATAL_ERROR \"Tag for git checkout should not be empty.\")
 endif()
 
+set(run 0)
+
+if(\"${gitclone_infofile}\" IS_NEWER_THAN \"${gitclone_stampfile}\")
+  set(run 1)
+endif()
+
+if(NOT run)
+  message(STATUS \"Avoiding repeated git clone, stamp file is up to date: '${gitclone_stampfile}'\")
+  return()
+endif()
+
 execute_process(
   COMMAND \${CMAKE_COMMAND} -E remove_directory \"${source_dir}\"
   RESULT_VARIABLE error_code
@@ -302,6 +313,19 @@ if(error_code)
   message(FATAL_ERROR \"Failed to update submodules in: '${work_dir}/${src_name}'\")
 endif()
 
+# Complete success, update the script-last-run stamp file:
+#
+execute_process(
+  COMMAND \${CMAKE_COMMAND} -E copy
+    \"${gitclone_infofile}\"
+    \"${gitclone_stampfile}\"
+  WORKING_DIRECTORY \"${work_dir}/${src_name}\"
+  RESULT_VARIABLE error_code
+  )
+if(error_code)
+  message(FATAL_ERROR \"Failed to copy script-last-run stamp file: '${gitclone_stampfile}'\")
+endif()
+
 "
 )
 
@@ -1115,6 +1139,7 @@ function(_ep_add_download_command name)
     #
     _ep_write_gitclone_script(${tmp_dir}/${name}-gitclone.cmake ${source_dir}
       ${GIT_EXECUTABLE} ${git_repository} ${git_tag} ${src_name} ${work_dir}
+      ${stamp_dir}/${name}-gitinfo.txt ${stamp_dir}/${name}-gitclone-lastrun.txt
       )
     set(comment "Performing download step (git clone) for '${name}'")
     set(cmd ${CMAKE_COMMAND} -P ${tmp_dir}/${name}-gitclone.cmake)

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d14c02434a51fa9066febf15e336362d3adefd4a
commit d14c02434a51fa9066febf15e336362d3adefd4a
Author:     David Cole <david.cole at kitware.com>
AuthorDate: Thu Apr 26 15:26:53 2012 -0400
Commit:     David Cole <david.cole at kitware.com>
CommitDate: Sat Apr 28 14:54:04 2012 -0400

    ExternalProject: Refactor repeated code into function (#12564)
    
    Add "private/internal-use-only" function _ep_get_step_stampfile
    to get the name of the stamp file for a given step.
    
    The functionality provided by this commit should be identical
    to its parent commit.

diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 1997572..1bca18c 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -824,15 +824,23 @@ function(_ep_get_configuration_subdir_suffix suffix_var)
 endfunction(_ep_get_configuration_subdir_suffix)
 
 
-function(ExternalProject_Add_StepTargets name)
-  set(steps ${ARGN})
+function(_ep_get_step_stampfile name step stampfile_var)
+  ExternalProject_Get_Property(${name} stamp_dir)
 
   _ep_get_configuration_subdir_suffix(cfgdir)
-  ExternalProject_Get_Property(${name} stamp_dir)
+  set(stampfile "${stamp_dir}${cfgdir}/${name}-${step}")
+
+  set(${stampfile_var} "${stampfile}" PARENT_SCOPE)
+endfunction()
+
+
+function(ExternalProject_Add_StepTargets name)
+  set(steps ${ARGN})
 
   foreach(step ${steps})
+    _ep_get_step_stampfile(${name} ${step} stamp_file)
     add_custom_target(${name}-${step}
-      DEPENDS ${stamp_dir}${cfgdir}/${name}-${step})
+      DEPENDS ${stamp_file})
 
     # Depend on other external projects (target-level).
     get_property(deps TARGET ${name} PROPERTY _EP_DEPENDS)
@@ -845,23 +853,26 @@ endfunction(ExternalProject_Add_StepTargets)
 
 function(ExternalProject_Add_Step name step)
   set(cmf_dir ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles)
-  ExternalProject_Get_Property(${name} stamp_dir)
-
   _ep_get_configuration_subdir_suffix(cfgdir)
 
+  set(complete_stamp_file "${cmf_dir}${cfgdir}/${name}-complete")
+  _ep_get_step_stampfile(${name} ${step} stamp_file)
+
   add_custom_command(APPEND
-    OUTPUT ${cmf_dir}${cfgdir}/${name}-complete
-    DEPENDS ${stamp_dir}${cfgdir}/${name}-${step}
+    OUTPUT ${complete_stamp_file}
+    DEPENDS ${stamp_file}
     )
+
   _ep_parse_arguments(ExternalProject_Add_Step
-                       ${name} _EP_${step}_ "${ARGN}")
+                      ${name} _EP_${step}_ "${ARGN}")
 
   # Steps depending on this step.
   get_property(dependers TARGET ${name} PROPERTY _EP_${step}_DEPENDERS)
   foreach(depender IN LISTS dependers)
+    _ep_get_step_stampfile(${name} ${depender} depender_stamp_file)
     add_custom_command(APPEND
-      OUTPUT ${stamp_dir}${cfgdir}/${name}-${depender}
-      DEPENDS ${stamp_dir}${cfgdir}/${name}-${step}
+      OUTPUT ${depender_stamp_file}
+      DEPENDS ${stamp_file}
       )
   endforeach()
 
@@ -871,7 +882,8 @@ function(ExternalProject_Add_Step name step)
   # Dependencies on steps.
   get_property(dependees TARGET ${name} PROPERTY _EP_${step}_DEPENDEES)
   foreach(dependee IN LISTS dependees)
-    list(APPEND depends ${stamp_dir}${cfgdir}/${name}-${dependee})
+    _ep_get_step_stampfile(${name} ${dependee} dependee_stamp_file)
+    list(APPEND depends ${dependee_stamp_file})
   endforeach()
 
   # The command to run.
@@ -901,10 +913,10 @@ function(ExternalProject_Add_Step name step)
   # Run every time?
   get_property(always TARGET ${name} PROPERTY _EP_${step}_ALWAYS)
   if(always)
-    set_property(SOURCE ${stamp_dir}${cfgdir}/${name}-${step} PROPERTY SYMBOLIC 1)
+    set_property(SOURCE ${stamp_file} PROPERTY SYMBOLIC 1)
     set(touch)
   else()
-    set(touch ${CMAKE_COMMAND} -E touch ${stamp_dir}${cfgdir}/${name}-${step})
+    set(touch ${CMAKE_COMMAND} -E touch ${stamp_file})
   endif()
 
   # Wrap with log script?
@@ -914,7 +926,7 @@ function(ExternalProject_Add_Step name step)
   endif()
 
   add_custom_command(
-    OUTPUT ${stamp_dir}${cfgdir}/${name}-${step}
+    OUTPUT ${stamp_file}
     COMMENT ${comment}
     COMMAND ${command}
     COMMAND ${touch}
@@ -1283,14 +1295,12 @@ endfunction(_ep_add_patch_command)
 function(_ep_add_configure_command name)
   ExternalProject_Get_Property(${name} source_dir binary_dir tmp_dir)
 
-  _ep_get_configuration_subdir_suffix(cfgdir)
-
   # Depend on other external projects (file-level).
   set(file_deps)
   get_property(deps TARGET ${name} PROPERTY _EP_DEPENDS)
   foreach(dep IN LISTS deps)
-    get_property(dep_stamp_dir TARGET ${dep} PROPERTY _EP_STAMP_DIR)
-    list(APPEND file_deps ${dep_stamp_dir}${cfgdir}/${dep}-done)
+    _ep_get_step_stampfile(${dep} "done" done_stamp_file)
+    list(APPEND file_deps ${done_stamp_file})
   endforeach()
 
   get_property(cmd_set TARGET ${name} PROPERTY _EP_CONFIGURE_COMMAND SET)
@@ -1453,11 +1463,14 @@ function(ExternalProject_Add name)
 
   # Add a custom target for the external project.
   set(cmf_dir ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles)
-  add_custom_target(${name} ALL DEPENDS ${cmf_dir}${cfgdir}/${name}-complete)
+  set(complete_stamp_file "${cmf_dir}${cfgdir}/${name}-complete")
+
+  add_custom_target(${name} ALL DEPENDS ${complete_stamp_file})
   set_property(TARGET ${name} PROPERTY _EP_IS_EXTERNAL_PROJECT 1)
   _ep_parse_arguments(ExternalProject_Add ${name} _EP_ "${ARGN}")
   _ep_set_directories(${name})
-  ExternalProject_Get_Property(${name} stamp_dir)
+  _ep_get_step_stampfile(${name} "done" done_stamp_file)
+  _ep_get_step_stampfile(${name} "install" install_stamp_file)
 
   # The 'complete' step depends on all other steps and creates a
   # 'done' mark.  A dependent external project's 'configure' step
@@ -1468,19 +1481,18 @@ function(ExternalProject_Add name)
   # parallel builds.  However, the Ninja generator needs to see the entire
   # dependency graph, and can cope with custom commands belonging to
   # multiple targets, so we add the 'done' mark as an output for Ninja only.
-  set(complete_outputs ${cmf_dir}${cfgdir}/${name}-complete)
+  set(complete_outputs ${complete_stamp_file})
   if(${CMAKE_GENERATOR} MATCHES "Ninja")
-    set(complete_outputs
-        ${complete_outputs} ${stamp_dir}${cfgdir}/${name}-done)
+    set(complete_outputs ${complete_outputs} ${done_stamp_file})
   endif()
 
   add_custom_command(
     OUTPUT ${complete_outputs}
     COMMENT "Completed '${name}'"
     COMMAND ${CMAKE_COMMAND} -E make_directory ${cmf_dir}${cfgdir}
-    COMMAND ${CMAKE_COMMAND} -E touch ${cmf_dir}${cfgdir}/${name}-complete
-    COMMAND ${CMAKE_COMMAND} -E touch ${stamp_dir}${cfgdir}/${name}-done
-    DEPENDS ${stamp_dir}${cfgdir}/${name}-install
+    COMMAND ${CMAKE_COMMAND} -E touch ${complete_stamp_file}
+    COMMAND ${CMAKE_COMMAND} -E touch ${done_stamp_file}
+    DEPENDS ${install_stamp_file}
     VERBATIM
     )
 

-----------------------------------------------------------------------

Summary of changes:
 Modules/ExternalProject.cmake |   93 ++++++++++++++++++++++++++++------------
 1 files changed, 65 insertions(+), 28 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list