Skip to content

Commit ad02128

Browse files
committed
SCons: Remove transitive includes in libc++
1 parent 235a32a commit ad02128

File tree

17 files changed

+114
-2
lines changed

17 files changed

+114
-2
lines changed

SConstruct

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,11 @@ opts.Add(
267267
)
268268
opts.Add(BoolVariable("use_precise_math_checks", "Math checks use very precise epsilon (debug option)", False))
269269
opts.Add(BoolVariable("strict_checks", "Enforce stricter checks (debug option)", False))
270+
opts.Add(
271+
BoolVariable(
272+
"limit_transitive_includes", "Attempt to limit the amount of transitive includes in system headers", True
273+
)
274+
)
270275
opts.Add(BoolVariable("scu_build", "Use single compilation unit build", False))
271276
opts.Add("scu_limit", "Max includes per SCU file when using scu_build (determines RAM use)", "0")
272277
opts.Add(BoolVariable("engine_update_check", "Enable engine update checks in the Project Manager", True))
@@ -778,6 +783,13 @@ elif methods.using_clang(env) or methods.using_emcc(env):
778783
if sys.platform == "win32":
779784
env.AppendUnique(CCFLAGS=["-fansi-escape-codes"])
780785

786+
# Attempt to reduce transitive includes.
787+
if env["limit_transitive_includes"]:
788+
if not env.msvc:
789+
# FIXME: This define only affects `libcpp`, but lack of guaranteed, granular detection means
790+
# we're better off applying it universally.
791+
env.AppendUnique(CPPDEFINES=["_LIBCPP_REMOVE_TRANSITIVE_INCLUDES"])
792+
781793
# Set optimize and debug_symbols flags.
782794
# "custom" means do nothing and let users set their own optimization flags.
783795
# Needs to happen after configure to have `env.msvc` defined.

core/typedefs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ static_assert(__cplusplus >= 201703L, "Minimum of C++17 required.");
5151
#include <cstddef>
5252
#include <cstdint>
5353
#include <cstring>
54+
#include <type_traits>
5455
#include <utility>
5556

5657
// IWYU pragma: end_exports

drivers/metal/metal_objects.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
#import <simd/simd.h>
6666
#import <zlib.h>
6767
#import <initializer_list>
68+
#import <memory>
6869
#import <optional>
6970

7071
enum StageResourceUsage : uint32_t {

thirdparty/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ Patches:
9090
- `0003-remove-tinydds-qoi.patch` (GH-97582)
9191
- `0004-clang-warning-exclude.patch` (GH-111346)
9292
- `0005-unused-typedef.patch` (GH-111445)
93+
- `0006-explicit-includes.patch` (GH-111557)
9394

9495

9596
## brotli
@@ -220,6 +221,7 @@ Patches:
220221
- `0003-emscripten-nthreads.patch` (GH-69799)
221222
- `0004-mingw-no-cpuidex.patch` (GH-92488)
222223
- `0005-mingw-llvm-arm64.patch` (GH-93364)
224+
- `0006-explicit-includes.patch` (GH-111557)
223225

224226
The `modules/raycast/godot_update_embree.py` script can be used to pull the
225227
relevant files from the latest Embree release and apply patches automatically.
@@ -707,6 +709,7 @@ Patches:
707709

708710
- `0001-disable-exceptions.patch` (GH-85039)
709711
- `0002-clang-std-replacements-leak.patch` (GH-85208)
712+
- `0003-explicit-includes.patch` (GH-111557)
710713

711714

712715
## minimp3
@@ -1046,6 +1049,7 @@ Patches:
10461049

10471050
- `0001-revert-tvglines-bezier-precision.patch` (GH-96658)
10481051
- `0002-use-heap-alloc.patch` (GH-109530)
1052+
- `0003-explicit-includes.patch` (GH-111557)
10491053

10501054

10511055
## tinyexr

thirdparty/basis_universal/patches/0005-msvc-include-ctype.patch renamed to thirdparty/basis_universal/patches/0006-explicit-includes.patch

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
diff --git a/thirdparty/basis_universal/transcoder/basisu_containers_impl.h b/thirdparty/basis_universal/transcoder/basisu_containers_impl.h
2-
index d4d3eb23bc..3d7aaddcad 100644
2+
index 3d7aaddcad..db3a567450 100644
33
--- a/thirdparty/basis_universal/transcoder/basisu_containers_impl.h
44
+++ b/thirdparty/basis_universal/transcoder/basisu_containers_impl.h
5-
@@ -1,6 +1,8 @@
5+
@@ -1,6 +1,9 @@
66
// basisu_containers_impl.h
77
// Do not include directly
88

99
+#include <ctype.h>
10+
+#include <exception>
1011
+
1112
#ifdef _MSC_VER
1213
#pragma warning (disable:4127) // warning C4127: conditional expression is constant

thirdparty/basis_universal/transcoder/basisu_containers_impl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Do not include directly
33

44
#include <ctype.h>
5+
#include <exception>
56

67
#ifdef _MSC_VER
78
#pragma warning (disable:4127) // warning C4127: conditional expression is constant

thirdparty/embree/common/sys/vector.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include "alloc.h"
77
#include <algorithm>
8+
#include <type_traits>
89

910
namespace embree
1011
{

thirdparty/embree/common/tasking/taskschedulerinternal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "../sys/atomic.h"
1515
#include "../math/range.h"
1616

17+
#include <exception>
1718
#include <list>
1819

1920
namespace embree
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
diff --git a/thirdparty/embree/common/sys/vector.h b/thirdparty/embree/common/sys/vector.h
2+
index 2d30d6725b..a8138de832 100644
3+
--- a/thirdparty/embree/common/sys/vector.h
4+
+++ b/thirdparty/embree/common/sys/vector.h
5+
@@ -5,6 +5,7 @@
6+
7+
#include "alloc.h"
8+
#include <algorithm>
9+
+#include <type_traits>
10+
11+
namespace embree
12+
{
13+
diff --git a/thirdparty/embree/common/tasking/taskschedulerinternal.h b/thirdparty/embree/common/tasking/taskschedulerinternal.h
14+
index d4e0c7386b..99e47608d6 100644
15+
--- a/thirdparty/embree/common/tasking/taskschedulerinternal.h
16+
+++ b/thirdparty/embree/common/tasking/taskschedulerinternal.h
17+
@@ -14,6 +14,7 @@
18+
#include "../sys/atomic.h"
19+
#include "../math/range.h"
20+
21+
+#include <exception>
22+
#include <list>
23+
24+
namespace embree

thirdparty/jolt_physics/Jolt/Core/Core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@ JPH_SUPPRESS_WARNINGS_STD_BEGIN
453453
#include <functional>
454454
#include <algorithm>
455455
#include <cstdint>
456+
#include <type_traits>
456457
#if defined(JPH_COMPILER_MSVC) || (defined(JPH_COMPILER_CLANG) && defined(_MSC_VER)) // MSVC or clang-cl
457458
#include <malloc.h> // for alloca
458459
#endif

0 commit comments

Comments
 (0)