Building an external lib with the LLVM build system

Hi @llvm,

what I have here is a library named clangAddons which is tightly coupled to clang and LLVM. This lib provides a single external function only which is then used by my actual application (a QT project). Of course the clangAddons lib needs to be compiled using the LLVM build infrastructure to get all the compiler flags right (you can see it as a lib similiar to clangAST aso.).
I'm now running in heavy trouble while organizing the project in a configureable way. In my intial solution the clangAddons lib resides in a sub-directory of my main project (the QT app) as it does in my SVN. However I'm not able to build from there since the line

PROJ_SRC_DIR := $(shell cd $(LLVM_SRC_ROOT)/$(patsubst $(PROJ_OBJ_ROOT)%,%,$(PROJ_OBJ_DIR)); $(PWD))

fails if LEVEL contains other things then multiple "../" OTOH I don't want to put the lib in llvm/tools as this would not only make the project checkout more difficult but also overcomplicates the sharing of some configuration variables (namely boost stuff).
How to do it the right way? How to set up a build system for an external lib based on LLVM?

Best regards

Olaf Krzikalla <Olaf.Krzikalla@tu-dresden.de> writes:

[snip]

How to do it the right way? How to set up a build system for an external
lib based on LLVM?

AFAIK the LLVM build framework is for LLVM subprojects. You have a
external application that uses LLVM. So build the library with your
project's makefile. If you need the compiler flags used for LLVM invoke
llvm-config. Likewise for libraries. Probably you'll need to teach your
makefile about the LLVM library and header locations.