CMake: GodotCPPModule.cmake#1707
Merged
Merged
Conversation
enetheru
force-pushed
the
cmake_module
branch
2 times, most recently
from
February 13, 2025 07:18
b488c72 to
e7654df
Compare
enetheru
marked this pull request as ready for review
February 13, 2025 07:59
Naros
approved these changes
Feb 13, 2025
dsnopek
reviewed
Feb 14, 2025
dsnopek
left a comment
Collaborator
There was a problem hiding this comment.
Thanks!
At a high-level this makes sense to me, and is definitely the sort of thing we want to get in before Godot 4.4 (since it affects the "developer interface" to the cmake config).
I just have one question about the changes...
Collaborator
Author
I'll revert that sorry. I accidentally resolved the comment. |
Move the find_package for python into it. Recommend adding godot-cpp/cmake to CMAKE_MODULE_PATH and using include( GodotCPPModule ) to use functions. Add target_doc_sources function to simplify the addition of documentation to a binary.
enetheru
force-pushed
the
cmake_module
branch
from
February 14, 2025 22:34
e7654df to
35469fd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After @Naros pointed out that for orchestrator the doc_source.cpp file was not being generated it made me think that a more predictable and obvious method is desirable.
Changes:
python_callouts.cmaketoGodotCPPModule.cmakefind_package(Python3 3.4 REQUIRED)to top ofGodotCPPModule.cmaketo guarantee its availability.target_doc_sourcesCMake functionIt's typical of CMake projects to APPEND to the CMAKE_MODULES_PATH to include scripts from dependencies.
Renaming the
python_callouts.cmaketoGodotCPPModule.cmakecreates a very clear location to place any CMake functionality which is public facing.In consumer CMakeLists.txt it would be recommended that after including the godot-cpp project to:
To simpify the addition of documentation to a gdextension library a new function
target_doc_sourceshas been createdwhich adds a dependency to generate the files on build. It also adds a new target
doc_genwhich will perform the doc_source.cpp generation on demand. (I can add this behind a flag, or leave it exposed by default or customise it to include the name of the target.)This reduces the complexity of including documentation sources to a project by relieving the user of having to explicitly put the
OUTPUT_PATHof thegenerate_doc_sourcefunction in the sources list of their target.