[LLVMdev] Building an external lib with the LLVM build system

Olaf Krzikalla
Fri, 28 Aug 2009 12:43:01 -0000

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
Technische Universitaet Dresden
Zentrum fuer Informationsdienste und Hochleistungsrechnen
Abteilung Verteiltes und Datenintensives Rechnen
Zellescher Weg 12, 01069 Dresden
Willersbau, Zimmer A105
Telefonnr.: +49 351 463-32442