Browse Source

Merge pull request #100023 from Repiteo/core/module-includes-header-strip

Core: Avoid including `modules/modules_enabled.gen.h` in headers
Thaddeus Crews 5 months ago
parent
commit
0a30831bed

+ 0 - 3
editor/editor_help.cpp

@@ -4410,7 +4410,6 @@ EditorHelpBitTooltip::EditorHelpBitTooltip(Control *p_target) {
 	set_process_internal(true);
 	set_process_internal(true);
 }
 }
 
 
-#if defined(MODULE_GDSCRIPT_ENABLED) || defined(MODULE_MONO_ENABLED)
 /// EditorHelpHighlighter ///
 /// EditorHelpHighlighter ///
 
 
 EditorHelpHighlighter *EditorHelpHighlighter::singleton = nullptr;
 EditorHelpHighlighter *EditorHelpHighlighter::singleton = nullptr;
@@ -4576,8 +4575,6 @@ EditorHelpHighlighter::~EditorHelpHighlighter() {
 #endif
 #endif
 }
 }
 
 
-#endif // defined(MODULE_GDSCRIPT_ENABLED) || defined(MODULE_MONO_ENABLED)
-
 /// FindBar ///
 /// FindBar ///
 
 
 FindBar::FindBar() {
 FindBar::FindBar() {

+ 0 - 4
editor/editor_help.h

@@ -40,8 +40,6 @@
 #include "scene/gui/text_edit.h"
 #include "scene/gui/text_edit.h"
 #include "scene/main/timer.h"
 #include "scene/main/timer.h"
 
 
-#include "modules/modules_enabled.gen.h" // For gdscript, mono.
-
 class FindBar : public HBoxContainer {
 class FindBar : public HBoxContainer {
 	GDCLASS(FindBar, HBoxContainer);
 	GDCLASS(FindBar, HBoxContainer);
 
 
@@ -360,7 +358,6 @@ public:
 	EditorHelpBitTooltip(Control *p_target);
 	EditorHelpBitTooltip(Control *p_target);
 };
 };
 
 
-#if defined(MODULE_GDSCRIPT_ENABLED) || defined(MODULE_MONO_ENABLED)
 class EditorSyntaxHighlighter;
 class EditorSyntaxHighlighter;
 
 
 class EditorHelpHighlighter {
 class EditorHelpHighlighter {
@@ -395,4 +392,3 @@ public:
 	EditorHelpHighlighter();
 	EditorHelpHighlighter();
 	virtual ~EditorHelpHighlighter();
 	virtual ~EditorHelpHighlighter();
 };
 };
-#endif // defined(MODULE_GDSCRIPT_ENABLED) || defined(MODULE_MONO_ENABLED)

+ 0 - 5
modules/gdscript/language_server/gdscript_language_protocol.h

@@ -36,12 +36,7 @@
 #include "core/io/stream_peer_tcp.h"
 #include "core/io/stream_peer_tcp.h"
 #include "core/io/tcp_server.h"
 #include "core/io/tcp_server.h"
 
 
-#include "modules/modules_enabled.gen.h" // For jsonrpc.
-#ifdef MODULE_JSONRPC_ENABLED
 #include "modules/jsonrpc/jsonrpc.h"
 #include "modules/jsonrpc/jsonrpc.h"
-#else
-#error "Can't build GDScript LSP without JSONRPC module."
-#endif
 
 
 #define LSP_MAX_BUFFER_SIZE 4194304
 #define LSP_MAX_BUFFER_SIZE 4194304
 #define LSP_MAX_CLIENTS 8
 #define LSP_MAX_CLIENTS 8

+ 6 - 0
modules/gdscript/tests/test_lsp.h

@@ -32,6 +32,10 @@
 
 
 #ifdef TOOLS_ENABLED
 #ifdef TOOLS_ENABLED
 
 
+#include "modules/modules_enabled.gen.h" // For jsonrpc.
+
+#ifdef MODULE_JSONRPC_ENABLED
+
 #include "tests/test_macros.h"
 #include "tests/test_macros.h"
 
 
 #include "../language_server/gdscript_extend_parser.h"
 #include "../language_server/gdscript_extend_parser.h"
@@ -506,4 +510,6 @@ func f():
 
 
 } // namespace GDScriptTests
 } // namespace GDScriptTests
 
 
+#endif // MODULE_JSONRPC_ENABLED
+
 #endif // TOOLS_ENABLED
 #endif // TOOLS_ENABLED

+ 17 - 4
modules/gltf/gltf_document.cpp

@@ -62,6 +62,15 @@
 #include "editor/editor_file_system.h"
 #include "editor/editor_file_system.h"
 #endif
 #endif
 
 
+#include "modules/modules_enabled.gen.h" // For csg, gridmap.
+
+#ifdef MODULE_CSG_ENABLED
+#include "modules/csg/csg_shape.h"
+#endif
+#ifdef MODULE_GRIDMAP_ENABLED
+#include "modules/gridmap/grid_map.h"
+#endif
+
 // FIXME: Hardcoded to avoid editor dependency.
 // FIXME: Hardcoded to avoid editor dependency.
 #define GLTF_IMPORT_GENERATE_TANGENT_ARRAYS 8
 #define GLTF_IMPORT_GENERATE_TANGENT_ARRAYS 8
 #define GLTF_IMPORT_USE_NAMED_SKIN_BINDS 16
 #define GLTF_IMPORT_USE_NAMED_SKIN_BINDS 16
@@ -5912,8 +5921,10 @@ void GLTFDocument::_convert_scene_node(Ref<GLTFState> p_state, Node *p_current,
 	}
 	}
 }
 }
 
 
-#ifdef MODULE_CSG_ENABLED
 void GLTFDocument::_convert_csg_shape_to_gltf(CSGShape3D *p_current, GLTFNodeIndex p_gltf_parent, Ref<GLTFNode> p_gltf_node, Ref<GLTFState> p_state) {
 void GLTFDocument::_convert_csg_shape_to_gltf(CSGShape3D *p_current, GLTFNodeIndex p_gltf_parent, Ref<GLTFNode> p_gltf_node, Ref<GLTFState> p_state) {
+#ifndef MODULE_CSG_ENABLED
+	ERR_FAIL_MSG("csg module is disabled.");
+#else
 	CSGShape3D *csg = p_current;
 	CSGShape3D *csg = p_current;
 	csg->call("_update_shape");
 	csg->call("_update_shape");
 	Array meshes = csg->get_meshes();
 	Array meshes = csg->get_meshes();
@@ -5964,8 +5975,8 @@ void GLTFDocument::_convert_csg_shape_to_gltf(CSGShape3D *p_current, GLTFNodeInd
 	p_gltf_node->transform = csg->get_transform();
 	p_gltf_node->transform = csg->get_transform();
 	p_gltf_node->set_original_name(csg->get_name());
 	p_gltf_node->set_original_name(csg->get_name());
 	p_gltf_node->set_name(_gen_unique_name(p_state, csg->get_name()));
 	p_gltf_node->set_name(_gen_unique_name(p_state, csg->get_name()));
-}
 #endif // MODULE_CSG_ENABLED
 #endif // MODULE_CSG_ENABLED
+}
 
 
 void GLTFDocument::_check_visibility(Node *p_node, bool &r_retflag) {
 void GLTFDocument::_check_visibility(Node *p_node, bool &r_retflag) {
 	r_retflag = true;
 	r_retflag = true;
@@ -5996,8 +6007,10 @@ void GLTFDocument::_convert_light_to_gltf(Light3D *light, Ref<GLTFState> p_state
 	}
 	}
 }
 }
 
 
-#ifdef MODULE_GRIDMAP_ENABLED
 void GLTFDocument::_convert_grid_map_to_gltf(GridMap *p_grid_map, GLTFNodeIndex p_parent_node_index, GLTFNodeIndex p_root_node_index, Ref<GLTFNode> p_gltf_node, Ref<GLTFState> p_state) {
 void GLTFDocument::_convert_grid_map_to_gltf(GridMap *p_grid_map, GLTFNodeIndex p_parent_node_index, GLTFNodeIndex p_root_node_index, Ref<GLTFNode> p_gltf_node, Ref<GLTFState> p_state) {
+#ifndef MODULE_GRIDMAP_ENABLED
+	ERR_FAIL_MSG("gridmap module is disabled.");
+#else
 	Array cells = p_grid_map->get_used_cells();
 	Array cells = p_grid_map->get_used_cells();
 	for (int32_t k = 0; k < cells.size(); k++) {
 	for (int32_t k = 0; k < cells.size(); k++) {
 		GLTFNode *new_gltf_node = memnew(GLTFNode);
 		GLTFNode *new_gltf_node = memnew(GLTFNode);
@@ -6025,8 +6038,8 @@ void GLTFDocument::_convert_grid_map_to_gltf(GridMap *p_grid_map, GLTFNodeIndex
 		new_gltf_node->set_original_name(p_grid_map->get_mesh_library()->get_item_name(cell));
 		new_gltf_node->set_original_name(p_grid_map->get_mesh_library()->get_item_name(cell));
 		new_gltf_node->set_name(_gen_unique_name(p_state, p_grid_map->get_mesh_library()->get_item_name(cell)));
 		new_gltf_node->set_name(_gen_unique_name(p_state, p_grid_map->get_mesh_library()->get_item_name(cell)));
 	}
 	}
-}
 #endif // MODULE_GRIDMAP_ENABLED
 #endif // MODULE_GRIDMAP_ENABLED
+}
 
 
 void GLTFDocument::_convert_multi_mesh_instance_to_gltf(
 void GLTFDocument::_convert_multi_mesh_instance_to_gltf(
 		MultiMeshInstance3D *p_multi_mesh_instance,
 		MultiMeshInstance3D *p_multi_mesh_instance,

+ 2 - 11
modules/gltf/gltf_document.h

@@ -38,13 +38,8 @@
 #include "scene/3d/mesh_instance_3d.h"
 #include "scene/3d/mesh_instance_3d.h"
 #include "scene/3d/multimesh_instance_3d.h"
 #include "scene/3d/multimesh_instance_3d.h"
 
 
-#include "modules/modules_enabled.gen.h" // For csg, gridmap.
-#ifdef MODULE_CSG_ENABLED
-#include "modules/csg/csg_shape.h"
-#endif // MODULE_CSG_ENABLED
-#ifdef MODULE_GRIDMAP_ENABLED
-#include "modules/gridmap/grid_map.h"
-#endif // MODULE_GRIDMAP_ENABLED
+class CSGShape3D;
+class GridMap;
 
 
 class GLTFDocument : public Resource {
 class GLTFDocument : public Resource {
 	GDCLASS(GLTFDocument, Resource);
 	GDCLASS(GLTFDocument, Resource);
@@ -339,20 +334,16 @@ public:
 			const GLTFNodeIndex p_gltf_current,
 			const GLTFNodeIndex p_gltf_current,
 			const GLTFNodeIndex p_gltf_root);
 			const GLTFNodeIndex p_gltf_root);
 
 
-#ifdef MODULE_CSG_ENABLED
 	void _convert_csg_shape_to_gltf(CSGShape3D *p_current, GLTFNodeIndex p_gltf_parent, Ref<GLTFNode> p_gltf_node, Ref<GLTFState> p_state);
 	void _convert_csg_shape_to_gltf(CSGShape3D *p_current, GLTFNodeIndex p_gltf_parent, Ref<GLTFNode> p_gltf_node, Ref<GLTFState> p_state);
-#endif // MODULE_CSG_ENABLED
 
 
 	void _check_visibility(Node *p_node, bool &r_retflag);
 	void _check_visibility(Node *p_node, bool &r_retflag);
 	void _convert_camera_to_gltf(Camera3D *p_camera, Ref<GLTFState> p_state,
 	void _convert_camera_to_gltf(Camera3D *p_camera, Ref<GLTFState> p_state,
 			Ref<GLTFNode> p_gltf_node);
 			Ref<GLTFNode> p_gltf_node);
-#ifdef MODULE_GRIDMAP_ENABLED
 	void _convert_grid_map_to_gltf(
 	void _convert_grid_map_to_gltf(
 			GridMap *p_grid_map,
 			GridMap *p_grid_map,
 			GLTFNodeIndex p_parent_node_index,
 			GLTFNodeIndex p_parent_node_index,
 			GLTFNodeIndex p_root_node_index,
 			GLTFNodeIndex p_root_node_index,
 			Ref<GLTFNode> p_gltf_node, Ref<GLTFState> p_state);
 			Ref<GLTFNode> p_gltf_node, Ref<GLTFState> p_state);
-#endif // MODULE_GRIDMAP_ENABLED
 	void _convert_multi_mesh_instance_to_gltf(
 	void _convert_multi_mesh_instance_to_gltf(
 			MultiMeshInstance3D *p_multi_mesh_instance,
 			MultiMeshInstance3D *p_multi_mesh_instance,
 			GLTFNodeIndex p_parent_node_index,
 			GLTFNodeIndex p_parent_node_index,

+ 2 - 2
modules/text_server_adv/thorvg_svg_in_ot.cpp

@@ -28,6 +28,8 @@
 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                 */
 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                 */
 /**************************************************************************/
 /**************************************************************************/
 
 
+#include "thorvg_svg_in_ot.h"
+
 #ifdef GDEXTENSION
 #ifdef GDEXTENSION
 // Headers for building as GDExtension plug-in.
 // Headers for building as GDExtension plug-in.
 
 
@@ -55,8 +57,6 @@ using namespace godot;
 #ifdef MODULE_SVG_ENABLED
 #ifdef MODULE_SVG_ENABLED
 #ifdef MODULE_FREETYPE_ENABLED
 #ifdef MODULE_FREETYPE_ENABLED
 
 
-#include "thorvg_svg_in_ot.h"
-
 #include <freetype/otsvg.h>
 #include <freetype/otsvg.h>
 #include <ft2build.h>
 #include <ft2build.h>
 
 

+ 2 - 2
modules/text_server_fb/thorvg_svg_in_ot.cpp

@@ -28,6 +28,8 @@
 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                 */
 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                 */
 /**************************************************************************/
 /**************************************************************************/
 
 
+#include "thorvg_svg_in_ot.h"
+
 #ifdef GDEXTENSION
 #ifdef GDEXTENSION
 // Headers for building as GDExtension plug-in.
 // Headers for building as GDExtension plug-in.
 
 
@@ -55,8 +57,6 @@ using namespace godot;
 #ifdef MODULE_SVG_ENABLED
 #ifdef MODULE_SVG_ENABLED
 #ifdef MODULE_FREETYPE_ENABLED
 #ifdef MODULE_FREETYPE_ENABLED
 
 
-#include "thorvg_svg_in_ot.h"
-
 #include <freetype/otsvg.h>
 #include <freetype/otsvg.h>
 #include <ft2build.h>
 #include <ft2build.h>