On Wed, Mar 29, 2017 at 9:32 PM, Florent Castelli <[email protected]> wrote: > On 30/03/2017 03:54, Robert Dailey wrote: >> >> On Wed, Mar 29, 2017 at 8:18 PM, Florent Castelli >> <[email protected]> wrote: >>> >>> This is known as "super build". >>> Yes, this is exactly why I made my Boost CMake build scripts, which you >>> use >>> unless you changed your mind today :) >> >> You mean this? >> https://github.com/Orphis/boost-cmake >> >> It's on the drawing board, for sure. It's the best solution I've >> found. It's also part of the reason I'm asking this question to begin >> with. >> >> Although, this specific method of building boost doesn't use >> superbuild, it uses normal add_subdirectory() with target. > > It doesn't "super build" its dependencies, you have to provide them > externally, but it is a possible addition. > But it is designed to be part of a super build environment and is used as > such at some large companies shipping to millions of people. > >> >>> It can be done for other projects as well. Sometimes, they even provide >>> CMake build scripts you can use directly with "add_subdirectory()" so you >>> don't have to write CMake scripts or use "ExternalProject_Add()" (which >>> isn't all great since it doesn't propagate all your current project >>> settings). >> >> Long term, I'm thinking a project like hunter[1] would be the best >> choice. The problem with hunter is that it doesn't separate concerns >> between host machine and target host. Specifically, when cross >> compiling. >> >> All the superbuild commands assume linux command syntax, simply >> because I specified a toolchain utilizing android NDK. For this reason >> it requires a lot of TLC to get working. >> >> [1]: https://github.com/ruslo/hunter > > There are those issues and also ABI changing flags that can become an issue > as they aren't always propagated from what I can see. > >>> You can use ccache or its Windows variants to make it faster. But you >>> also >>> shouldn't need "ninja clean" most of the time. Possibly, you could just >>> clean a specific target "ninja -t clean foo". >>> If you declare all your dependencies properly, then you could just always >>> run "ninja" and the build will just be correct. >>> If your purpose is to see the compiler output again (to fix warnings), it >>> is >>> acceptable to clean and rebuild (with ccache it should be fast enough). >>> Personally, I just have a very long history in my terminal and scroll >>> back >>> or pipe the build content to a file to look at it later. Some IDEs will >>> also >>> record all the compilation output and make it available later (Xcode does >>> it), then it's less of an issue. >> >> Never used ccache before, what does it do? Also if even if you ninja >> -t to clean, it will also clean dependencies. So if I specify those >> in-project dependencies that actually build third party libs, those >> will be cleaned too. > > > It's a program you use to record compilation outputs and save them to a disk > cache. If you build a file again, instead of compiling it, it will just > fetch the outputs from the cache and return the same warnings. It's usually > a safe optimization in a build pipeline and is quite easy to use with CMake > and Ninja generator. > > It works well with GCC or Clang and there are some alternative versions for > the Microsoft compiler too.
At the end of the day, I've solved the Boost problem but I have many other libraries I still manually build: openssl, libpng, zlib, etc. It's as you said, maintaining build scripts for all of these will be challenging but I think that's the proper way to go in my specific situation (multi platform). It'll be less maintenance than rebuilding binaries 3x per each. Do you know how to set up the boost cmake project I linked on github to work with superbuild? And do you prefer your superbuild execution to happen during cmake generate (basically cmake invokes itself for the superbuild) or do you prefer a separate external run, independent of the normal one (basically 2x cmake invocations)? Do you know of similar projects for other libraries I mentioned? Could hand write my own, but seems better to piggyback on someone else's efforts. Thanks for your feedback! -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
