<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Folks,<div class=""><br class=""></div><div class="">It looks like nobody is strongly objected to this, and a bunch of people would be happy with making those changes. Some concerns about scope and feasibility have been raised, however I believe tackling those concerns is just a matter of laying out the steps more concretely.</div><div class=""><br class=""></div><div class="">So unless someone raises a voice here, I'll start exploring how we can make the changes I explained incrementally. I'll post again to the list with a rough plan of how I envision things, and hopefully a few patches to accompany that. We can then have a more concrete discussion that's productive for everyone!</div><div class=""><br class=""></div><div class="">Cheers,</div><div class="">Louis<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Jun 18, 2020, at 13:57, Louis Dionne via libcxx-dev <<a href="mailto:libcxx-dev@lists.llvm.org" class="">libcxx-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="">Hi folks,</div><div class=""><br class=""></div><div class="">Building any LLVM project currently requires invoking CMake inside <monorepo-root>/llvm, while setting the projects to enable in the LLVM_ENABLE_PROJECTS variable. This has the downside that CMake processing for the LLVM subproject happens even when one doesn't really need or want it. It's also not great from a build hygiene perspective, as LLVM globally sets some flags and subprojects pick them up, when they don't really mean to. For example, see this workaround: <a href="https://github.com/llvm/llvm-project/blob/master/libcxx/CMakeLists.txt#L503-L507" class="">https://github.com/llvm/llvm-project/blob/master/libcxx/CMakeLists.txt#L503-L507</a>, where we need to account for some flags that might have been set globally by LLVM.</div><div class=""><br class=""></div><div class="">I'm not sure about other projects, however this is quite problematic for projects part of the C++ runtime (libc++/libc++abi/libunwind). Indeed, we often try to build those projects targetting not widely supported platforms, where the overall LLVM build doesn't work. For example, trying to use the LLVM_ENABLE_PROJECTS approach for building libc++ for Apple's DriverKit environment doesn't work, since it has a few unusual things that the LLVM build chokes on. However, building libc++ standalone works just fine because it has far fewer requirements. It's also not just an issue of working vs not working: because of global flag pollution, building libc++ standalone and as part of the rest of LLVM can result in slightly different flags being used, which could cause important and hard-to-diagnose issues.</div><div class=""><br class=""></div><div class="">Hence, I think we should introduce a way to build LLVM projects (or at least the runtimes) without going through <monorepo-root>/llvm/CMakeLists.txt. What I suggest is to have a top-level <monorepo-root>/CMakeLists.txt whose sole job is to include subprojects. We could also place basic LLVM-wide things like the check for the minimum CMake version there. More specifically, I would like to be able to do:</div><div class=""><br class=""></div><div class="">    $ cd <monorepo-root></div><div class="">    $ mkdir build</div><div class="">    $ (cd build && cmake <monorepo-root> -DLLVM_ENABLE_PROJECTS="<projects-to-enable>")</div><div class=""><br class=""></div><div class="">Pretty much the only difference with today is that you'd use `cmake <monorepo-root>` instead of `cmake <monorepo-root>/llvm`.</div><div class=""><br class=""></div><div class="">Like I said, this is a problem for the runtime projects, but I'm not sure about other projects. For the runtime projects, another option would be to only allow standalone builds. However, the runtime projects are often built in lockstep, and so running three CMake commands when one would suffice is both annoying and also an easy way to screw things up. Furthermore, the current standalone builds add complexity to the projects, because they require the ability to point to arbitrary headers/libraries from the other projects, when we really always want to point to the just-built ones.</div><div class=""><br class=""></div><div class="">Relationship with Petr Hosek's "Runtimes" build</div><div class="">---------------------------------------------------------------</div><div class="">What I'm proposing isn't a replacement for itl. The "Runtimes" build can be seen as a driver that sets up the individual libc++/libc++abi/libunwind builds with the just-built toolchain, and for the provided targets. That's really great, however it is built *on top of* the basic libc++/libc++abi/libunwind builds. So basically, after my proposal, the "Runtimes" build could simply build all elements from the runtime with a single CMake invocation, as opposed to multiple invocations.</div><div class=""><br class=""></div><div class="">Thoughts?</div><div class="">Louis</div><div class=""><br class=""></div></div>_______________________________________________<br class="">libcxx-dev mailing list<br class=""><a href="mailto:libcxx-dev@lists.llvm.org" class="">libcxx-dev@lists.llvm.org</a><br class="">https://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-dev<br class=""></div></blockquote></div><br class=""></div></body></html>