CMake: plumbing for modern CMake usage #107858

Merged
Ray molenkamp merged 8 commits from LazyDodo/blender:tmp_modern_cmake into main 2023-06-27 20:57:56 +02:00
Member

This is the minimal change required to start using modern CMake in the
blender build system. This change is designed to allow small
incremental changes to the build system rather than doing it in one
big bang which would be unmaintainable (for me)

The biggest functional change is, previously all libraries in the
LIB section of a blender_add_lib call had the INTERFACE scope,
which is rarely, if ever the correct scope. This diff changes this to
PRIVATE

Concrete implications of this diff :

The LIB, INC and INC_SYS sections of an blender_add_lib call
now allow scoping keywords (PUBLIC, PRIVATE, INTERFACE) to
declare the scope of the dependency.

Right now the only library using any modern cmake is
bf_intern_atomic which is an header only interface library that will
just advertise its include directories.

This allows us to clean up any CMakeLists.txt that adds
../../../intern/atomic to its INC section to remove it in INC by
adding a PRIVATE bf_intern_atomic to the LIB section.

This is the minimal change required to start using modern CMake in the blender build system. This change is designed to allow small incremental changes to the build system rather than doing it in one big bang which would be unmaintainable (for me) The biggest functional change is, previously all libraries in the `LIB` section of a `blender_add_lib` call had the `INTERFACE` scope, which is rarely, if ever the correct scope. This diff changes this to `PRIVATE` Concrete implications of this diff : The `LIB`, `INC` and `INC_SYS` sections of an `blender_add_lib` call now allow scoping keywords (`PUBLIC`, `PRIVATE,` `INTERFACE`) to declare the scope of the dependency. Right now the only library using any modern cmake is `bf_intern_atomic` which is an header only interface library that will just advertise its include directories. This allows us to clean up any `CMakeLists.txt` that adds `../../../intern/atomic` to its `INC` section to remove it in `INC` by adding a `PRIVATE bf_intern_atomic` to the `LIB` section.
Ray molenkamp added 1 commit 2023-05-12 02:09:23 +02:00
WIP: CMake: plumbing for modern CMake usage
All checks were successful
buildbot/vexp-code-patch-coordinator Build done.
52e565f6f3
This is the minimal change required to start using modern CMake in the
blender build system. Previous iterations of this patch did more work
like completely transitioning the guarded alloc and atomic libs to
modern cmake, this however came at a great cost of merge conflicts
and is one of the reasons this has dragged on for literally years now
as the time required for me to keep a patch in sync with main just isn't
there.

This change is designed to allow small incremental changes to the
build system rather than doing it in one big bang which would be
unmaintainable (for me)

The biggest functional change is, previously all libraries in the LIB
section of a `blender_add_test_lib` had the `INTERFACE` scope, which
is rarely, if ever the correct scope. This diff changes this to
`PRIVATE`

Concrete implications of this diff

Right now the only library using any modern cmake is `bf_intern_atomic`
which is an header only interface library that will just advertise its include
directories.

This allows us to clean up any CMakeLists.txt that adds `../../../intern/atomic`
to its `INC` section to remove it in `INC`, add a `PRIVATE bf_intern_atomic` to
`LIB`

Ideally when all targets are modern targets fudging things in `INC` will be a
thing of the past. This also means that all dependencies between targets will
be properly expressed at that time, since right now there are quite a few
occasions of questionable behaviour, ie compare the `INC` section of
`source\blender\editors\space_view3d\CMakeLists.txt` to its `LIB` section.
(not shaming `space_view3d` here, it's the rule rather than the exception)

Where to next

I'd like to land these core changes as soon as the bcon1 window for 4.0 opens
then do further incremental clean-ups with the obvious first choices being
the atomic and guardedalloc libraries.
Author
Member

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR107858) when ready.
Campbell Barton approved these changes 2023-05-12 03:44:22 +02:00
Campbell Barton left a comment
Owner

This all seems reasonable, if builds & tests pass, LGTM.

This all seems reasonable, if builds & tests pass, LGTM.
@ -506,0 +530,4 @@
)
blender_add_test_executable_impl(
"${name}"
True

*picky* typically all-caps TRUE / FALSE are used in CMake.

\*picky\* typically all-caps TRUE / FALSE are used in CMake.
Author
Member

That's not being picky, don't be shy with things like this, consistency IS worth having

That's not being picky, don't be shy with things like this, consistency IS worth having
Ray molenkamp added 1 commit 2023-05-12 14:48:15 +02:00
Ray molenkamp added 3 commits 2023-05-18 19:38:28 +02:00
CMake: allow scope keywords in INC section.
All checks were successful
buildbot/vexp-code-patch-coordinator Build done.
63383d8ad7
This will make it easier in the future for target to declare the
scope of their include paths
Ray molenkamp changed title from WIP: CMake: plumbing for modern CMake usage to CMake: plumbing for modern CMake usage 2023-05-18 20:00:21 +02:00
Author
Member

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR107858) when ready.
Ray molenkamp added 1 commit 2023-06-16 01:50:16 +02:00
Merge remote-tracking branch 'origin/main' into tmp_modern_cmake
All checks were successful
buildbot/vexp-code-patch-coordinator Build done.
2ce0e53897
Author
Member

@blender-bot build

@blender-bot build
Ray molenkamp added 1 commit 2023-06-19 22:33:17 +02:00
Merge branch 'main' into tmp_modern_cmake
All checks were successful
buildbot/vexp-code-patch-coordinator Build done.
66abb55043
Author
Member

@blender-bot build

@blender-bot build
Ray molenkamp added 1 commit 2023-06-27 19:42:58 +02:00
Merge branch 'main' into tmp_modern_cmake
All checks were successful
buildbot/vexp-code-patch-coordinator Build done.
e0d932d6d9
Author
Member

@blender-bot build

@blender-bot build
Ray molenkamp merged commit eff9e2f4ce into main 2023-06-27 20:57:56 +02:00
Ray molenkamp deleted branch tmp_modern_cmake 2023-06-27 20:57:57 +02:00
Member

This PR makes independently compiling much of blender impossible. Everything depends on everything else. If you need to track down a bug in your compiler environment that's making one or two files not compile, well, good luck with that. Enjoy spending the next week running clean builds. It should be reverted.

This PR makes independently compiling much of blender impossible. Everything depends on everything else. If you need to track down a bug in your compiler environment that's making one or two files not compile, well, good luck with that. Enjoy spending the next week running clean builds. It should be reverted.
Member

Fix in #109614

Fix in #109614
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#107858
No description provided.