CMake: GodotCPPModule.cmake #1707
Merged
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.