On 2 Feb 2014, at 17:42, NAKAMURA Takumi <geek4civic at gmail.com> wrote:>> 6) If you create a proper config file, then you can populate it with >> IMPORTED targets and use it in clang. IMPORTED targets record dependencies >> and usage requirements (when you start requiring CMake 2.8.9+ at least) >> properly. >> >> http://www.cmake.org/cmake/help/git-master/manual/cmake-buildsystem.7.html#imported-targets > > Most of us are building clang in llvm build tree. > Aka "standalone clang" could be supposed as w-i-p. > I think other projects could be good studies for external cmake build.Just to add, the ability to build clang against an installed LLVM tree would make it significantly easier for the FreeBSD LLVM and Clang ports to switch to using CMake. This would make us very happy, as our build infrastructure automatically uses Ninja by default for CMake ports, so we'd get a nice speedup on package builds. David
On Mon, Feb 3, 2014 at 6:56 AM, David Chisnall <David.Chisnall at cl.cam.ac.uk> wrote:> Just to add, the ability to build clang against an installed LLVM tree would make it significantly easier for the FreeBSD LLVM and Clang ports to switch to using CMake+1. This opens a can of worms, but one well worth opening IMHO because it affects, at least, compiler-rt, libcxx, polly, and lld. If clang is built against the installed llvm, then it begs the question, how should a build compose both clang and llvm? Some options: 1) Write a CMake file that invokes two CMake builds, the llvm build, and then the clang build. 2) Clang's CMakeLists.txt adds 'add_subdirectory(llvm)', and adds a dependency on its 'install' step and pings the target for its install directory. But can two builds call 'add_subdirectory(llvm)' in the same CMake build? Can the llvm install directory be different from the clang install directory? 3) Clang's CMakeLists.txt has an 'add_subdirectory(llvm)' but no install step. This suggests that it is somehow possible to build against /either/ the installed directory or llvm's binary directory. If so, how can we ensure clang doesn't add a dependency to a file that is unavailable in the final install directory? Stephen, I'd appreciate your expert opinion here. Can multiple independent customers of llvm be composed into a larger CMake build? Thanks, Greg
On 02/03/2014 03:35 PM, Greg Fitzgerald wrote:> how should a build compose both clang and llvm?For packagers the separate build could be handled by their dependency system. For developers or users building locally one could use the CMake ExternalProject module: http://www.cmake.org/cmake/help/v2.8.12/cmake.html#module:ExternalProject to create a "superbuild" project that builds LLVM and then builds Clang against that LLVM. This will all be much easier when the patches I proposed here: http://thread.gmane.org/gmane.comp.compilers.llvm.cvs/173517 are integrated. -Brad
Greg Fitzgerald wrote:> Stephen, I'd appreciate your expert opinion here. Can multiple > independent customers of llvm be composed into a larger CMake build?The first step is to commit the patches from Brad. After that, it might be possible to ask different, more simple questions. Thanks, Steve.