Tuesday, June 3, 2014

How to build an LLVM pass using SCons

LLVM provides some nice documentation on how to build a simple pass using CMake, but if you want to build your project using SCons, this is not very useful. 

Luckily, there is an easy configuration tool "llvm-config" which gives you all the information you need to build against llvm.  Simply add the line
env=Environment()
env.ParseConfig("llvm-config-3.5 --cppflags --cxxflags")
to your SConstruct file, and it should handle all of the llvm compiler flags for you.