[LLVMdev] Embed LLVM/Clang in our project
Ashok Nalkund
ashoknn at qti.qualcomm.com
Sun Jan 20 23:08:51 PST 2013
On 1/19/2013 2:39 AM, Óscar Fuentes wrote:
> Ashok Nalkund <ashoknn at qti.qualcomm.com> writes:
>
>> We want to compile LLVM/Clang and use the resulting
>> headers/libraries in our project. But we compile it during out build
>> process. I can build LLVM/Clang by adding it to our cmakelists.txt but
>> when our code tries to use one of the headers
>> (clang/CodeGen/ModuleBuilder.h), its not found as it doesnt exist. If
>> I do a 'make install' in the llvm directory, then the file is
>> generated in the LLVM_INSTALL_PREFIX directory. Is the 'make install'
>> step necessary even though I'm compiling llvm along with my code?
>
> If you wish to use LLVM/Clang whitout installing it, you must add both
> the build output header path and the source header path (in this order)
> to your list of include paths, like this:
>
> include_directories( ${LLVM_BUILD_DIR}/include ${LLVM_SOURCE_DIR}/include )
>
> Replace LLVM_SOURCE_DIR/LLVM_BUILD_DIR with the respective directories.
> Same for Clang
Thanks for the response, it worked. I can now compile my code by adding
the additional include paths.
I was using the find_package(LLVM llvm/share/llvm/cmake) and
llvm_map_components_to_libraries(REQ_LLVM_LIBRARIES jit native) to get
the libraries to link against. This works well for the libLLVM*
libraries, but how do I implement similar find stuff for clang libraries?
TIA,
ashok
More information about the llvm-dev
mailing list