CMake : Move to more "modern cmake" use.
This change restructures our build scripts from
something based on global include directories to
something cmake is actually good at: propagating
build requirements from one build target to another.
So What does this diff change?
- PUBLIC/PRIVATE/INTERFACE options for the INC, INC_SYS and LIB
variables that are in most of our CMakeLists.txt files.
Cmake's documentation will shed more light on this
if you are interested but from a 5000 ft view these
are essentially the options:
PRIVATE - The build target, need this include/library to build
INTERFACE - Clients of this target need this include/library to build
PUBLIC - Both the build target and the clients of the library need
this include/library to build
when not specified PRIVATE is assumed for includes (same as before)
while INTERFACE is assumed for LIB (same as before, and virtually
always incorrect)
- A new build target bf_intern_atomic this is a header only library
Rather than sprinkling ../../../intern/atomic in all the INC variables
you can now just add PRIVATE bf_intern_atomic to the LIB section in
the CMakeLists.txt where you need it and cmake will take care the
include paths are set correctly.
- Properly configured build targets for bf_intern_guardedmalloc and
bf_blenlib
These were just low hanging fruit, and great demonstrations on what
changes will need to be made to a library to support this.
- Cleanup of INC variables for bf_intern_guardedmalloc and bf_blenlib
and bf_intern_atomic.
Upsides:
Easier dependency management, no need to fudge -DWITH_INTERNATIONAL in 46!! different CMakeLists. You can control it just from the CMakeLists for bf_blentranslation and have it propagate to any target that properly declares a dependency on it. we fixed -DWITH_INTERNATIONAL since then.
Better dependency management, we have been lazy and sloppy here, more than once if someone has issues, the fix is "Try a clean build!" Why does this solve it? We didn't tell the build system about implicit dependencies, and ended up with a build in a inconsistent state, count the number of libraries we have that have glog in their includes but not in their LIB variable, it is shockingly high, same for blenlib, same for guardedalloc, same for.....
It is a relatively unintrusive change, further improvements can be made incrementally rather than having to fix everything in one go
If we ever want to move to more shared libraries for parts of blender (guardedmalloc and clog are prime candidates for such an endeavor) having the dependencies properly expressed is essential.
Downsides:
Lower developer productivity, due to dependencies correctly being expressed (and no longer INTERFACE for every single lib) it's likely going to cause more/longer rebuilds, on the other hand you save time when you have to trouble shoot an inconsistent build and you just end up doing a clean and building all from scratch.
