CMake: Support for XML documentation

Add new function generate_doc_source to python_callouts.cmake
Update Test extension to use generate_doc_source function and include generated file in the build.

Cleanup:
Fix godotcpp.py imports after rebase
Pre-Commit hook sorted python imports in doc_source_generator.py
- replace ${CMAKE_CURRENT_SOURCE_DIR} with ${godot-cpp_SOURCE_DIR} when referencing current working directory and script locations when invoking python scripts.

Co-authored-by: David Snopek <dsnopek@gmail.com>
This commit is contained in:
Samuel Nicholas
2025-01-13 08:28:24 +10:30
parent 94a1f4f2fb
commit 8814ac51ac
4 changed files with 104 additions and 52 deletions

View File

@@ -3,11 +3,19 @@ Integration Testing
-------------------
The Test target used to validate changes in the GitHub CI.
]=======================================================================]
message( STATUS "Testing Integration targets are enabled.")
# Generate Doc Data
file( GLOB_RECURSE DOC_XML
LIST_DIRECTORIES NO
CONFIGURE_DEPENDS
"${CMAKE_CURRENT_SOURCE_DIR}/doc_classes/*.xml" )
set( DOC_DATA_SOURCE "${CMAKE_CURRENT_BINARY_DIR}/src/gen/doc_data.gen.cpp" )
generate_doc_source( "${DOC_DATA_SOURCE}" "${DOC_XML}" )
foreach( TARGET_ALIAS template_debug template_release editor )
set( TARGET_NAME "godot-cpp.test.${TARGET_ALIAS}" )
set( LINK_TARGET "godot-cpp::${TARGET_ALIAS}" )
@@ -23,6 +31,11 @@ foreach( TARGET_ALIAS template_debug template_release editor )
src/tests.h
)
# conditionally add doc data to compile output
if( TARGET_ALIAS MATCHES "editor|template_debug" )
target_sources( ${TARGET_NAME} PRIVATE "${DOC_DATA_SOURCE}" )
endif( )
target_link_libraries( ${TARGET_NAME} PRIVATE ${LINK_TARGET} )
### Get useful properties of the library