Skip to content
Snippets Groups Projects
Commit 8dbb0233 authored by Jonathan Roelofs's avatar Jonathan Roelofs
Browse files

[scan-build] Make scan-build work whether it's installed or not

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253074 91177308-0d34-0410-b5e6-96231b3b80d8
parent dcd125fd
No related branches found
No related tags found
No related merge requests found
Showing
with 28 additions and 21 deletions
...@@ -32,11 +32,11 @@ if(CLANG_INSTALL_SCANBUILD) ...@@ -32,11 +32,11 @@ if(CLANG_INSTALL_SCANBUILD)
COMMAND ${CMAKE_COMMAND} -E make_directory COMMAND ${CMAKE_COMMAND} -E make_directory
${CMAKE_BINARY_DIR}/bin ${CMAKE_BINARY_DIR}/bin
COMMAND ${CMAKE_COMMAND} -E copy COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/${BinFile} ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile}
${CMAKE_BINARY_DIR}/bin/ ${CMAKE_BINARY_DIR}/bin/
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${BinFile}) DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile}) list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
install(PROGRAMS ${BinFile} DESTINATION bin) install(PROGRAMS bin/${BinFile} DESTINATION bin)
endforeach() endforeach()
foreach(LibexecFile ${LibexecFiles}) foreach(LibexecFile ${LibexecFiles})
...@@ -44,11 +44,11 @@ if(CLANG_INSTALL_SCANBUILD) ...@@ -44,11 +44,11 @@ if(CLANG_INSTALL_SCANBUILD)
COMMAND ${CMAKE_COMMAND} -E make_directory COMMAND ${CMAKE_COMMAND} -E make_directory
${CMAKE_BINARY_DIR}/libexec ${CMAKE_BINARY_DIR}/libexec
COMMAND ${CMAKE_COMMAND} -E copy COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/${LibexecFile} ${CMAKE_CURRENT_SOURCE_DIR}/libexec/${LibexecFile}
${CMAKE_BINARY_DIR}/libexec/ ${CMAKE_BINARY_DIR}/libexec/
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${LibexecFile}) DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libexec/${LibexecFile})
list(APPEND Depends ${CMAKE_BINARY_DIR}/libexec/${LibexecFile}) list(APPEND Depends ${CMAKE_BINARY_DIR}/libexec/${LibexecFile})
install(PROGRAMS ${LibexecFile} DESTINATION libexec) install(PROGRAMS libexec/${LibexecFile} DESTINATION libexec)
endforeach() endforeach()
foreach(ManPage ${ManPages}) foreach(ManPage ${ManPages})
...@@ -56,11 +56,11 @@ if(CLANG_INSTALL_SCANBUILD) ...@@ -56,11 +56,11 @@ if(CLANG_INSTALL_SCANBUILD)
COMMAND ${CMAKE_COMMAND} -E make_directory COMMAND ${CMAKE_COMMAND} -E make_directory
${CMAKE_BINARY_DIR}/share/man/man1 ${CMAKE_BINARY_DIR}/share/man/man1
COMMAND ${CMAKE_COMMAND} -E copy COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/${ManPage} ${CMAKE_CURRENT_SOURCE_DIR}/man/${ManPage}
${CMAKE_BINARY_DIR}/share/man/man1/ ${CMAKE_BINARY_DIR}/share/man/man1/
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${ManPage}) DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/man/${ManPage})
list(APPEND Depends ${CMAKE_BINARY_DIR}/share/man/man1/${ManPage}) list(APPEND Depends ${CMAKE_BINARY_DIR}/share/man/man1/${ManPage})
install(PROGRAMS ${ManPage} DESTINATION share/man/man1) install(PROGRAMS man/${ManPage} DESTINATION share/man/man1)
endforeach() endforeach()
foreach(ShareFile ${ShareFiles}) foreach(ShareFile ${ShareFiles})
...@@ -68,11 +68,11 @@ if(CLANG_INSTALL_SCANBUILD) ...@@ -68,11 +68,11 @@ if(CLANG_INSTALL_SCANBUILD)
COMMAND ${CMAKE_COMMAND} -E make_directory COMMAND ${CMAKE_COMMAND} -E make_directory
${CMAKE_BINARY_DIR}/share/scan-build ${CMAKE_BINARY_DIR}/share/scan-build
COMMAND ${CMAKE_COMMAND} -E copy COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/share/${ShareFile} ${CMAKE_CURRENT_SOURCE_DIR}/share/scan-build/${ShareFile}
${CMAKE_BINARY_DIR}/share/scan-build/ ${CMAKE_BINARY_DIR}/share/scan-build/
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/${ShareFile}) DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/scan-build/${ShareFile})
list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-build/${ShareFile}) list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-build/${ShareFile})
install(FILES share/${ShareFile} DESTINATION share/scan-build) install(FILES share/scan-build/${ShareFile} DESTINATION share/scan-build)
endforeach() endforeach()
add_custom_target(scan-build ALL DEPENDS ${Depends}) add_custom_target(scan-build ALL DEPENDS ${Depends})
......
...@@ -33,18 +33,18 @@ endif ...@@ -33,18 +33,18 @@ endif
all:: $(InstallTargets) all:: $(InstallTargets)
$(ToolDir)/%: % Makefile $(ToolDir)/.dir $(ToolDir)/%: bin/% Makefile $(ToolDir)/.dir
$(Echo) "Copying $(notdir $<) to the 'bin' directory..." $(Echo) "Copying $(notdir $<) to the 'bin' directory..."
$(Verb)cp $< $@ $(Verb)cp $< $@
$(Verb)chmod +x $@ $(Verb)chmod +x $@
$(LibexecDir)/%: % Makefile $(LibexecDir)/.dir $(LibexecDir)/%: libexec/% Makefile $(LibexecDir)/.dir
$(Echo) "Copying $(notdir $<) to the 'libexec' directory..." $(Echo) "Copying $(notdir $<) to the 'libexec' directory..."
$(Verb)cp $< $@ $(Verb)cp $< $@
$(Verb)chmod +x $@ $(Verb)chmod +x $@
$(ShareDir)/man/man1/%: % Makefile $(ShareDir)/man/man1/.dir $(ShareDir)/man/man1/%: man/% Makefile $(ShareDir)/man/man1/.dir
$(Echo) "Copying $(notdir $<) to the 'share' directory..." $(Echo) "Copying $(notdir $<) to the 'man' directory..."
$(Verb)cp $< $@ $(Verb)cp $< $@
$(ShareDir)/scan-build/%: share/% Makefile $(ShareDir)/scan-build/.dir $(ShareDir)/scan-build/%: share/% Makefile $(ShareDir)/scan-build/.dir
......
...@@ -1818,6 +1818,7 @@ if (defined $Options{OutputFormat}) { ...@@ -1818,6 +1818,7 @@ if (defined $Options{OutputFormat}) {
Diag "Viewing analysis results in '$Options{OutputDir}' using scan-view.\n"; Diag "Viewing analysis results in '$Options{OutputDir}' using scan-view.\n";
my $ScanView = Cwd::realpath("$RealBin/scan-view"); my $ScanView = Cwd::realpath("$RealBin/scan-view");
if (! -x $ScanView) { $ScanView = "scan-view"; } if (! -x $ScanView) { $ScanView = "scan-view"; }
if (! -x $ScanView) { $ScanView = Cwd::realpath("$RealBin/../../scan-view/bin/scan-view"); }
exec $ScanView, "$Options{OutputDir}"; exec $ScanView, "$Options{OutputDir}";
} }
......
File moved
...@@ -17,11 +17,11 @@ if(CLANG_INSTALL_SCANVIEW) ...@@ -17,11 +17,11 @@ if(CLANG_INSTALL_SCANVIEW)
COMMAND ${CMAKE_COMMAND} -E make_directory COMMAND ${CMAKE_COMMAND} -E make_directory
${CMAKE_BINARY_DIR}/bin ${CMAKE_BINARY_DIR}/bin
COMMAND ${CMAKE_COMMAND} -E copy COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/${BinFile} ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile}
${CMAKE_BINARY_DIR}/bin/ ${CMAKE_BINARY_DIR}/bin/
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${BinFile}) DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile}) list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
install(PROGRAMS ${BinFile} DESTINATION bin) install(PROGRAMS bin/${BinFile} DESTINATION bin)
endforeach() endforeach()
foreach(ShareFile ${ShareFiles}) foreach(ShareFile ${ShareFiles})
......
...@@ -26,7 +26,7 @@ endif ...@@ -26,7 +26,7 @@ endif
all:: $(InstallTargets) all:: $(InstallTargets)
$(ToolDir)/%: % Makefile $(ToolDir)/.dir $(ToolDir)/%: bin/% Makefile $(ToolDir)/.dir
$(Echo) "Copying $(notdir $<) to the 'bin' directory..." $(Echo) "Copying $(notdir $<) to the 'bin' directory..."
$(Verb)cp $< $@ $(Verb)cp $< $@
$(Verb)chmod +x $@ $(Verb)chmod +x $@
......
...@@ -56,7 +56,13 @@ def start_browser(port, options): ...@@ -56,7 +56,13 @@ def start_browser(port, options):
webbrowser.open(url) webbrowser.open(url)
def run(port, options, root): def run(port, options, root):
sys.path.append(os.path.dirname(__file__) + "/../share/scan-view") # Prefer to look relative to the installed binary
share = os.path.dirname(__file__) + "/../share/scan-view"
if not os.path.isdir(share):
# Otherwise look relative to the source
share = os.path.dirname(__file__) + "/../../scan-view/share"
sys.path.append(share)
import ScanView import ScanView
try: try:
print 'Starting scan-view at: http://%s:%d'%(options.host, print 'Starting scan-view at: http://%s:%d'%(options.host,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment