[PATCH] D35377: [CMAKE] Speedup developer builds when passing LLVM_APPEND_VC_REV = OFF

don hinton via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 18 15:58:14 PDT 2017


On Tue, Jul 18, 2017 at 3:10 PM, Rafael Avila de Espindola <
rafael.espindola at gmail.com> wrote:

> Without this patch I get:
>
> % ninja bin/llvm-mc
> ninja: no work to do.
>
> But with it there is always
>
> % ninja bin/llvm-mc
> [4/1/1] Generating force_version_inc_check
>
> Is this really necessary?
>

I've fixed this when LLVM_APPEND_VC_REV = OFF, and toggling from ON -> OFF
and OFF -> ON works correctly.

It'll still do the force when LLVM_APPEND_VC_REV = ON, but I could remove
that too if you'd like.



>
> Cheers,
> Rafael
>
> don hinton via Phabricator <reviews at reviews.llvm.org> writes:
>
> > hintonda updated this revision to Diff 106963.
> > hintonda added a comment.
> >
> > Fix comments -- NFC.
> >
> >
> > https://reviews.llvm.org/D35377
> >
> > Files:
> >   cmake/modules/GenerateVersionFromCVS.cmake
> >   include/llvm/Support/CMakeLists.txt
> >
> >
> > Index: include/llvm/Support/CMakeLists.txt
> > ===================================================================
> > --- include/llvm/Support/CMakeLists.txt
> > +++ include/llvm/Support/CMakeLists.txt
> > @@ -9,7 +9,6 @@
> >  endfunction()
> >
> >  macro(find_first_existing_vc_file out_var path)
> > -  if ( LLVM_APPEND_VC_REV )
> >      find_program(git_executable NAMES git git.exe git.cmd)
> >      # Run from a subdirectory to force git to print an absolute path.
> >      execute_process(COMMAND ${git_executable} rev-parse --git-dir
> > @@ -30,7 +29,6 @@
> >          "${path}/.svn/entries" # SVN 1.6
> >        )
> >      endif()
> > -  endif()
> >  endmacro()
> >
> >  find_first_existing_vc_file(llvm_vc "${LLVM_MAIN_SRC_DIR}")
> > @@ -40,22 +38,21 @@
> >
> >  set(get_svn_script "${LLVM_CMAKE_PATH}/GenerateVersionFromCVS.cmake")
> >
> > -if(DEFINED llvm_vc)
> > -  # Create custom target to generate the VC revision include.
> > -  add_custom_command(OUTPUT "${version_inc}"
> > -    DEPENDS "${llvm_vc}" "${get_svn_script}"
> > -    COMMAND
> > -    ${CMAKE_COMMAND} "-DSOURCE_DIR=${LLVM_MAIN_SRC_DIR}"
> > -                     "-DNAME=LLVM_REVISION"
> > -                     "-DHEADER_FILE=${version_inc}"
> > -                     -P "${get_svn_script}")
> > -
> > -  # Mark the generated header as being generated.
> > -  set_source_files_properties("${version_inc}"
> > -    PROPERTIES GENERATED TRUE
> > -               HEADER_FILE_ONLY TRUE)
> > -else()
> > -  file(WRITE "${version_inc}" "")
> > -endif()
> > +add_custom_command(OUTPUT force_version_inc_check COMMAND
> ${CMAKE_COMMAND} -E echo_append)
> > +
> > +# Create custom target to generate the VC revision include.
> > +add_custom_command(OUTPUT "${version_inc}"
> > +  DEPENDS force_version_inc_check "${llvm_vc}" "${get_svn_script}"
> > +  COMMAND
> > +  ${CMAKE_COMMAND} "-DSOURCE_DIR=${LLVM_MAIN_SRC_DIR}"
> > +                   "-DLLVM_APPEND_VC_REV=${LLVM_APPEND_VC_REV}"
> > +                   "-DNAME=LLVM_REVISION"
> > +                   "-DHEADER_FILE=${version_inc}"
> > +                   -P "${get_svn_script}")
> > +
> > +# Mark the generated header as being generated.
> > +set_source_files_properties("${version_inc}"
> > +  PROPERTIES GENERATED TRUE
> > +             HEADER_FILE_ONLY TRUE)
> >
> >  add_custom_target(llvm_vcsrevision_h DEPENDS "${version_inc}")
> > Index: cmake/modules/GenerateVersionFromCVS.cmake
> > ===================================================================
> > --- cmake/modules/GenerateVersionFromCVS.cmake
> > +++ cmake/modules/GenerateVersionFromCVS.cmake
> > @@ -1,14 +1,16 @@
> >  # CMake project that writes Subversion revision information to a header.
> >  #
> >  # Input variables:
> > -#   SRC               - Source directory
> > -#   HEADER_FILE       - The header file to write
> > +#   SOURCE_DIR          - Source directory
> > +#   LLVM_APPEND_VC_REV  - Append vc info (ON/OFF)
> > +#   NAME                - Macro name to use
> > +#   HEADER_FILE         - The header file to write
> >  #
> >  # The output header will contain macros FIRST_REPOSITORY and
> FIRST_REVISION,
> >  # and SECOND_REPOSITORY and SECOND_REVISION if requested, where "FIRST"
> and
> >  # "SECOND" are substituted with the names specified in the input
> variables.
> >
> > -
> > +if (LLVM_APPEND_VC_REV)
> >
> >  # Chop off cmake/modules/GetSVN.cmake
> >  get_filename_component(LLVM_DIR "${CMAKE_SCRIPT_MODE_FILE}" PATH)
> > @@ -32,6 +34,11 @@
> >
> >  append_info(${NAME} "${SOURCE_DIR}")
> >
> > +else()
> > +  file(WRITE "${HEADER_FILE}.txt" "")
> > +endif()
> > +
> > +
> >  # Copy the file only if it has changed.
> >  execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
> >    "${HEADER_FILE}.txt" "${HEADER_FILE}")
> >
> >
> > Index: include/llvm/Support/CMakeLists.txt
> > ===================================================================
> > --- include/llvm/Support/CMakeLists.txt
> > +++ include/llvm/Support/CMakeLists.txt
> > @@ -9,7 +9,6 @@
> >  endfunction()
> >
> >  macro(find_first_existing_vc_file out_var path)
> > -  if ( LLVM_APPEND_VC_REV )
> >      find_program(git_executable NAMES git git.exe git.cmd)
> >      # Run from a subdirectory to force git to print an absolute path.
> >      execute_process(COMMAND ${git_executable} rev-parse --git-dir
> > @@ -30,7 +29,6 @@
> >          "${path}/.svn/entries" # SVN 1.6
> >        )
> >      endif()
> > -  endif()
> >  endmacro()
> >
> >  find_first_existing_vc_file(llvm_vc "${LLVM_MAIN_SRC_DIR}")
> > @@ -40,22 +38,21 @@
> >
> >  set(get_svn_script "${LLVM_CMAKE_PATH}/GenerateVersionFromCVS.cmake")
> >
> > -if(DEFINED llvm_vc)
> > -  # Create custom target to generate the VC revision include.
> > -  add_custom_command(OUTPUT "${version_inc}"
> > -    DEPENDS "${llvm_vc}" "${get_svn_script}"
> > -    COMMAND
> > -    ${CMAKE_COMMAND} "-DSOURCE_DIR=${LLVM_MAIN_SRC_DIR}"
> > -                     "-DNAME=LLVM_REVISION"
> > -                     "-DHEADER_FILE=${version_inc}"
> > -                     -P "${get_svn_script}")
> > -
> > -  # Mark the generated header as being generated.
> > -  set_source_files_properties("${version_inc}"
> > -    PROPERTIES GENERATED TRUE
> > -               HEADER_FILE_ONLY TRUE)
> > -else()
> > -  file(WRITE "${version_inc}" "")
> > -endif()
> > +add_custom_command(OUTPUT force_version_inc_check COMMAND
> ${CMAKE_COMMAND} -E echo_append)
> > +
> > +# Create custom target to generate the VC revision include.
> > +add_custom_command(OUTPUT "${version_inc}"
> > +  DEPENDS force_version_inc_check "${llvm_vc}" "${get_svn_script}"
> > +  COMMAND
> > +  ${CMAKE_COMMAND} "-DSOURCE_DIR=${LLVM_MAIN_SRC_DIR}"
> > +                   "-DLLVM_APPEND_VC_REV=${LLVM_APPEND_VC_REV}"
> > +                   "-DNAME=LLVM_REVISION"
> > +                   "-DHEADER_FILE=${version_inc}"
> > +                   -P "${get_svn_script}")
> > +
> > +# Mark the generated header as being generated.
> > +set_source_files_properties("${version_inc}"
> > +  PROPERTIES GENERATED TRUE
> > +             HEADER_FILE_ONLY TRUE)
> >
> >  add_custom_target(llvm_vcsrevision_h DEPENDS "${version_inc}")
> > Index: cmake/modules/GenerateVersionFromCVS.cmake
> > ===================================================================
> > --- cmake/modules/GenerateVersionFromCVS.cmake
> > +++ cmake/modules/GenerateVersionFromCVS.cmake
> > @@ -1,14 +1,16 @@
> >  # CMake project that writes Subversion revision information to a header.
> >  #
> >  # Input variables:
> > -#   SRC               - Source directory
> > -#   HEADER_FILE       - The header file to write
> > +#   SOURCE_DIR          - Source directory
> > +#   LLVM_APPEND_VC_REV  - Append vc info (ON/OFF)
> > +#   NAME                - Macro name to use
> > +#   HEADER_FILE         - The header file to write
> >  #
> >  # The output header will contain macros FIRST_REPOSITORY and
> FIRST_REVISION,
> >  # and SECOND_REPOSITORY and SECOND_REVISION if requested, where "FIRST"
> and
> >  # "SECOND" are substituted with the names specified in the input
> variables.
> >
> > -
> > +if (LLVM_APPEND_VC_REV)
> >
> >  # Chop off cmake/modules/GetSVN.cmake
> >  get_filename_component(LLVM_DIR "${CMAKE_SCRIPT_MODE_FILE}" PATH)
> > @@ -32,6 +34,11 @@
> >
> >  append_info(${NAME} "${SOURCE_DIR}")
> >
> > +else()
> > +  file(WRITE "${HEADER_FILE}.txt" "")
> > +endif()
> > +
> > +
> >  # Copy the file only if it has changed.
> >  execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
> >    "${HEADER_FILE}.txt" "${HEADER_FILE}")
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170718/b7276580/attachment.html>


More information about the llvm-commits mailing list