mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-21 20:45:53 -04:00
28 lines
1.1 KiB
Python
28 lines
1.1 KiB
Python
import os
|
|
|
|
def main():
|
|
from optparse import OptionParser, OptionGroup
|
|
parser = OptionParser("usage: %prog [options]")
|
|
parser.add_option("", "--source-root", dest="source_root", metavar="PATH",
|
|
help="Path to the LLVM source (inferred if not given)",
|
|
action="store", default=None)
|
|
(opts, args) = parser.parse_args()
|
|
|
|
# Determine the LLVM source path, if not given.
|
|
source_root = opts.source_root
|
|
if source_root:
|
|
if not os.path.exists(os.path.join(source_root, 'lib', 'VMCore',
|
|
'Function.cpp')):
|
|
parser.error('invalid LLVM source root: %r' % source_root)
|
|
else:
|
|
llvmbuild_path = os.path.dirname(__file__)
|
|
llvm_build_path = os.path.dirname(llvmbuild_path)
|
|
utils_path = os.path.dirname(llvm_build_path)
|
|
source_root = os.path.dirname(utils_path)
|
|
if not os.path.exists(os.path.join(source_root, 'lib', 'VMCore',
|
|
'Function.cpp')):
|
|
parser.error('unable to infer LLVM source root, please specify')
|
|
|
|
if __name__=='__main__':
|
|
main()
|