From ba02e4f4a74ec3b6317ce3117ddc9296012eeb45 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Fri, 5 Jan 2024 11:44:33 -0800 Subject: [PATCH] Use `-isystem` for port include paths (#21014) This means that they will get searched after any user include paths. Without this change, since the results of process_args are pre-pended to the compiler flags, it is not possible for the user to override these include paths with their own. --- ChangeLog.md | 3 +++ tools/ports/bullet.py | 2 +- tools/ports/cocos2d.py | 2 +- tools/ports/freetype.py | 2 +- tools/ports/harfbuzz.py | 2 +- tools/ports/sdl2.py | 2 +- 6 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index e24fe2b2c8aa..757355b940f2 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -20,6 +20,9 @@ See docs/process.md for more on how version tagging works. 3.1.52 (in development) ----------------------- +- Include paths added by ports (e.g. `-sUSE_SDL=2`) now use `-isystem` rather + then `-I`. This means that files in user-specified include directories will + now take precedence over port includes. (#21014) - Certain settings that only apply when generating JavaScript output will now trigger a warning if used when generating only Wasm. - Fix bug where `main` was mistakenly included in debug builds but not in diff --git a/tools/ports/bullet.py b/tools/ports/bullet.py index 74b681c6ad54..0f6dedc1ef9e 100644 --- a/tools/ports/bullet.py +++ b/tools/ports/bullet.py @@ -52,7 +52,7 @@ def clear(ports, settings, shared): def process_args(ports): - return ['-I' + ports.get_include_dir('bullet')] + return ['-isystem', ports.get_include_dir('bullet')] def show(): diff --git a/tools/ports/cocos2d.py b/tools/ports/cocos2d.py index b1f3d624852c..6ffe7cb79087 100644 --- a/tools/ports/cocos2d.py +++ b/tools/ports/cocos2d.py @@ -69,7 +69,7 @@ def process_dependencies(settings): def process_args(ports): args = [] for include in make_includes(ports.get_include_dir('cocos2d')): - args.append('-I' + include) + args += ['-isystem', include] return args diff --git a/tools/ports/freetype.py b/tools/ports/freetype.py index 83ef166a91cd..d419bd53c618 100644 --- a/tools/ports/freetype.py +++ b/tools/ports/freetype.py @@ -112,7 +112,7 @@ def clear(ports, settings, shared): def process_args(ports): - return ['-I' + ports.get_include_dir('freetype2')] + return ['-isystem', ports.get_include_dir('freetype2')] def show(): diff --git a/tools/ports/harfbuzz.py b/tools/ports/harfbuzz.py index 133bbfdc3ca4..73d35c7d8a12 100644 --- a/tools/ports/harfbuzz.py +++ b/tools/ports/harfbuzz.py @@ -148,7 +148,7 @@ def process_dependencies(settings): def process_args(ports): - return ['-I' + ports.get_include_dir('harfbuzz')] + return ['-isystem', ports.get_include_dir('harfbuzz')] def show(): diff --git a/tools/ports/sdl2.py b/tools/ports/sdl2.py index 24dd8757195f..3378084372e6 100644 --- a/tools/ports/sdl2.py +++ b/tools/ports/sdl2.py @@ -87,7 +87,7 @@ def linker_setup(ports, settings): def process_args(ports): - return ['-I' + ports.get_include_dir('SDL2')] + return ['-isystem', ports.get_include_dir('SDL2')] def show():