Using 'llvm-build' for out-of-tree projects

Hi LLVM-folks,

is there a way to use the llvm-build tool for out-of-tree projects? Makefile.rules supposes llvm-build to be located in PROJ_SRC_ROOT and this does not hold for out-of-tree projects, the same applies to Makefile.llvmbuild that is searched for in PROJ_OBJ_ROOT. I think PROJ_SRC_ROOT should be replaced by LLVM_SRC_ROOT and PROJ_OBJ_ROOT should be replaced by LLVM_OBJ_ROOT, right?

Ciao, Fabian

Hi Fabian,

> is there a way to use the llvm-build tool for out-of-tree projects?

Makefile.rules supposes llvm-build to be located in PROJ_SRC_ROOT and this does
not hold for out-of-tree projects, the same applies to Makefile.llvmbuild that
is searched for in PROJ_OBJ_ROOT. I think PROJ_SRC_ROOT should be replaced by
LLVM_SRC_ROOT and PROJ_OBJ_ROOT should be replaced by LLVM_OBJ_ROOT, right?

for an out-of-tree build you can use llvm-config to get include paths and so on.
I don't think there is any point bothering with llvm-build for this case.

Ciao, Duncan.

CMake works nicely for out-of-tree projects. I have an optimiser plugin that builds this way. I'm not sure if it's fixed now, but the autoconf builds used to not install the CMake plugins, which was a problem if packagers decided to use autoconf.

David

P.S. Weren't we planning on removing the Make-based build system in the next few months a year ago?

Hi David,

for an out-of-tree build you can use llvm-config to get include paths and so on.
I don't think there is any point bothering with llvm-build for this case.

CMake works nicely for out-of-tree projects. I have an optimiser plugin that builds this way. I'm not sure if it's fixed now, but the autoconf builds used to not install the CMake plugins, which was a problem if packagers decided to use autoconf.

can you please post your project's cmake stuff somewhere, it could be helpful
for cmake weenies like me.

David

P.S. Weren't we planning on removing the Make-based build system in the next few months a year ago?

Yup, and I opened a bunch of bug reports for missing cmake features at that time
(eg: expensive checks) but I don't think anything happened.

Ciao, Duncan.

Duncan Sands <baldrick@free.fr> writes:

CMake works nicely for out-of-tree projects. I have an optimiser
plugin that builds this way. I'm not sure if it's fixed now, but the
autoconf builds used to not install the CMake plugins, which was a
problem if packagers decided to use autoconf.

can you please post your project's cmake stuff somewhere, it could be helpful
for cmake weenies like me.

This explains how to develop a pass out-of-source. Is that enough?

[snip]

Well, our out-of-tree project does not consist of a single pass only and we
already have already implemented autoconf- and cmake-based build systems
based on those of the LLVM. The problem is that these are not "identical"
(i.e. they diverge) and I hoped that llvm-build could help here. AFAIK,
llvm-build places a meta-meta-build-system on top of the autoconf and cmake
stuff and tries to unify them. Is this right/wrong?

Furthermore, the warnings that no LLVMBuild.txt-files are found annoys me
and I want to get rid f them.

Ciao, Fabian

It always lacks some important features, like building compiler-rt with just-built clang: http://llvm.org/bugs/show_bug.cgi?id=14109

-- Jean-Daniel

Jean-Daniel Dupas <devlists@shadowlab.org> writes:

P.S. Weren't we planning on removing the Make-based build system in
the next few months a year ago?

It always lacks some important features, like building compiler-rt
with just-built clang: http://llvm.org/bugs/show_bug.cgi?id=14109

The configure&make build works on more homogeneous environments than
CMake. Implementing the requirement you mention seems easy enough while
using toolchains where clang/clang++ works as a drop-in replacement for
the platform compiler (i.e. gcc/g++ on Linux). For the general case, it
looks quite tricky.

The feature can be implemented for the easy case (POSIX&gcc, which, most
likely, is what everybody uses) and reject it for the rest.

BTW, is compiler-rt integrated in the CMake LLVM/Clang build process, or
is it a separate step?

Jean-Daniel Dupas <devlists@shadowlab.org> writes:

>> P.S. Weren't we planning on removing the Make-based build system in
>> the next few months a year ago?
>
> It always lacks some important features, like building compiler-rt
> with just-built clang: http://llvm.org/bugs/show_bug.cgi?id=14109

Yeah, using just-built clang would probably be a good feature, but for now
we
(sanitizer devs) "can live with" using a host compiler for building runtime
libraries
and maintaining both Clang and gcc builds.

The configure&make build works on more homogeneous environments than
CMake. Implementing the requirement you mention seems easy enough while
using toolchains where clang/clang++ works as a drop-in replacement for
the platform compiler (i.e. gcc/g++ on Linux). For the general case, it
looks quite tricky.

The feature can be implemented for the easy case (POSIX&gcc, which, most
likely, is what everybody uses) and reject it for the rest.

BTW, is compiler-rt integrated in the CMake LLVM/Clang build process, or
is it a separate step?

It is integrated. Running "make", "make check-all" or "make install" in
your build
tree do compiler-rt related work as well. However, AFAIK there is little
CMake support
for building compiler-rt for various Apple platforms.