Olaf Krzikalla
2009-Aug-28 12:43 UTC
[LLVMdev] 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 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
Óscar Fuentes
2009-Aug-28 13:21 UTC
[LLVMdev] Building an external lib with the LLVM build system
Olaf Krzikalla <Olaf.Krzikalla at 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. -- Óscar