Autogenerate the shebang lines for tools/opt-viewer

Summary:
Since these files depend on the built python modules, they need to use
the right python binary to run them. So use configure_file
to set the right shebang line.

Patch By: cbiesinger (Christian Biesinger)

Reviewers: chandlerc, beanz, anemet

Reviewed By: anemet

Subscribers: compnerd, JDevlieghere, mgorny, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D65983

llvm-svn: 369486
This commit is contained in:
Chris Bieneman 2019-08-21 01:48:28 +00:00
parent a1004684f5
commit 91c7b0fa0a
6 changed files with 24 additions and 7 deletions

View File

@ -660,6 +660,8 @@ if( ${PYTHON_VERSION_STRING} VERSION_LESS 2.7 )
message(FATAL_ERROR "Python 2.7 or newer is required")
endif()
get_filename_component(PYTHON_BASENAME ${PYTHON_EXECUTABLE} NAME)
######
# LLVMBuild Integration
#

View File

@ -1,13 +1,28 @@
set (files
"optpmap.py"
"style.css")
set (generated_files
"opt-diff.py"
"opt-stats.py"
"opt-viewer.py"
"optpmap.py"
"optrecord.py"
"style.css")
"optrecord.py")
foreach (file ${generated_files})
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/${file}.in
${CMAKE_CURRENT_BINARY_DIR}/${file})
endforeach (file)
foreach (file ${files})
install(PROGRAMS ${file}
DESTINATION share/opt-viewer
COMPONENT opt-viewer)
endforeach (file)
foreach (file ${generated_files})
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${file}
DESTINATION share/opt-viewer
COMPONENT opt-viewer)
endforeach (file)

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env @PYTHON_BASENAME@
from __future__ import print_function

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env @PYTHON_BASENAME@
from __future__ import print_function

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env @PYTHON_BASENAME@
from __future__ import print_function

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env @PYTHON_BASENAME@
from __future__ import print_function