José Fonseca | 836a9f0 | 2009-09-01 12:22:52 +0100 | [diff] [blame] | 1 | """llvm |
| 2 | |
| 3 | Tool-specific initialization for LLVM |
| 4 | |
| 5 | """ |
| 6 | |
| 7 | # |
| 8 | # Copyright (c) 2009 VMware, Inc. |
| 9 | # |
| 10 | # Permission is hereby granted, free of charge, to any person obtaining |
| 11 | # a copy of this software and associated documentation files (the |
| 12 | # "Software"), to deal in the Software without restriction, including |
| 13 | # without limitation the rights to use, copy, modify, merge, publish, |
| 14 | # distribute, sublicense, and/or sell copies of the Software, and to |
| 15 | # permit persons to whom the Software is furnished to do so, subject to |
| 16 | # the following conditions: |
| 17 | # |
| 18 | # The above copyright notice and this permission notice shall be included |
| 19 | # in all copies or substantial portions of the Software. |
| 20 | # |
| 21 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY |
| 22 | # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE |
| 23 | # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 24 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
| 25 | # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
| 26 | # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
| 27 | # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 28 | # |
| 29 | |
| 30 | import os |
| 31 | import os.path |
José Fonseca | 8edc6b0 | 2010-03-05 15:07:50 +0000 | [diff] [blame] | 32 | import re |
José Fonseca | bf48447 | 2009-10-22 19:11:48 +0100 | [diff] [blame] | 33 | import sys |
José Fonseca | 8edc6b0 | 2010-03-05 15:07:50 +0000 | [diff] [blame] | 34 | import distutils.version |
José Fonseca | 836a9f0 | 2009-09-01 12:22:52 +0100 | [diff] [blame] | 35 | |
José Fonseca | 836a9f0 | 2009-09-01 12:22:52 +0100 | [diff] [blame] | 36 | import SCons.Errors |
| 37 | import SCons.Util |
| 38 | |
| 39 | |
José Fonseca | 013ff2f | 2014-10-22 13:09:59 +0100 | [diff] [blame] | 40 | required_llvm_version = '3.3' |
José Fonseca | c0ef9a6 | 2014-05-08 13:32:07 +0100 | [diff] [blame] | 41 | |
| 42 | |
José Fonseca | 836a9f0 | 2009-09-01 12:22:52 +0100 | [diff] [blame] | 43 | def generate(env): |
José Fonseca | 601498a | 2010-11-01 13:30:22 +0000 | [diff] [blame] | 44 | env['llvm'] = False |
| 45 | |
José Fonseca | 836a9f0 | 2009-09-01 12:22:52 +0100 | [diff] [blame] | 46 | try: |
| 47 | llvm_dir = os.environ['LLVM'] |
| 48 | except KeyError: |
| 49 | # Do nothing -- use the system headers/libs |
José Fonseca | bf48447 | 2009-10-22 19:11:48 +0100 | [diff] [blame] | 50 | llvm_dir = None |
José Fonseca | 836a9f0 | 2009-09-01 12:22:52 +0100 | [diff] [blame] | 51 | else: |
| 52 | if not os.path.isdir(llvm_dir): |
| 53 | raise SCons.Errors.InternalError, "Specified LLVM directory not found" |
| 54 | |
| 55 | if env['debug']: |
| 56 | llvm_subdir = 'Debug' |
| 57 | else: |
| 58 | llvm_subdir = 'Release' |
| 59 | |
| 60 | llvm_bin_dir = os.path.join(llvm_dir, llvm_subdir, 'bin') |
| 61 | if not os.path.isdir(llvm_bin_dir): |
José Fonseca | 459ea00 | 2009-09-16 10:39:06 +0100 | [diff] [blame] | 62 | llvm_bin_dir = os.path.join(llvm_dir, 'bin') |
| 63 | if not os.path.isdir(llvm_bin_dir): |
| 64 | raise SCons.Errors.InternalError, "LLVM binary directory not found" |
José Fonseca | 836a9f0 | 2009-09-01 12:22:52 +0100 | [diff] [blame] | 65 | |
| 66 | env.PrependENVPath('PATH', llvm_bin_dir) |
| 67 | |
José Fonseca | 9e3728c | 2009-11-25 18:06:12 +0000 | [diff] [blame] | 68 | if env['platform'] == 'windows': |
José Fonseca | bf48447 | 2009-10-22 19:11:48 +0100 | [diff] [blame] | 69 | # XXX: There is no llvm-config on Windows, so assume a standard layout |
José Fonseca | 8edc6b0 | 2010-03-05 15:07:50 +0000 | [diff] [blame] | 70 | if llvm_dir is None: |
José Fonseca | ea532f0 | 2010-04-10 02:41:39 +0100 | [diff] [blame] | 71 | print 'scons: LLVM environment variable must be specified when building for windows' |
José Fonseca | 601498a | 2010-11-01 13:30:22 +0000 | [diff] [blame] | 72 | return |
José Fonseca | 8edc6b0 | 2010-03-05 15:07:50 +0000 | [diff] [blame] | 73 | |
| 74 | # Try to determine the LLVM version from llvm/Config/config.h |
Olivier Pena | b94a4e8 | 2015-04-27 10:23:58 +0000 | [diff] [blame] | 75 | llvm_config = os.path.join(llvm_dir, 'include/llvm/Config/llvm-config.h') |
José Fonseca | 8edc6b0 | 2010-03-05 15:07:50 +0000 | [diff] [blame] | 76 | if not os.path.exists(llvm_config): |
| 77 | print 'scons: could not find %s' % llvm_config |
José Fonseca | 601498a | 2010-11-01 13:30:22 +0000 | [diff] [blame] | 78 | return |
Olivier Pena | b94a4e8 | 2015-04-27 10:23:58 +0000 | [diff] [blame] | 79 | llvm_version_major_re = re.compile(r'^#define LLVM_VERSION_MAJOR ([0-9]+)') |
| 80 | llvm_version_minor_re = re.compile(r'^#define LLVM_VERSION_MINOR ([0-9]+)') |
José Fonseca | 8edc6b0 | 2010-03-05 15:07:50 +0000 | [diff] [blame] | 81 | llvm_version = None |
Olivier Pena | b94a4e8 | 2015-04-27 10:23:58 +0000 | [diff] [blame] | 82 | llvm_version_major = None |
| 83 | llvm_version_minor = None |
José Fonseca | 8edc6b0 | 2010-03-05 15:07:50 +0000 | [diff] [blame] | 84 | for line in open(llvm_config, 'rt'): |
Olivier Pena | b94a4e8 | 2015-04-27 10:23:58 +0000 | [diff] [blame] | 85 | mo = llvm_version_major_re.match(line) |
José Fonseca | 8edc6b0 | 2010-03-05 15:07:50 +0000 | [diff] [blame] | 86 | if mo: |
Olivier Pena | b94a4e8 | 2015-04-27 10:23:58 +0000 | [diff] [blame] | 87 | llvm_version_major = mo.group(1) |
| 88 | mo = llvm_version_minor_re.match(line) |
| 89 | if mo: |
| 90 | llvm_version_minor = mo.group(1) |
| 91 | if llvm_version_major is not None and llvm_version_minor is not None: |
| 92 | llvm_version = distutils.version.LooseVersion('%s.%s' % (llvm_version_major, llvm_version_minor)) |
| 93 | |
José Fonseca | 8edc6b0 | 2010-03-05 15:07:50 +0000 | [diff] [blame] | 94 | if llvm_version is None: |
| 95 | print 'scons: could not determine the LLVM version from %s' % llvm_config |
José Fonseca | 601498a | 2010-11-01 13:30:22 +0000 | [diff] [blame] | 96 | return |
José Fonseca | c0ef9a6 | 2014-05-08 13:32:07 +0100 | [diff] [blame] | 97 | if llvm_version < distutils.version.LooseVersion(required_llvm_version): |
| 98 | print 'scons: LLVM version %s found, but %s is required' % (llvm_version, required_llvm_version) |
| 99 | return |
José Fonseca | 8edc6b0 | 2010-03-05 15:07:50 +0000 | [diff] [blame] | 100 | |
| 101 | env.Prepend(CPPPATH = [os.path.join(llvm_dir, 'include')]) |
| 102 | env.AppendUnique(CPPDEFINES = [ |
José Fonseca | 8edc6b0 | 2010-03-05 15:07:50 +0000 | [diff] [blame] | 103 | 'HAVE_STDINT_H', |
| 104 | ]) |
| 105 | env.Prepend(LIBPATH = [os.path.join(llvm_dir, 'lib')]) |
Ben Boeckel | 58f51f0 | 2017-04-27 16:31:48 -0400 | [diff] [blame^] | 106 | # LIBS should match the output of `llvm-config --libs engine mcjit bitwriter x86asmprinter irreader` |
| 107 | if llvm_version >= distutils.version.LooseVersion('4.0'): |
| 108 | env.Prepend(LIBS = [ |
| 109 | 'LLVMX86Disassembler', 'LLVMX86AsmParser', |
| 110 | 'LLVMX86CodeGen', 'LLVMSelectionDAG', 'LLVMAsmPrinter', |
| 111 | 'LLVMDebugInfoCodeView', 'LLVMCodeGen', |
| 112 | 'LLVMScalarOpts', 'LLVMInstCombine', |
| 113 | 'LLVMTransformUtils', |
| 114 | 'LLVMBitWriter', 'LLVMX86Desc', |
| 115 | 'LLVMMCDisassembler', 'LLVMX86Info', |
| 116 | 'LLVMX86AsmPrinter', 'LLVMX86Utils', |
| 117 | 'LLVMMCJIT', 'LLVMExecutionEngine', 'LLVMTarget', |
| 118 | 'LLVMAnalysis', 'LLVMProfileData', |
| 119 | 'LLVMRuntimeDyld', 'LLVMObject', 'LLVMMCParser', |
| 120 | 'LLVMBitReader', 'LLVMMC', 'LLVMCore', |
| 121 | 'LLVMSupport', |
| 122 | 'LLVMIRReader', 'LLVMAsmParser', |
| 123 | 'LLVMDemangle', 'LLVMGlobalISel', 'LLVMDebugInfoMSF', |
| 124 | ]) |
| 125 | elif llvm_version >= distutils.version.LooseVersion('3.9'): |
George Kyriazis | 30ae2cb | 2016-11-09 16:35:48 -0600 | [diff] [blame] | 126 | env.Prepend(LIBS = [ |
| 127 | 'LLVMX86Disassembler', 'LLVMX86AsmParser', |
| 128 | 'LLVMX86CodeGen', 'LLVMSelectionDAG', 'LLVMAsmPrinter', |
| 129 | 'LLVMDebugInfoCodeView', 'LLVMCodeGen', |
| 130 | 'LLVMScalarOpts', 'LLVMInstCombine', |
| 131 | 'LLVMInstrumentation', 'LLVMTransformUtils', |
| 132 | 'LLVMBitWriter', 'LLVMX86Desc', |
| 133 | 'LLVMMCDisassembler', 'LLVMX86Info', |
| 134 | 'LLVMX86AsmPrinter', 'LLVMX86Utils', |
| 135 | 'LLVMMCJIT', 'LLVMExecutionEngine', 'LLVMTarget', |
| 136 | 'LLVMAnalysis', 'LLVMProfileData', |
| 137 | 'LLVMRuntimeDyld', 'LLVMObject', 'LLVMMCParser', |
| 138 | 'LLVMBitReader', 'LLVMMC', 'LLVMCore', |
| 139 | 'LLVMSupport', |
| 140 | 'LLVMIRReader', 'LLVMASMParser' |
| 141 | ]) |
| 142 | elif llvm_version >= distutils.version.LooseVersion('3.7'): |
Olivier Pena | a525601 | 2015-12-07 17:13:18 +0100 | [diff] [blame] | 143 | env.Prepend(LIBS = [ |
| 144 | 'LLVMBitWriter', 'LLVMX86Disassembler', 'LLVMX86AsmParser', |
| 145 | 'LLVMX86CodeGen', 'LLVMSelectionDAG', 'LLVMAsmPrinter', |
| 146 | 'LLVMCodeGen', 'LLVMScalarOpts', 'LLVMProfileData', |
| 147 | 'LLVMInstCombine', 'LLVMInstrumentation', 'LLVMTransformUtils', 'LLVMipa', |
| 148 | 'LLVMAnalysis', 'LLVMX86Desc', 'LLVMMCDisassembler', |
| 149 | 'LLVMX86Info', 'LLVMX86AsmPrinter', 'LLVMX86Utils', |
| 150 | 'LLVMMCJIT', 'LLVMTarget', 'LLVMExecutionEngine', |
| 151 | 'LLVMRuntimeDyld', 'LLVMObject', 'LLVMMCParser', |
| 152 | 'LLVMBitReader', 'LLVMMC', 'LLVMCore', 'LLVMSupport' |
| 153 | ]) |
| 154 | elif llvm_version >= distutils.version.LooseVersion('3.6'): |
Olivier Pena | b94a4e8 | 2015-04-27 10:23:58 +0000 | [diff] [blame] | 155 | env.Prepend(LIBS = [ |
| 156 | 'LLVMBitWriter', 'LLVMX86Disassembler', 'LLVMX86AsmParser', |
| 157 | 'LLVMX86CodeGen', 'LLVMSelectionDAG', 'LLVMAsmPrinter', |
| 158 | 'LLVMCodeGen', 'LLVMScalarOpts', 'LLVMProfileData', |
| 159 | 'LLVMInstCombine', 'LLVMTransformUtils', 'LLVMipa', |
| 160 | 'LLVMAnalysis', 'LLVMX86Desc', 'LLVMMCDisassembler', |
| 161 | 'LLVMX86Info', 'LLVMX86AsmPrinter', 'LLVMX86Utils', |
| 162 | 'LLVMMCJIT', 'LLVMTarget', 'LLVMExecutionEngine', |
| 163 | 'LLVMRuntimeDyld', 'LLVMObject', 'LLVMMCParser', |
| 164 | 'LLVMBitReader', 'LLVMMC', 'LLVMCore', 'LLVMSupport' |
| 165 | ]) |
| 166 | elif llvm_version >= distutils.version.LooseVersion('3.5'): |
Jose Fonseca | 5b941ce | 2015-02-03 10:16:50 +0000 | [diff] [blame] | 167 | env.Prepend(LIBS = [ |
Jose Fonseca | 0db4ef9 | 2015-05-28 16:55:10 +0100 | [diff] [blame] | 168 | 'LLVMMCDisassembler', |
Jose Fonseca | 5b941ce | 2015-02-03 10:16:50 +0000 | [diff] [blame] | 169 | 'LLVMBitWriter', 'LLVMMCJIT', 'LLVMRuntimeDyld', |
| 170 | 'LLVMX86Disassembler', 'LLVMX86AsmParser', 'LLVMX86CodeGen', |
| 171 | 'LLVMSelectionDAG', 'LLVMAsmPrinter', 'LLVMX86Desc', |
| 172 | 'LLVMObject', 'LLVMMCParser', 'LLVMBitReader', 'LLVMX86Info', |
| 173 | 'LLVMX86AsmPrinter', 'LLVMX86Utils', 'LLVMJIT', |
| 174 | 'LLVMExecutionEngine', 'LLVMCodeGen', 'LLVMScalarOpts', |
| 175 | 'LLVMInstCombine', 'LLVMTransformUtils', 'LLVMipa', |
| 176 | 'LLVMAnalysis', 'LLVMTarget', 'LLVMMC', 'LLVMCore', |
| 177 | 'LLVMSupport' |
| 178 | ]) |
| 179 | else: |
Keith Kriewall | efd8311 | 2013-02-28 15:40:02 +0000 | [diff] [blame] | 180 | env.Prepend(LIBS = [ |
Jose Fonseca | 0db4ef9 | 2015-05-28 16:55:10 +0100 | [diff] [blame] | 181 | 'LLVMMCDisassembler', |
Keith Kriewall | efd8311 | 2013-02-28 15:40:02 +0000 | [diff] [blame] | 182 | 'LLVMBitWriter', 'LLVMX86Disassembler', 'LLVMX86AsmParser', |
| 183 | 'LLVMX86CodeGen', 'LLVMX86Desc', 'LLVMSelectionDAG', |
| 184 | 'LLVMAsmPrinter', 'LLVMMCParser', 'LLVMX86AsmPrinter', |
José Fonseca | 2c02f34 | 2014-05-14 12:20:14 +0100 | [diff] [blame] | 185 | 'LLVMX86Utils', 'LLVMX86Info', 'LLVMMCJIT', 'LLVMJIT', |
Keith Kriewall | efd8311 | 2013-02-28 15:40:02 +0000 | [diff] [blame] | 186 | 'LLVMExecutionEngine', 'LLVMCodeGen', 'LLVMScalarOpts', |
| 187 | 'LLVMInstCombine', 'LLVMTransformUtils', 'LLVMipa', |
| 188 | 'LLVMAnalysis', 'LLVMTarget', 'LLVMMC', 'LLVMCore', |
| 189 | 'LLVMSupport', 'LLVMRuntimeDyld', 'LLVMObject' |
| 190 | ]) |
José Fonseca | 8edc6b0 | 2010-03-05 15:07:50 +0000 | [diff] [blame] | 191 | env.Append(LIBS = [ |
| 192 | 'imagehlp', |
| 193 | 'psapi', |
Brian Paul | 3d1af78 | 2011-08-25 15:14:37 -0600 | [diff] [blame] | 194 | 'shell32', |
| 195 | 'advapi32' |
José Fonseca | 8edc6b0 | 2010-03-05 15:07:50 +0000 | [diff] [blame] | 196 | ]) |
| 197 | if env['msvc']: |
| 198 | # Some of the LLVM C headers use the inline keyword without |
| 199 | # defining it. |
| 200 | env.Append(CPPDEFINES = [('inline', '__inline')]) |
Jose Fonseca | e518d97 | 2015-03-19 22:09:20 +0000 | [diff] [blame] | 201 | # Match some of the warning options from llvm/cmake/modules/HandleLLVMOptions.cmake |
| 202 | env.AppendUnique(CXXFLAGS = [ |
| 203 | '/wd4355', # 'this' : used in base member initializer list |
| 204 | '/wd4624', # 'derived class' : destructor could not be generated because a base class destructor is inaccessible |
| 205 | ]) |
José Fonseca | e3a3a53 | 2010-09-29 14:24:52 +0100 | [diff] [blame] | 206 | if env['build'] in ('debug', 'checked'): |
José Fonseca | 8edc6b0 | 2010-03-05 15:07:50 +0000 | [diff] [blame] | 207 | # LLVM libraries are static, build with /MT, and they |
| 208 | # automatically link agains LIBCMT. When we're doing a |
| 209 | # debug build we'll be linking against LIBCMTD, so disable |
| 210 | # that. |
| 211 | env.Append(LINKFLAGS = ['/nodefaultlib:LIBCMT']) |
José Fonseca | ea532f0 | 2010-04-10 02:41:39 +0100 | [diff] [blame] | 212 | else: |
Vinson Lee | f07da5a | 2016-11-22 17:01:35 -0800 | [diff] [blame] | 213 | llvm_config = os.environ.get('LLVM_CONFIG', 'llvm-config') |
| 214 | if not env.Detect(llvm_config): |
| 215 | print 'scons: %s script not found' % llvm_config |
José Fonseca | 601498a | 2010-11-01 13:30:22 +0000 | [diff] [blame] | 216 | return |
José Fonseca | ea532f0 | 2010-04-10 02:41:39 +0100 | [diff] [blame] | 217 | |
Vinson Lee | f07da5a | 2016-11-22 17:01:35 -0800 | [diff] [blame] | 218 | llvm_version = env.backtick('%s --version' % llvm_config).rstrip() |
José Fonseca | 19a6333 | 2010-03-06 09:18:15 +0000 | [diff] [blame] | 219 | llvm_version = distutils.version.LooseVersion(llvm_version) |
José Fonseca | 836a9f0 | 2009-09-01 12:22:52 +0100 | [diff] [blame] | 220 | |
José Fonseca | c0ef9a6 | 2014-05-08 13:32:07 +0100 | [diff] [blame] | 221 | if llvm_version < distutils.version.LooseVersion(required_llvm_version): |
| 222 | print 'scons: LLVM version %s found, but %s is required' % (llvm_version, required_llvm_version) |
| 223 | return |
| 224 | |
Vinson Lee | 79f48c9 | 2009-09-07 15:16:25 +0100 | [diff] [blame] | 225 | try: |
José Fonseca | acf8219 | 2011-07-11 15:36:40 +0100 | [diff] [blame] | 226 | # Treat --cppflags specially to prevent NDEBUG from disabling |
| 227 | # assertion failures in debug builds. |
Vinson Lee | f07da5a | 2016-11-22 17:01:35 -0800 | [diff] [blame] | 228 | cppflags = env.ParseFlags('!%s --cppflags' % llvm_config) |
José Fonseca | acf8219 | 2011-07-11 15:36:40 +0100 | [diff] [blame] | 229 | try: |
| 230 | cppflags['CPPDEFINES'].remove('NDEBUG') |
| 231 | except ValueError: |
| 232 | pass |
| 233 | env.MergeFlags(cppflags) |
| 234 | |
Alexander von Gluck IV | 9aad1ba | 2013-10-16 20:24:13 -0500 | [diff] [blame] | 235 | # Match llvm --fno-rtti flag |
Vinson Lee | f07da5a | 2016-11-22 17:01:35 -0800 | [diff] [blame] | 236 | cxxflags = env.backtick('%s --cxxflags' % llvm_config).split() |
Alexander von Gluck IV | 9aad1ba | 2013-10-16 20:24:13 -0500 | [diff] [blame] | 237 | if '-fno-rtti' in cxxflags: |
| 238 | env.Append(CXXFLAGS = ['-fno-rtti']) |
| 239 | |
George Kyriazis | 30ae2cb | 2016-11-09 16:35:48 -0600 | [diff] [blame] | 240 | components = ['engine', 'mcjit', 'bitwriter', 'x86asmprinter', 'mcdisassembler', 'irreader'] |
José Fonseca | 3469715 | 2012-07-13 18:09:30 +0100 | [diff] [blame] | 241 | |
Vinson Lee | f07da5a | 2016-11-22 17:01:35 -0800 | [diff] [blame] | 242 | env.ParseConfig('%s --libs ' % llvm_config + ' '.join(components)) |
| 243 | env.ParseConfig('%s --ldflags' % llvm_config) |
Vinson Lee | 35a3414 | 2013-12-19 15:55:28 -0800 | [diff] [blame] | 244 | if llvm_version >= distutils.version.LooseVersion('3.5'): |
Vinson Lee | f07da5a | 2016-11-22 17:01:35 -0800 | [diff] [blame] | 245 | env.ParseConfig('%s --system-libs' % llvm_config) |
Vinson Lee | f2d724c | 2014-03-01 18:31:07 -0800 | [diff] [blame] | 246 | env.Append(CXXFLAGS = ['-std=c++11']) |
Vinson Lee | 79f48c9 | 2009-09-07 15:16:25 +0100 | [diff] [blame] | 247 | except OSError: |
José Fonseca | ea532f0 | 2010-04-10 02:41:39 +0100 | [diff] [blame] | 248 | print 'scons: llvm-config version %s failed' % llvm_version |
José Fonseca | 601498a | 2010-11-01 13:30:22 +0000 | [diff] [blame] | 249 | return |
José Fonseca | 8edc6b0 | 2010-03-05 15:07:50 +0000 | [diff] [blame] | 250 | |
| 251 | assert llvm_version is not None |
José Fonseca | 601498a | 2010-11-01 13:30:22 +0000 | [diff] [blame] | 252 | env['llvm'] = True |
José Fonseca | 8edc6b0 | 2010-03-05 15:07:50 +0000 | [diff] [blame] | 253 | |
| 254 | print 'scons: Found LLVM version %s' % llvm_version |
José Fonseca | 8edc6b0 | 2010-03-05 15:07:50 +0000 | [diff] [blame] | 255 | env['LLVM_VERSION'] = llvm_version |
| 256 | |
| 257 | # Define HAVE_LLVM macro with the major/minor version number (e.g., 0x0206 for 2.6) |
| 258 | llvm_version_major = int(llvm_version.version[0]) |
| 259 | llvm_version_minor = int(llvm_version.version[1]) |
| 260 | llvm_version_hex = '0x%02x%02x' % (llvm_version_major, llvm_version_minor) |
| 261 | env.Prepend(CPPDEFINES = [('HAVE_LLVM', llvm_version_hex)]) |
José Fonseca | 836a9f0 | 2009-09-01 12:22:52 +0100 | [diff] [blame] | 262 | |
| 263 | def exists(env): |
| 264 | return True |
| 265 | |
| 266 | # vim:set ts=4 sw=4 et: |