LLVM based project lib dependencies for CMake on windows

1k Views Asked by At

This has been asked here before but I couldn't find a solution which works for me. Sample CMakeLists.txt file for LLVM project - This was the original question.

However, there are a couple of issues I am facing when making a project with LLVM.

Platform: Windows 7 Compiler: MingW

1) Firstly, I am using the svn version of llvm which is currently at 3.1. Currently, Binaries for MingW are not present for llvm 3.0 too so I decided to go with the latest itself and build it with mingw. So although the build works fine, I cannot seem to find the llvm-config perl script in the bin folder. I tried searching the entire dir yet I can only find an llvm-config folder and a dependencies file.

2) I tried building llvm for Visual studio 2010 yet that didn't work with cmake so I had to use MingW.

3) Now, this is sequence in which I add libs to CMake - LLVMXCoreInfo

LLVMMipsAsmPrinter LLVMMipsCodeGen LLVMMipsInfo LLVMMBlazeAsmPrinter LLVMMBlazeCodeGen LLVMMBlazeInfo LLVMLinker LLVMipo LLVMInterpreter LLVMInstrumentation LLVMJIT LLVMExecutionEngine

LLVMMC LLVMBitWriter LLVMX86Disassembler LLVMX86AsmParser LLVMX86AsmPrinter LLVMX86CodeGen LLVMX86Info LLVMAsmParser LLVMARMAsmParser LLVMMCParser LLVMARMAsmPrinter LLVMARMCodeGen LLVMARMInfo LLVMArchive LLVMBitReader

LLVMSelectionDAG

LLVMAsmPrinter LLVMCodeGen LLVMScalarOpts LLVMInstCombine LLVMTransformUtils LLVMipa LLVMAnalysis LLVMTarget LLVMMC LLVMCore

LLVMSupport

imagehlp psapi m

4) However, adding InitializeNativeTarget(), starts giving me linking errors which I think come because of the dependencies not being in right order.

5) I want to use the llvm_map_components_to_libraries(REQ_LLVM_LIBRARIES jit native) and hence I added this to my CMakeLists.txt INCLUDE(cmake/LLVM-Config.cmake)

However, this doesn't work. CMake Error at cmake/LLVM-Config.cmake:141 (message): Library `jit' not found in list of llvm libraries.

Now, the question is really too long but I basically wanted to ask what is the best way to do this in CMake. Could someone post the entire thing (for windows). Also, is there a way to build it for VS 2010. I tried the instructions on CLang site but those gave me this error in CMake.

" string sub-command REGEX, mode MATCH needs at least 5 arguments total to command."

I really need some help figuring out how to get dependencies to work in llvm and for it to build with VS. I would really appreciate some help.

0

There are 0 best solutions below