libretro: Link FFmpeg as a static library of its own

With its objects on it, the MSVC link command line got too long for Windows.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-25 22:27:53 +01:00
1 parent b0d2f8c92b
commit 03ac2c8ded
1 file changed
+19 -4
+19 -4
View File
@@ -417,7 +417,15 @@ ifeq ($(BUILD_FFMPEG), 1)
else
FFMPEG_CFLAGS_LAST := -w -Werror=implicit-function-declaration
endif
OBJECTS += $(FFMPEG_OBJECTS)
# Linked as a library of its own, since with all these objects the link command line gets too
# long for Windows.
ifeq ($(STATIC_LINKING), 1)
OBJECTS += $(FFMPEG_OBJECTS)
else ifneq (,$(findstring msvc,$(platform)))
FFMPEG_LIB := $(FFMPEG_OBJDIR)/ffmpeg.lib
else
FFMPEG_LIB := $(FFMPEG_OBJDIR)/libffmpeg.a
endif
endif
ifeq ($(DEBUG), 1)
@@ -493,18 +501,25 @@ $(FFMPEG_OBJDIR)/%.o: $(FFMPEGDIR)/%.c
@mkdir -p $(dir $@)
$(CC) $(FFMPEG_CFLAGS) $(CFLAGS) $(FFMPEG_CFLAGS_LAST) -c $(OBJOUT)$@ $<
$(FFMPEG_OBJDIR)/ffmpeg.lib: $(FFMPEG_OBJECTS)
lib.exe -nologo -out:$@ $^
$(FFMPEG_OBJDIR)/libffmpeg.a: $(FFMPEG_OBJECTS)
rm -f $@
$(AR) rcs $@ $^
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $(OBJOUT)$@ $<
$(TARGET): $(OBJECTS)
$(TARGET): $(OBJECTS) $(FFMPEG_LIB)
ifeq ($(STATIC_LINKING), 1)
$(AR) rcs $(TARGET) $(OBJECTS)
else
$(LD) $(LINKOUT)$@ $(OBJECTS) $(LDFLAGS) $(GL_LIB)
$(LD) $(LINKOUT)$@ $(OBJECTS) $(FFMPEG_LIB) $(LDFLAGS) $(GL_LIB)
endif
clean:
rm -f $(filter-out $(CORE_DIR)/ext/zstd/lib/decompress/huf_decompress_amd64.S,$(OBJECTS)) $(TARGET)
rm -f $(filter-out $(CORE_DIR)/ext/zstd/lib/decompress/huf_decompress_amd64.S,$(OBJECTS)) $(FFMPEG_OBJECTS) $(FFMPEG_LIB) $(TARGET)
.PHONY: clean