Skip to content

Commit 0a30831

Browse files
committed
Merge pull request #100023 from Repiteo/core/module-includes-header-strip
Core: Avoid including `modules/modules_enabled.gen.h` in headers
2 parents 70d7a77 + 6c4f17d commit 0a30831

File tree

8 files changed

+29
-31
lines changed

8 files changed

+29
-31
lines changed

editor/editor_help.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4410,7 +4410,6 @@ EditorHelpBitTooltip::EditorHelpBitTooltip(Control *p_target) {
44104410
set_process_internal(true);
44114411
}
44124412

4413-
#if defined(MODULE_GDSCRIPT_ENABLED) || defined(MODULE_MONO_ENABLED)
44144413
/// EditorHelpHighlighter ///
44154414

44164415
EditorHelpHighlighter *EditorHelpHighlighter::singleton = nullptr;
@@ -4576,8 +4575,6 @@ EditorHelpHighlighter::~EditorHelpHighlighter() {
45764575
#endif
45774576
}
45784577

4579-
#endif // defined(MODULE_GDSCRIPT_ENABLED) || defined(MODULE_MONO_ENABLED)
4580-
45814578
/// FindBar ///
45824579

45834580
FindBar::FindBar() {

editor/editor_help.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@
4040
#include "scene/gui/text_edit.h"
4141
#include "scene/main/timer.h"
4242

43-
#include "modules/modules_enabled.gen.h" // For gdscript, mono.
44-
4543
class FindBar : public HBoxContainer {
4644
GDCLASS(FindBar, HBoxContainer);
4745

@@ -360,7 +358,6 @@ class EditorHelpBitTooltip : public PopupPanel {
360358
EditorHelpBitTooltip(Control *p_target);
361359
};
362360

363-
#if defined(MODULE_GDSCRIPT_ENABLED) || defined(MODULE_MONO_ENABLED)
364361
class EditorSyntaxHighlighter;
365362

366363
class EditorHelpHighlighter {
@@ -395,4 +392,3 @@ class EditorHelpHighlighter {
395392
EditorHelpHighlighter();
396393
virtual ~EditorHelpHighlighter();
397394
};
398-
#endif // defined(MODULE_GDSCRIPT_ENABLED) || defined(MODULE_MONO_ENABLED)

modules/gdscript/language_server/gdscript_language_protocol.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,7 @@
3636
#include "core/io/stream_peer_tcp.h"
3737
#include "core/io/tcp_server.h"
3838

39-
#include "modules/modules_enabled.gen.h" // For jsonrpc.
40-
#ifdef MODULE_JSONRPC_ENABLED
4139
#include "modules/jsonrpc/jsonrpc.h"
42-
#else
43-
#error "Can't build GDScript LSP without JSONRPC module."
44-
#endif
4540

4641
#define LSP_MAX_BUFFER_SIZE 4194304
4742
#define LSP_MAX_CLIENTS 8

modules/gdscript/tests/test_lsp.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232

3333
#ifdef TOOLS_ENABLED
3434

35+
#include "modules/modules_enabled.gen.h" // For jsonrpc.
36+
37+
#ifdef MODULE_JSONRPC_ENABLED
38+
3539
#include "tests/test_macros.h"
3640

3741
#include "../language_server/gdscript_extend_parser.h"
@@ -506,4 +510,6 @@ func f():
506510

507511
} // namespace GDScriptTests
508512

513+
#endif // MODULE_JSONRPC_ENABLED
514+
509515
#endif // TOOLS_ENABLED

modules/gltf/gltf_document.cpp

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@
6262
#include "editor/editor_file_system.h"
6363
#endif
6464

65+
#include "modules/modules_enabled.gen.h" // For csg, gridmap.
66+
67+
#ifdef MODULE_CSG_ENABLED
68+
#include "modules/csg/csg_shape.h"
69+
#endif
70+
#ifdef MODULE_GRIDMAP_ENABLED
71+
#include "modules/gridmap/grid_map.h"
72+
#endif
73+
6574
// FIXME: Hardcoded to avoid editor dependency.
6675
#define GLTF_IMPORT_GENERATE_TANGENT_ARRAYS 8
6776
#define GLTF_IMPORT_USE_NAMED_SKIN_BINDS 16
@@ -5912,8 +5921,10 @@ void GLTFDocument::_convert_scene_node(Ref<GLTFState> p_state, Node *p_current,
59125921
}
59135922
}
59145923

5915-
#ifdef MODULE_CSG_ENABLED
59165924
void GLTFDocument::_convert_csg_shape_to_gltf(CSGShape3D *p_current, GLTFNodeIndex p_gltf_parent, Ref<GLTFNode> p_gltf_node, Ref<GLTFState> p_state) {
5925+
#ifndef MODULE_CSG_ENABLED
5926+
ERR_FAIL_MSG("csg module is disabled.");
5927+
#else
59175928
CSGShape3D *csg = p_current;
59185929
csg->call("_update_shape");
59195930
Array meshes = csg->get_meshes();
@@ -5964,8 +5975,8 @@ void GLTFDocument::_convert_csg_shape_to_gltf(CSGShape3D *p_current, GLTFNodeInd
59645975
p_gltf_node->transform = csg->get_transform();
59655976
p_gltf_node->set_original_name(csg->get_name());
59665977
p_gltf_node->set_name(_gen_unique_name(p_state, csg->get_name()));
5967-
}
59685978
#endif // MODULE_CSG_ENABLED
5979+
}
59695980

59705981
void GLTFDocument::_check_visibility(Node *p_node, bool &r_retflag) {
59715982
r_retflag = true;
@@ -5996,8 +6007,10 @@ void GLTFDocument::_convert_light_to_gltf(Light3D *light, Ref<GLTFState> p_state
59966007
}
59976008
}
59986009

5999-
#ifdef MODULE_GRIDMAP_ENABLED
60006010
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) {
6011+
#ifndef MODULE_GRIDMAP_ENABLED
6012+
ERR_FAIL_MSG("gridmap module is disabled.");
6013+
#else
60016014
Array cells = p_grid_map->get_used_cells();
60026015
for (int32_t k = 0; k < cells.size(); k++) {
60036016
GLTFNode *new_gltf_node = memnew(GLTFNode);
@@ -6025,8 +6038,8 @@ void GLTFDocument::_convert_grid_map_to_gltf(GridMap *p_grid_map, GLTFNodeIndex
60256038
new_gltf_node->set_original_name(p_grid_map->get_mesh_library()->get_item_name(cell));
60266039
new_gltf_node->set_name(_gen_unique_name(p_state, p_grid_map->get_mesh_library()->get_item_name(cell)));
60276040
}
6028-
}
60296041
#endif // MODULE_GRIDMAP_ENABLED
6042+
}
60306043

60316044
void GLTFDocument::_convert_multi_mesh_instance_to_gltf(
60326045
MultiMeshInstance3D *p_multi_mesh_instance,

modules/gltf/gltf_document.h

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,8 @@
3838
#include "scene/3d/mesh_instance_3d.h"
3939
#include "scene/3d/multimesh_instance_3d.h"
4040

41-
#include "modules/modules_enabled.gen.h" // For csg, gridmap.
42-
#ifdef MODULE_CSG_ENABLED
43-
#include "modules/csg/csg_shape.h"
44-
#endif // MODULE_CSG_ENABLED
45-
#ifdef MODULE_GRIDMAP_ENABLED
46-
#include "modules/gridmap/grid_map.h"
47-
#endif // MODULE_GRIDMAP_ENABLED
41+
class CSGShape3D;
42+
class GridMap;
4843

4944
class GLTFDocument : public Resource {
5045
GDCLASS(GLTFDocument, Resource);
@@ -339,20 +334,16 @@ class GLTFDocument : public Resource {
339334
const GLTFNodeIndex p_gltf_current,
340335
const GLTFNodeIndex p_gltf_root);
341336

342-
#ifdef MODULE_CSG_ENABLED
343337
void _convert_csg_shape_to_gltf(CSGShape3D *p_current, GLTFNodeIndex p_gltf_parent, Ref<GLTFNode> p_gltf_node, Ref<GLTFState> p_state);
344-
#endif // MODULE_CSG_ENABLED
345338

346339
void _check_visibility(Node *p_node, bool &r_retflag);
347340
void _convert_camera_to_gltf(Camera3D *p_camera, Ref<GLTFState> p_state,
348341
Ref<GLTFNode> p_gltf_node);
349-
#ifdef MODULE_GRIDMAP_ENABLED
350342
void _convert_grid_map_to_gltf(
351343
GridMap *p_grid_map,
352344
GLTFNodeIndex p_parent_node_index,
353345
GLTFNodeIndex p_root_node_index,
354346
Ref<GLTFNode> p_gltf_node, Ref<GLTFState> p_state);
355-
#endif // MODULE_GRIDMAP_ENABLED
356347
void _convert_multi_mesh_instance_to_gltf(
357348
MultiMeshInstance3D *p_multi_mesh_instance,
358349
GLTFNodeIndex p_parent_node_index,

modules/text_server_adv/thorvg_svg_in_ot.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
2929
/**************************************************************************/
3030

31+
#include "thorvg_svg_in_ot.h"
32+
3133
#ifdef GDEXTENSION
3234
// Headers for building as GDExtension plug-in.
3335

@@ -55,8 +57,6 @@ using namespace godot;
5557
#ifdef MODULE_SVG_ENABLED
5658
#ifdef MODULE_FREETYPE_ENABLED
5759

58-
#include "thorvg_svg_in_ot.h"
59-
6060
#include <freetype/otsvg.h>
6161
#include <ft2build.h>
6262

modules/text_server_fb/thorvg_svg_in_ot.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
2929
/**************************************************************************/
3030

31+
#include "thorvg_svg_in_ot.h"
32+
3133
#ifdef GDEXTENSION
3234
// Headers for building as GDExtension plug-in.
3335

@@ -55,8 +57,6 @@ using namespace godot;
5557
#ifdef MODULE_SVG_ENABLED
5658
#ifdef MODULE_FREETYPE_ENABLED
5759

58-
#include "thorvg_svg_in_ot.h"
59-
6060
#include <freetype/otsvg.h>
6161
#include <ft2build.h>
6262

0 commit comments

Comments
 (0)