From 89678f0c0e5ecc0c748f80d96008d781a9f8beb1 Mon Sep 17 00:00:00 2001 From: crueter Date: Sat, 15 Nov 2025 21:06:27 -0500 Subject: [PATCH] fix openssl and ffmpeg, add sdl Signed-off-by: crueter --- CMakeLists.txt | 20 +++++--------------- CMakeModules/StaticQtLibs.cmake | 23 +++++++++++++++++++++++ externals/cpmfile.json | 7 ++----- src/yuzu/CMakeLists.txt | 27 +-------------------------- 4 files changed, 31 insertions(+), 46 deletions(-) create mode 100644 CMakeModules/StaticQtLibs.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 76a946d389..6b00a69b34 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -119,6 +119,8 @@ endif() option(YUZU_STATIC_BUILD "Use static libraries and executables if available" OFF) if (YUZU_STATIC_BUILD) + include(StaticQtLibs) + # lol set(Boost_USE_STATIC_LIBS ON) set(BUILD_SHARED_LIBS OFF) @@ -136,7 +138,8 @@ if (YUZU_STATIC_BUILD) # simple hook to reject dynamic libs function(find_library var) # also skip previously-found libraries cuz... yaknow - if (${var}) + # UNLESS they are dll.a :{ + if (${var} AND NOT ${var} MATCHES "dll\\.a$") return() endif() @@ -163,7 +166,7 @@ if (YUZU_STATIC_BUILD) set(YUZU_USE_CPM ON) set(YUZU_USE_BUNDLED_FFMPEG ON) - set(YUZU_USE_EXTERNAL_SDL2 ON) + set(YUZU_USE_BUNDLED_SDL2 ON) set(YUZU_USE_BUNDLED_OPENSSL ON) # IMPORTED_IMPLIB not set for imported target @@ -175,19 +178,6 @@ if (YUZU_STATIC_BUILD) endif() endif() -## certain libraries need extra static libs to be linked ## -if (YUZU_STATIC_BUILD AND MINGW) - macro(extra_libs) - foreach(lib ${ARGN}) - find_library(${lib}_LIBRARY ${lib} REQUIRED) - link_libraries(${${lib}_LIBRARY}) - endforeach() - endmacro() - - # ffmpeg - extra_libs(iconv) -endif() - # Detect current compilation architecture and create standard definitions # ======================================================================= diff --git a/CMakeModules/StaticQtLibs.cmake b/CMakeModules/StaticQtLibs.cmake new file mode 100644 index 0000000000..91d6f2b73a --- /dev/null +++ b/CMakeModules/StaticQtLibs.cmake @@ -0,0 +1,23 @@ +## When linking to a static Qt build on MinGW, certain additional libraries +## must be statically linked to as well. + +function(static_qt_link target) + macro(extra_libs) + foreach(lib ${ARGN}) + find_library(${lib}_LIBRARY ${lib} REQUIRED) + target_link_libraries(${target} PRIVATE ${${lib}_LIBRARY}) + endforeach() + endmacro() + + # I am constantly impressed at how ridiculously stupid the linker is + # NB: yes, we have to put them here twice. I have no idea why + + # libtiff.a + extra_libs(tiff jbig bz2 lzma deflate jpeg tiff) + + # libfreetype.a + extra_libs(freetype bz2 Lerc brotlidec brotlicommon freetype) + + # libharfbuzz.a + extra_libs(harfbuzz graphite2) +endfunction() diff --git a/externals/cpmfile.json b/externals/cpmfile.json index a8376db540..ee5ccb451e 100644 --- a/externals/cpmfile.json +++ b/externals/cpmfile.json @@ -167,11 +167,8 @@ "package": "SDL2", "name": "SDL2", "repo": "crueter-ci/SDL2", - "version": "2.32.10", - "min_version": "2.26.4", - "disabled_platforms": [ - "macos-universal" - ] + "version": "2.32.10-38e0094637", + "min_version": "2.26.4" }, "catch2": { "package": "Catch2", diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt index 5f7ca85752..e69dfd52aa 100644 --- a/src/yuzu/CMakeLists.txt +++ b/src/yuzu/CMakeLists.txt @@ -459,33 +459,8 @@ if (NOT MSVC AND (APPLE OR NOT YUZU_STATIC_BUILD)) -Wno-missing-field-initializers) endif() -## certain libraries need extra static libs to be linked ## -# I have no fucking clue why it ONLY has to be on yuzu -# yuzu_cmd works totally fine but not this?????????? if (YUZU_STATIC_BUILD AND MINGW) - macro(extra_libs) - foreach(lib ${ARGN}) - find_library(${lib}_LIBRARY ${lib} REQUIRED) - target_link_libraries(yuzu PRIVATE ${${lib}_LIBRARY}) - endforeach() - endmacro() - - # I am constantly impressed at how ridiculously stupid the linker is - # NB: yes, we have to put them here twice. I have no idea why - - # libtiff.a - extra_libs(tiff jbig bz2 lzma deflate jpeg tiff) - - # libfreetype.a - extra_libs(freetype bz2 Lerc brotlidec brotlicommon freetype) - - # libharfbuzz.a - extra_libs(harfbuzz graphite2) - - # ffmpeg - extra_libs(iconv) - - extra_libs(wsock32 ws2_32 crypt32 mswsock wlanapi) + static_qt_link(yuzu) endif() create_target_directory_groups(yuzu)