r252474 - Create install targets for scan-build and scan-view

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 11 07:07:26 PST 2015


This change causes MSVC to have two new projects sitting at the root
of the solution: scan-build and scan-view, neither of which appear to
do anything. Are these projects required for IDEs? If they're
installation-only projects, I think the CMake should be guarded with
`if(NOT CMAKE_CONFIGURATION_TYPES)`.

~Aaron

On Mon, Nov 9, 2015 at 11:12 AM, Jonathan Roelofs via cfe-commits
<cfe-commits at lists.llvm.org> wrote:
> Author: jroelofs
> Date: Mon Nov  9 10:12:56 2015
> New Revision: 252474
>
> URL: http://llvm.org/viewvc/llvm-project?rev=252474&view=rev
> Log:
> Create install targets for scan-build and scan-view
>
> http://reviews.llvm.org/D14403
>
> Added:
>     cfe/trunk/tools/scan-build/CMakeLists.txt
>     cfe/trunk/tools/scan-build/Makefile
>     cfe/trunk/tools/scan-view/CMakeLists.txt
>     cfe/trunk/tools/scan-view/Makefile
> Modified:
>     cfe/trunk/tools/CMakeLists.txt
>     cfe/trunk/tools/Makefile
>     cfe/trunk/tools/scan-build/scan-build
>     cfe/trunk/tools/scan-view/Reporter.py
>     cfe/trunk/tools/scan-view/ScanView.py
>     cfe/trunk/www/analyzer/installation.html
>
> Modified: cfe/trunk/tools/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CMakeLists.txt?rev=252474&r1=252473&r2=252474&view=diff
> ==============================================================================
> --- cfe/trunk/tools/CMakeLists.txt (original)
> +++ cfe/trunk/tools/CMakeLists.txt Mon Nov  9 10:12:56 2015
> @@ -5,6 +5,8 @@ add_clang_subdirectory(driver)
>  add_clang_subdirectory(clang-format)
>  add_clang_subdirectory(clang-format-vs)
>  add_clang_subdirectory(clang-fuzzer)
> +add_clang_subdirectory(scan-build)
> +add_clang_subdirectory(scan-view)
>
>  add_clang_subdirectory(c-index-test)
>  add_clang_subdirectory(libclang)
>
> Modified: cfe/trunk/tools/Makefile
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/Makefile?rev=252474&r1=252473&r2=252474&view=diff
> ==============================================================================
> --- cfe/trunk/tools/Makefile (original)
> +++ cfe/trunk/tools/Makefile Mon Nov  9 10:12:56 2015
> @@ -15,7 +15,7 @@ DIRS :=
>  PARALLEL_DIRS := clang-format driver diagtool
>
>  ifeq ($(ENABLE_CLANG_STATIC_ANALYZER), 1)
> -  PARALLEL_DIRS += clang-check
> +  PARALLEL_DIRS += clang-check scan-build scan-view
>  endif
>
>  ifeq ($(ENABLE_CLANG_ARCMT), 1)
>
> Added: cfe/trunk/tools/scan-build/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build/CMakeLists.txt?rev=252474&view=auto
> ==============================================================================
> --- cfe/trunk/tools/scan-build/CMakeLists.txt (added)
> +++ cfe/trunk/tools/scan-build/CMakeLists.txt Mon Nov  9 10:12:56 2015
> @@ -0,0 +1,71 @@
> +add_custom_target(scan-build ALL)
> +
> +option(CLANG_INSTALL_SCANBUILD "Install the scan-build tool" ON)
> +
> +if (WIN32 AND NOT CYGWIN)
> +  set(BinFiles
> +        scan-build.bat)
> +  set(LibexecFiles
> +        ccc-analyzer.bat
> +        c++-analyzer.bat)
> +else()
> +  set(BinFiles
> +        scan-build)
> +  set(LibexecFiles
> +        ccc-analyzer
> +        c++-analyzer)
> +  if (APPLE)
> +    set(BinFiles ${BinFiles}
> +         set-xcode-analyzer)
> +  endif()
> +endif()
> +
> +set(ManPages
> +      scan-build.1)
> +
> +set(ResourceFiles
> +      scanview.css
> +      sorttable.js)
> +
> +
> +if(CLANG_INSTALL_SCANBUILD)
> +  foreach(BinFile ${BinFiles})
> +    add_custom_command(TARGET scan-build PRE_BUILD
> +                       COMMAND ${CMAKE_COMMAND} -E make_directory
> +                         ${CMAKE_BINARY_DIR}/bin
> +                       COMMAND ${CMAKE_COMMAND} -E copy
> +                         ${CMAKE_CURRENT_SOURCE_DIR}/${BinFile}
> +                         ${CMAKE_BINARY_DIR}/bin/)
> +    install(PROGRAMS ${BinFile} DESTINATION bin)
> +  endforeach()
> +
> +  foreach(LibexecFile ${LibexecFiles})
> +    add_custom_command(TARGET scan-build PRE_BUILD
> +                       COMMAND ${CMAKE_COMMAND} -E make_directory
> +                         ${CMAKE_BINARY_DIR}/libexec
> +                       COMMAND ${CMAKE_COMMAND} -E copy
> +                         ${CMAKE_CURRENT_SOURCE_DIR}/${LibexecFile}
> +                         ${CMAKE_BINARY_DIR}/libexec/)
> +    install(PROGRAMS ${LibexecFile} DESTINATION libexec)
> +  endforeach()
> +
> +  foreach(ManPage ${ManPages})
> +    add_custom_command(TARGET scan-build PRE_BUILD
> +                       COMMAND ${CMAKE_COMMAND} -E make_directory
> +                         ${CMAKE_BINARY_DIR}/share/man/man1
> +                       COMMAND ${CMAKE_COMMAND} -E copy
> +                         ${CMAKE_CURRENT_SOURCE_DIR}/${ManPage}
> +                         ${CMAKE_BINARY_DIR}/share/man/man1/)
> +    install(PROGRAMS scan-build.1 DESTINATION share/man/man1)
> +  endforeach()
> +
> +  foreach(ResourceFile ${ResourceFiles})
> +    add_custom_command(TARGET scan-build PRE_BUILD
> +                       COMMAND ${CMAKE_COMMAND} -E make_directory
> +                         ${CMAKE_BINARY_DIR}/bin
> +                       COMMAND ${CMAKE_COMMAND} -E copy
> +                         ${CMAKE_CURRENT_SOURCE_DIR}/${ResourceFile}
> +                         ${CMAKE_BINARY_DIR}/bin/)
> +    install(FILES ${ResourceFile} DESTINATION bin)
> +  endforeach()
> +endif()
>
> Added: cfe/trunk/tools/scan-build/Makefile
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build/Makefile?rev=252474&view=auto
> ==============================================================================
> --- cfe/trunk/tools/scan-build/Makefile (added)
> +++ cfe/trunk/tools/scan-build/Makefile Mon Nov  9 10:12:56 2015
> @@ -0,0 +1,53 @@
> +##===- tools/scan-build/Makefile ---------------------------*- Makefile -*-===##
> +#
> +#                     The LLVM Compiler Infrastructure
> +#
> +# This file is distributed under the University of Illinois Open Source
> +# License. See LICENSE.TXT for details.
> +#
> +##===----------------------------------------------------------------------===##
> +
> +CLANG_LEVEL := ../..
> +
> +include $(CLANG_LEVEL)/../../Makefile.config
> +include $(CLANG_LEVEL)/Makefile
> +
> +ifeq ($(HOST_OS),MingW)
> +  Suffix := .bat
> +endif
> +
> +CLANG_INSTALL_SCANBUILD ?= 1
> +
> +ifeq ($(CLANG_INSTALL_SCANBUILD), 1)
> +  InstallTargets := $(ToolDir)/scan-build$(Suffix) \
> +                    $(LibexecDir)/c++-analyzer$(Suffix) \
> +                    $(LibexecDir)/ccc-analyzer$(Suffix) \
> +                    $(ShareDir)/scan-build/scanview.css \
> +                    $(ShareDir)/scan-build/sorttable.js \
> +                    $(ShareDir)/man/man1/scan-build.1
> +
> +  ifeq ($(HOST_OS),Darwin)
> +    InstallTargets := $(InstallTargets) $(ToolDir)/set-xcode-analyzer
> +  endif
> +endif
> +
> +all:: $(InstallTargets)
> +
> +$(ToolDir)/%: % Makefile $(ToolDir)/.dir
> +       $(Echo) "Copying $(notdir $<) to the 'bin' directory..."
> +       $(Verb)cp $< $@
> +       $(Verb)chmod +x $@
> +
> +$(LibexecDir)/%: % Makefile $(LibexecDir)/.dir
> +       $(Echo) "Copying $(notdir $<) to the 'libexec' directory..."
> +       $(Verb)cp $< $@
> +       $(Verb)chmod +x $@
> +
> +$(ShareDir)/man/man1/%: % Makefile $(ShareDir)/man/man1/.dir
> +       $(Echo) "Copying $(notdir $<) to the 'share' directory..."
> +       $(Verb)cp $< $@
> +
> +$(ShareDir)/scan-build/%: % Makefile $(ShareDir)/scan-build/.dir
> +       $(Echo) "Copying $(notdir $<) to the 'share' directory..."
> +       $(Verb)cp $< $@
> +
>
> Modified: cfe/trunk/tools/scan-build/scan-build
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build/scan-build?rev=252474&r1=252473&r2=252474&view=diff
> ==============================================================================
> --- cfe/trunk/tools/scan-build/scan-build (original)
> +++ cfe/trunk/tools/scan-build/scan-build Mon Nov  9 10:12:56 2015
> @@ -1737,8 +1737,8 @@ $Options{OutputDir} = GetHTMLRunDir($Opt
>
>  # Determine the location of ccc-analyzer.
>  my $AbsRealBin = Cwd::realpath($RealBin);
> -my $Cmd = "$AbsRealBin/libexec/ccc-analyzer";
> -my $CmdCXX = "$AbsRealBin/libexec/c++-analyzer";
> +my $Cmd = "$AbsRealBin/../libexec/ccc-analyzer";
> +my $CmdCXX = "$AbsRealBin/../libexec/c++-analyzer";
>
>  # Portability: use less strict but portable check -e (file exists) instead of
>  # non-portable -x (file is executable). On some windows ports -x just checks
>
> Added: cfe/trunk/tools/scan-view/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-view/CMakeLists.txt?rev=252474&view=auto
> ==============================================================================
> --- cfe/trunk/tools/scan-view/CMakeLists.txt (added)
> +++ cfe/trunk/tools/scan-view/CMakeLists.txt Mon Nov  9 10:12:56 2015
> @@ -0,0 +1,33 @@
> +add_custom_target(scan-view ALL)
> +
> +option(CLANG_INSTALL_SCANVIEW "Install the scan-view tool" ON)
> +
> +set(BinFiles
> +      Reporter.py
> +      ScanView.py
> +      scan-view
> +      startfile.py)
> +
> +file(GLOB ResourceFiles Resources/*)
> +
> +if(CLANG_INSTALL_SCANVIEW)
> +  foreach(BinFile ${BinFiles})
> +    add_custom_command(TARGET scan-view PRE_BUILD
> +                       COMMAND ${CMAKE_COMMAND} -E make_directory
> +                         ${CMAKE_BINARY_DIR}/bin
> +                       COMMAND ${CMAKE_COMMAND} -E copy
> +                         ${CMAKE_CURRENT_SOURCE_DIR}/${BinFile}
> +                         ${CMAKE_BINARY_DIR}/bin/)
> +    install(PROGRAMS ${BinFile} DESTINATION bin)
> +  endforeach()
> +
> +  foreach(ResourceFile ${ResourceFiles})
> +    add_custom_command(TARGET scan-view PRE_BUILD
> +                       COMMAND ${CMAKE_COMMAND} -E make_directory
> +                         ${CMAKE_BINARY_DIR}/share/scan-view
> +                       COMMAND ${CMAKE_COMMAND} -E copy
> +                         ${ResourceFile}
> +                         ${CMAKE_BINARY_DIR}/share/scan-view/)
> +    install(FILES ${ResourceFile} DESTINATION share/scan-view)
> +  endforeach()
> +endif()
>
> Added: cfe/trunk/tools/scan-view/Makefile
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-view/Makefile?rev=252474&view=auto
> ==============================================================================
> --- cfe/trunk/tools/scan-view/Makefile (added)
> +++ cfe/trunk/tools/scan-view/Makefile Mon Nov  9 10:12:56 2015
> @@ -0,0 +1,37 @@
> +##===- tools/scan-view/Makefile ----------------------------*- Makefile -*-===##
> +#
> +#                     The LLVM Compiler Infrastructure
> +#
> +# This file is distributed under the University of Illinois Open Source
> +# License. See LICENSE.TXT for details.
> +#
> +##===----------------------------------------------------------------------===##
> +
> +CLANG_LEVEL := ../..
> +
> +include $(CLANG_LEVEL)/../../Makefile.config
> +include $(CLANG_LEVEL)/Makefile
> +
> +CLANG_INSTALL_SCANVIEW ?= 1
> +
> +ifeq ($(CLANG_INSTALL_SCANVIEW), 1)
> +  InstallTargets := $(ToolDir)/Reporter.py \
> +                    $(ToolDir)/ScanView.py \
> +                    $(ToolDir)/scan-view \
> +                    $(ToolDir)/startfile.py \
> +                    $(ShareDir)/scan-view/FileRadar.scpt \
> +                    $(ShareDir)/scan-view/GetRadarVersion.scpt \
> +                    $(ShareDir)/scan-view/bugcatcher.ico
> +endif
> +
> +all:: $(InstallTargets)
> +
> +$(ToolDir)/%: % Makefile $(ToolDir)/.dir
> +       $(Echo) "Copying $(notdir $<) to the 'bin' directory..."
> +       $(Verb)cp $< $@
> +       $(Verb)chmod +x $@
> +
> +$(ShareDir)/scan-view/%: Resources/% Makefile $(ShareDir)/scan-view/.dir
> +       $(Echo) "Copying $(notdir $<) to the 'share' directory..."
> +       $(Verb)cp $< $@
> +
>
> Modified: cfe/trunk/tools/scan-view/Reporter.py
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-view/Reporter.py?rev=252474&r1=252473&r2=252474&view=diff
> ==============================================================================
> --- cfe/trunk/tools/scan-view/Reporter.py (original)
> +++ cfe/trunk/tools/scan-view/Reporter.py Mon Nov  9 10:12:56 2015
> @@ -175,7 +175,7 @@ class RadarReporter:
>      @staticmethod
>      def isAvailable():
>          # FIXME: Find this .scpt better
> -        path = os.path.join(os.path.dirname(__file__),'Resources/GetRadarVersion.scpt')
> +        path = os.path.join(os.path.dirname(__file__),'../share/scan-view/GetRadarVersion.scpt')
>          try:
>            p = subprocess.Popen(['osascript',path],
>            stdout=subprocess.PIPE, stderr=subprocess.PIPE)
> @@ -206,7 +206,7 @@ class RadarReporter:
>          if not componentVersion.strip():
>              componentVersion = 'X'
>
> -        script = os.path.join(os.path.dirname(__file__),'Resources/FileRadar.scpt')
> +        script = os.path.join(os.path.dirname(__file__),'../share/scan-view/FileRadar.scpt')
>          args = ['osascript', script, component, componentVersion, classification, personID, report.title,
>                  report.description, diagnosis, config] + map(os.path.abspath, report.files)
>  #        print >>sys.stderr, args
>
> Modified: cfe/trunk/tools/scan-view/ScanView.py
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-view/ScanView.py?rev=252474&r1=252473&r2=252474&view=diff
> ==============================================================================
> --- cfe/trunk/tools/scan-view/ScanView.py (original)
> +++ cfe/trunk/tools/scan-view/ScanView.py Mon Nov  9 10:12:56 2015
> @@ -73,7 +73,7 @@ kReportReplacements.append((re.compile('
>  ###
>  # Other simple parameters
>
> -kResources = posixpath.join(posixpath.dirname(__file__), 'Resources')
> +kResources = posixpath.join(posixpath.dirname(__file__), '../share/scan-view')
>  kConfigPath = os.path.expanduser('~/.scanview.cfg')
>
>  ###
>
> Modified: cfe/trunk/www/analyzer/installation.html
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/www/analyzer/installation.html?rev=252474&r1=252473&r2=252474&view=diff
> ==============================================================================
> --- cfe/trunk/www/analyzer/installation.html (original)
> +++ cfe/trunk/www/analyzer/installation.html Mon Nov  9 10:12:56 2015
> @@ -100,11 +100,8 @@ binaries to the installation directory o
>  <li>The locations of the <tt>scan-build</tt> and <tt>scan-view</tt>
>  programs.
>
> -<p>Currently these are not installed using <tt>make install</tt>, and
> -are located in <tt>$(SRCDIR)/tools/clang/tools/scan-build</tt> and
> -<tt>$(SRCDIR)/tools/clang/tools/scan-view</tt> respectively (where
> -<tt>$(SRCDIR)</tt> is the root LLVM source directory).  These locations
> -are subject to change.</p></li>
> +<p>These are installed via <tt>make install</tt> into the bin directory
> +when clang is built.</p></li>
>
>  </ul>
>  </div>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


More information about the cfe-commits mailing list