Skip to content

Commit e96de09

Browse files
committed
fix(gen): only ffmpeg root '*' on include_dirs_after; '*/libavcodec' stays -I
Windows opus/parser.c failed (ParseContext undefined) because I'd moved BOTH '*' and '*/libavcodec' to include_dirs_after. Only '*' (the source root holding the VERSION file that shadows libc++ <version> on case-insensitive macOS, #249) needs -idirafter; '*/libavcodec' must stay on regular -I so ffmpeg's relative "parser.h"-style includes resolve (windows clang-MSVC doesn't find them via -idirafter). x86 asm include dirs also back on regular -I. macos+linux stay green; windows now finds libavcodec/parser.h.
1 parent 4aefe61 commit e96de09

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

pkgs/c/compat.ffmpeg.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ package = {
3333
"mcpp_generated/libavformat",
3434
"mcpp_generated/libavfilter",
3535
"mcpp_generated/libavdevice",
36+
"*/libavcodec",
3637
},
3738
include_dirs_after = {
3839
"*",
39-
"*/libavcodec",
4040
},
4141
cflags = {
4242
"-DHAVE_AV_CONFIG_H",
@@ -7776,7 +7776,7 @@ static const FFOutputFormat * const muxer_list[] = {
77767776
"-lpthread",
77777777
"-lm",
77787778
},
7779-
include_dirs_after = {
7779+
include_dirs = {
77807780
"*/libavutil/x86",
77817781
"*/libavcodec/x86",
77827782
"*/libavfilter/x86",
@@ -8568,7 +8568,7 @@ static const URLProtocol * const url_protocols[] = {
85688568
"-lshell32",
85698569
"-lgdi32",
85708570
},
8571-
include_dirs_after = {
8571+
include_dirs = {
85728572
"*/libavutil/x86",
85738573
"*/libavcodec/x86",
85748574
"*/libavfilter/x86",

tools/compat-ffmpeg/gen_multiplatform.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,14 @@
3636
SPLIT_ASM = ["config.asm", "config_components.asm"] # NASM, x86 OSes only
3737

3838
NEUTRAL_INCLUDE = ["mcpp_generated", "mcpp_generated/libavcodec", "mcpp_generated/libavformat",
39-
"mcpp_generated/libavfilter", "mcpp_generated/libavdevice"]
40-
ROOT_INCLUDE_AFTER = ["*", "*/libavcodec"] # #249: ffmpeg source root as -idirafter
41-
X86_INCLUDE_AFTER = ["*/libavutil/x86", "*/libavcodec/x86", "*/libavfilter/x86",
39+
"mcpp_generated/libavfilter", "mcpp_generated/libavdevice", "*/libavcodec"]
40+
# ONLY the ffmpeg source root ('*') goes on include_dirs_after (-idirafter): it
41+
# holds the VERSION file that shadows libc++ <version> on case-insensitive macOS
42+
# (#249). '*/libavcodec' must stay on regular -I — ffmpeg's relative "parser.h"
43+
# style includes need it there (on -idirafter, windows clang-MSVC fails to find
44+
# them, e.g. opus/parser.c → ParseContext undefined).
45+
ROOT_INCLUDE_AFTER = ["*"]
46+
X86_INCLUDE = ["*/libavutil/x86", "*/libavcodec/x86", "*/libavfilter/x86",
4247
"*/libswscale/x86", "*/libswresample/x86"]
4348
NEUTRAL_CFLAGS = ["-DHAVE_AV_CONFIG_H", "-D_ISOC11_SOURCE", "-D_FILE_OFFSET_BITS=64",
4449
"-D_LARGEFILE_SOURCE", "-w"]
@@ -163,7 +168,7 @@ def per_os_block(o):
163168
parts = [f' cflags = {L(PER_OS_CFLAGS[o], 12)},',
164169
f' ldflags = {L(PER_OS_LDFLAGS[o], 12)},']
165170
if o in X86:
166-
parts.append(f' include_dirs_after = {L(X86_INCLUDE_AFTER, 12)},')
171+
parts.append(f' include_dirs = {L(X86_INCLUDE, 12)},')
167172
parts.append(' flags = {\n { glob = "**/*.asm", asmflags = { "-Pconfig.asm" } },\n },')
168173
parts.append(f' sources = {L(srcs, 12)},')
169174
parts.append(' generated_files = ' + gen_block(per_os_gen[o], 12))

0 commit comments

Comments
 (0)