Repo directory layout

Hey all,
There seems to be two conventions for git repo directory layout.

The official docs suggest the following tree.
http://llvm.org/docs/GettingStarted.html#git-mirror

llvm (llvm repo)

→ tools

→ clang (clang repo)

→ lld (lld repo)

etc.

However various llvm-project repos, suggest a different layout:
https://github.com/llvm-project/llvm-project-20170507
https://github.com/chapuni/llvm-project-submodule

Also, the official SVN hints at a similar layout (although not strictly the same):
http://llvm.org/svn/llvm-project/

llvm-project
→ llvm (llvm repo)

→ clang (clang repo)

→ lld (lld repo)

etc.

It seems like the CMake files support both options.

So we would like to know which of them should be supported for the foreseeable future.
Thanks in advance, Liad.

The first layout is older, and the second is newer. Going forward, things are likely to move around. The second layout is more flexible because it doesn’t put any repo inside another repo, so I would recommend adopting it. At the very least, using it will put you in a good position to adapt to any future layout changes.

Reid Kleckner via llvm-dev <llvm-dev@lists.llvm.org> writes:

The first layout is older, and the second is newer. Going forward,
things are likely to move around. The second layout is more flexible
because it doesn't put any repo inside another repo, so I would
recommend adopting it. At the very least, using it will put you in a
good position to adapt to any future layout changes.

Note that I don't think the second layout supports having
debuginfo-tests at the same level as "llvm." It has to be in
llvm/projects. It would be nice to remove that restriction.

                         -David

via llvm-dev <llvm-dev@lists.llvm.org> writes:

Reid Kleckner via llvm-dev <llvm-dev@lists.llvm.org> writes:

The first layout is older, and the second is newer. Going forward,
things are likely to move around. The second layout is more flexible
because it doesn't put any repo inside another repo, so I would
recommend adopting it. At the very least, using it will put you in a
good position to adapt to any future layout changes.

Note that I don't think the second layout supports having
debuginfo-tests at the same level as "llvm." It has to be in
llvm/projects. It would be nice to remove that restriction.

Well, I take that back. It seems it is supported via
LLVM_ENABLE_PROJECTS. You also have to set
LLVM_EXTERNAL_DEBUGINFO_TESTS_SOURCE_DIR. Here's the current
description of that variable on the web page, which probably should be
updated:

LLVM_EXTERNAL_{CLANG,LLD,POLLY}_SOURCE_DIR:PATH
    These variables specify the path to the source directory for the
    external LLVM projects Clang, lld, and Polly, respectively, relative
    to the top-level source directory. If the in-tree subdirectory for
    an external project exists (e.g., llvm/tools/clang for Clang), then
    the corresponding variable will not be used. If the variable for an
    external project does not point to a valid path, then that project
    will not be built.

I have found that listing compiler-rt in LLVM_ENABLE_PROJECTS and
setting LLVM_EXTERNAL_COMPILER_RT_SOURCE_DIR also lets me build
compiler-rt checked out next to llvm.

In other words, the documentation limiting that variable to clang, ldd
and polly is not correct.

This is also confusing:

LLVM_EXTERNAL_PROJECTS:STRING
    Semicolon-separated list of additional external projects to build as
    part of llvm. For each project LLVM_EXTERNAL_<NAME>_SOURCE_DIR have
    to be specified with the path for the source code of the
    project. Example: -DLLVM_EXTERNAL_PROJECTS="Foo;Bar"
    -DLLVM_EXTERNAL_FOO_SOURCE_DIR=/src/foo
    -DLLVM_EXTERNAL_BAR_SOURCE_DIR=/src/bar.

What's the difference between that and LLVM_ENABLE_PROJECTS?

                                -David