Browse Source

[cmake] allow static MinGW/macOS builds; fix clangarm64 (#2994)

Requires qt6-static, obviously... at least for eden. eden-cli also can
be built fully static
Notable challenges n such:
1. VkMemAlloc conflicts with Qt, since it embeds vk_mem_alloc.h in
   qrhivulkan; we can get around this by conditionally defining
   VMA_IMPLEMENTATION; that is, define it in the SDL2 frontend and undef
   it in the Qt frontend. It's not ideal, but I mean... it works, no?
2. find_library, pkgconfig, and some Config modules will always look for
   a .dll, so we have to tell CMake to look for .a
3. In spite of this, some will end up using .dll.a (implib) as their
   link targets; this is, well, bad, so we create a find_library hook
   that rejects dll.a
4. Some libraries have specific configs (boost lol)
5. Some libraries use _static targets (zstd, mbedtls)
6. Some extra libraries need to be linked, i.e. jbig, lzma, etc
7. QuaZip is sad

Needs testing on all platforms, and for both frontends on desktop, to
ensure Vulkan still works as expected.

(also: CI). Resulting executables are:
- 71MB for eden.exe
- 39MB for eden-cli.exe

Considering the entire libicudt is included (thanks Qt), that's a great size all things considered. No need to bundle all those plugins and translation files too.

Theoretically, this lays the groundwork towards fully static executables for other platforms too; though Linux doesn't have a huge benefit since AppImages are needed regardless. eden-room though maybe?

Fixes comp for clangarm64 because -msse4.1

Also allows macOS to build with qt6-static. macOS can't build static executables, but with these changes it ONLY relies on system libraries like libc and frameworks. So in theory we don't even need macdeployqt.

Signed-off-by: crueter <crueter@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2994
pull/3002/head
crueter 1 month ago
parent
commit
7ca657d22f
No known key found for this signature in database GPG Key ID: 425ACD2D4830EBC6
  1. 99
      CMakeLists.txt
  2. 5
      CMakeModules/CPMUtil.cmake
  3. 7
      CMakeModules/FindOpus.cmake
  4. 7
      CMakeModules/FindSPIRV-Tools.cmake
  5. 7
      CMakeModules/Findenet.cmake
  6. 7
      CMakeModules/Findlibusb.cmake
  7. 8
      CMakeModules/Findlz4.cmake
  8. 28
      CMakeModules/Findzstd.cmake
  9. 21
      CMakeModules/FixMsysPaths.cmake
  10. 2
      externals/ffmpeg/CMakeLists.txt
  11. 3
      externals/ffmpeg/cpmfile.json
  12. 22
      src/CMakeLists.txt
  13. 2
      src/android/app/src/main/jni/native.cpp
  14. 2
      src/common/CMakeLists.txt
  15. 8
      src/core/CMakeLists.txt
  16. 5
      src/dedicated_room/CMakeLists.txt
  17. 9
      src/tests/CMakeLists.txt
  18. 6
      src/tests/common/bit_field.cpp
  19. 4
      src/video_core/CMakeLists.txt
  20. 6
      src/video_core/vulkan_common/vma.cpp
  21. 44
      src/yuzu/CMakeLists.txt
  22. 18
      src/yuzu/main_window.cpp
  23. 9
      src/yuzu_cmd/CMakeLists.txt
  24. 6
      src/yuzu_cmd/yuzu.cpp
  25. 5
      src/yuzu_room_standalone/CMakeLists.txt

99
CMakeLists.txt

@ -21,6 +21,11 @@ elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(PLATFORM_LINUX ON)
endif()
# dumb heuristic to detect msys2
if (CMAKE_COMMAND MATCHES "msys64")
set(PLATFORM_MSYS ON)
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CXX_CLANG ON)
if (MSVC)
@ -85,6 +90,89 @@ if (PLATFORM_NETBSD)
set(ENV{PKG_CONFIG_PATH} "${PKG_CONFIG_PATH}:${CMAKE_SYSROOT}/usr/pkg/lib/ffmpeg7/pkgconfig")
endif()
# MSYS2 utilities
if (PLATFORM_MSYS)
include(FixMsysPaths)
# really, really dumb heuristic to detect what environment we are in
macro(system var)
if (CMAKE_COMMAND MATCHES ${var})
set(MSYSTEM ${var})
endif()
endmacro()
system(mingw64)
system(clang64)
system(clangarm64)
system(ucrt64)
if (NOT DEFINED MSYSTEM)
set(MSYSTEM msys2)
endif()
# we (generally) want to prioritize environment-specific binaries if possible
# some, like autoconf, are not present on environments besides msys2 though
set(CMAKE_PROGRAM_PATH C:/msys64/${MSYSTEM}/bin C:/msys64/usr/bin)
set(ENV{PKG_CONFIG_PATH} C:/msys64/${MSYSTEM}/lib/pkgconfig)
endif()
# static stuff
option(YUZU_STATIC_BUILD "Use static libraries and executables if available" OFF)
if (YUZU_STATIC_BUILD)
# lol
set(Boost_USE_STATIC_LIBS ON)
set(BUILD_SHARED_LIBS OFF)
## find .a libs first (static, usually)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
## some libraries define a Library::Name_static alternative ##
set(YUZU_STATIC_SUFFIX _static)
## some libraries use CMAKE_IMPORT_LIBRARY_SUFFIX e.g. Harfbuzz ##
set(CMAKE_IMPORT_LIBRARY_SUFFIX ".a")
if (MINGW)
# simple hook to reject dynamic libs
function(find_library var)
# also skip previously-found libraries cuz... yaknow
if (${var})
return()
endif()
_find_library(${var} ${ARGN})
if (${var})
get_filename_component(lib_name "${${var}}" NAME)
if (lib_name MATCHES "dll\\.a$")
unset(${var} CACHE)
set(${var} "${var}-NOTFOUND" CACHE INTERNAL "" FORCE)
endif()
endif()
endfunction()
# msys2 quazip does not build a static lib
set(QuaZip-Qt6_FORCE_BUNDLED ON)
set(YUZU_USE_BUNDLED_FFMPEG ON)
set(YUZU_USE_BUNDLED_SDL2 ON)
set(HTTPLIB_USE_BROTLI_IF_AVAILABLE OFF)
elseif(APPLE)
# these libs do not properly provide static libs/let you do it with cmake
set(YUZU_USE_CPM ON)
# IMPORTED_IMPLIB not set for imported target
# TODO(crueter): wtf
set(YUZU_USE_BUNDLED_FFMPEG ON)
set(YUZU_USE_EXTERNAL_SDL2 ON)
set(fmt_FORCE_BUNDLED ON)
set(SPIRV-Tools_FORCE_BUNDLED ON)
set(SPIRV-Headers_FORCE_BUNDLED ON)
set(zstd_FORCE_BUNDLED ON)
endif()
endif()
# Detect current compilation architecture and create standard definitions
# =======================================================================
@ -582,6 +670,7 @@ else()
find_package(stb MODULE)
find_package(Opus 1.3 MODULE REQUIRED)
find_package(ZLIB 1.2 REQUIRED)
find_package(zstd 1.5 REQUIRED MODULE)
@ -634,15 +723,15 @@ if (APPLE)
# Umbrella framework for everything GUI-related
find_library(COCOA_LIBRARY Cocoa)
set(PLATFORM_LIBRARIES ${COCOA_LIBRARY} ${IOKIT_LIBRARY} ${COREVIDEO_LIBRARY})
find_library(ICONV_LIBRARY iconv REQUIRED)
list(APPEND PLATFORM_LIBRARIES ${ICONV_LIBRARY})
# find_library(ICONV_LIBRARY iconv REQUIRED)
# list(APPEND PLATFORM_LIBRARIES ${ICONV_LIBRARY})
elseif (WIN32)
# Target Windows 10
add_compile_definitions(_WIN32_WINNT=0x0A00 WINVER=0x0A00)
set(PLATFORM_LIBRARIES winmm ws2_32 iphlpapi)
set(PLATFORM_LIBRARIES ${PLATFORM_LIBRARIES} winmm iphlpapi ws2_32 wlanapi)
if (MINGW)
# PSAPI is the Process Status API
set(PLATFORM_LIBRARIES ${PLATFORM_LIBRARIES} psapi imm32 version)
set(PLATFORM_LIBRARIES ${PLATFORM_LIBRARIES} psapi imm32 version crypt32 rpcrt4 gdi32 wldap32 mswsock)
endif()
elseif (PLATFORM_HAIKU)
# Haiku is so special :)
@ -655,6 +744,8 @@ elseif (CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU|SunOS)$")
set(PLATFORM_LIBRARIES rt)
endif()
message(STATUS "Platform Libraries: ${PLATFORM_LIBRARIES}")
add_subdirectory(externals)
# pass targets from externals

5
CMakeModules/CPMUtil.cmake

@ -542,10 +542,11 @@ function(AddCIPackage)
PACKAGE
EXTENSION
MIN_VERSION
DISABLED_PLATFORMS
)
cmake_parse_arguments(PKG_ARGS "" "${oneValueArgs}" "" ${ARGN})
set(multiValueArgs DISABLED_PLATFORMS)
cmake_parse_arguments(PKG_ARGS "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(NOT DEFINED PKG_ARGS_VERSION)
message(FATAL_ERROR "[CPMUtil] VERSION is required")

7
CMakeModules/FindOpus.cmake

@ -1,3 +1,6 @@
# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-FileCopyrightText: 2022 yuzu Emulator Project
# SPDX-License-Identifier: GPL-2.0-or-later
@ -10,6 +13,10 @@ find_package_handle_standard_args(Opus
VERSION_VAR OPUS_VERSION
)
if (PLATFORM_MSYS)
FixMsysPath(PkgConfig::OPUS)
endif()
if (Opus_FOUND AND NOT TARGET Opus::opus)
add_library(Opus::opus ALIAS PkgConfig::OPUS)
endif()

7
CMakeModules/FindSPIRV-Tools.cmake

@ -1,3 +1,6 @@
# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-FileCopyrightText: 2022 yuzu Emulator Project
# SPDX-License-Identifier: GPL-2.0-or-later
@ -10,6 +13,10 @@ find_package_handle_standard_args(SPIRV-Tools
VERSION_VAR SPIRV-Tools_VERSION
)
if (PLATFORM_MSYS)
FixMsysPath(PkgConfig::SPIRV-Tools)
endif()
if (SPIRV-Tools_FOUND AND NOT TARGET SPIRV-Tools::SPIRV-Tools)
if (TARGET SPIRV-Tools)
add_library(SPIRV-Tools::SPIRV-Tools ALIAS SPIRV-Tools)

7
CMakeModules/Findenet.cmake

@ -1,3 +1,6 @@
# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-FileCopyrightText: 2022 Alexandre Bouvier <contact@amb.tf>
#
# SPDX-License-Identifier: GPL-3.0-or-later
@ -11,6 +14,10 @@ find_package_handle_standard_args(enet
VERSION_VAR ENET_VERSION
)
if (PLATFORM_MSYS)
FixMsysPath(PkgConfig::ENET)
endif()
if (enet_FOUND AND NOT TARGET enet::enet)
add_library(enet::enet ALIAS PkgConfig::ENET)
endif()

7
CMakeModules/Findlibusb.cmake

@ -1,3 +1,6 @@
# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-FileCopyrightText: 2022 Alexandre Bouvier <contact@amb.tf>
#
# SPDX-License-Identifier: GPL-3.0-or-later
@ -11,6 +14,10 @@ find_package_handle_standard_args(libusb
VERSION_VAR LIBUSB_VERSION
)
if (PLATFORM_MSYS)
FixMsysPath(PkgConfig::LIBUSB)
endif()
if (libusb_FOUND AND NOT TARGET libusb::usb)
add_library(libusb::usb ALIAS PkgConfig::LIBUSB)
endif()

8
CMakeModules/Findlz4.cmake

@ -1,3 +1,6 @@
# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-FileCopyrightText: 2022 yuzu Emulator Project
# SPDX-License-Identifier: GPL-2.0-or-later
@ -9,6 +12,11 @@ if (lz4_CONSIDERED_CONFIGS)
else()
find_package(PkgConfig QUIET)
pkg_search_module(LZ4 QUIET IMPORTED_TARGET liblz4)
if (PLATFORM_MSYS)
FixMsysPath(PkgConfig::LZ4)
endif()
find_package_handle_standard_args(lz4
REQUIRED_VARS LZ4_LINK_LIBRARIES
VERSION_VAR LZ4_VERSION

28
CMakeModules/Findzstd.cmake

@ -6,22 +6,34 @@
include(FindPackageHandleStandardArgs)
find_package(PkgConfig QUIET)
pkg_search_module(ZSTD QUIET IMPORTED_TARGET libzstd)
find_package_handle_standard_args(zstd
find_package(zstd QUIET CONFIG)
if (zstd_CONSIDERED_CONFIGS)
find_package_handle_standard_args(zstd CONFIG_MODE)
else()
find_package(PkgConfig QUIET)
pkg_search_module(ZSTD QUIET IMPORTED_TARGET libzstd)
find_package_handle_standard_args(zstd
REQUIRED_VARS ZSTD_LINK_LIBRARIES
VERSION_VAR ZSTD_VERSION
)
)
endif()
if (zstd_FOUND AND NOT TARGET zstd::zstd)
if (TARGET zstd::libzstd_shared)
if (TARGET zstd::libzstd_shared AND NOT YUZU_STATIC_BUILD)
add_library(zstd::zstd ALIAS zstd::libzstd_shared)
add_library(zstd::libzstd ALIAS zstd::libzstd_shared)
elseif (TARGET zstd::libzstd_static)
add_library(zstd::zstd ALIAS zstd::libzstd_static)
add_library(zstd::libzstd ALIAS zstd::libzstd_static)
else()
add_library(zstd::zstd ALIAS PkgConfig::ZSTD)
add_library(zstd::libzstd ALIAS PkgConfig::ZSTD)
endif()
endif()
get_target_property(ZSTD_TARGET zstd::zstd ALIASED_TARGET)
if (NOT TARGET zstd::libzstd)
if (ZSTD_TARGET)
add_library(zstd::libzstd ALIAS ${ZSTD_TARGET})
else()
add_library(zstd::libzstd ALIAS zstd::zstd)
endif()
endif()

21
CMakeModules/FixMsysPaths.cmake

@ -0,0 +1,21 @@
# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
# SPDX-License-Identifier: GPL-3.0-or-later
function(FixMsysPath target)
get_target_property(include_dir ${target} INTERFACE_INCLUDE_DIRECTORIES)
if (NOT (include_dir MATCHES "^/"))
return()
endif()
set(root_default $ENV{MSYS2_LOCATION})
if (root_default STREQUAL "")
set(root_default "C:/msys64")
endif()
set(MSYS_ROOT_PATH ${root_default} CACHE STRING "Location of the MSYS2 root")
set(include_dir "C:/msys64${include_dir}")
set_target_properties(${target} PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${include_dir})
endfunction()

2
externals/ffmpeg/CMakeLists.txt

@ -89,7 +89,7 @@ if (UNIX AND NOT ANDROID)
endif(CUDA_FOUND)
endif()
if (VDPAU_FOUND)
if (VDPAU_FOUND AND NOT APPLE)
list(APPEND FFmpeg_HWACCEL_FLAGS
--enable-vdpau
--enable-hwaccel=h264_vdpau

3
externals/ffmpeg/cpmfile.json

@ -15,8 +15,7 @@
"disabled_platforms": [
"freebsd-amd64",
"solaris-amd64",
"openbsd-amd64",
"macos-universal"
"openbsd-amd64"
]
}
}

22
src/CMakeLists.txt

@ -176,16 +176,28 @@ else()
add_compile_definitions(_FILE_OFFSET_BITS=64)
endif()
if (YUZU_STATIC_BUILD)
add_compile_definitions(QT_STATICPLUGIN)
# macos doesn't even let you make static executables... wtf?
if (NOT APPLE)
add_compile_options(-static)
if (YUZU_STATIC_BUILD)
# yuzu-cmd requires us to explicitly link libpthread, libgcc, and libstdc++ as static
# At a guess, it's probably because Qt handles the Qt executable for us, whereas this does not
add_link_options(-static -lpthread)
add_link_options(-static-libgcc -static-libstdc++)
endif()
endif()
endif()
if (MINGW)
add_compile_definitions(MINGW_HAS_SECURE_API)
# Only windows has this requirement, thanks windows
if (WIN32)
if (WIN32 AND ARCHITECTURE_x86_64)
add_compile_options("-msse4.1")
endif()
if (MINGW_STATIC_BUILD)
add_compile_definitions(QT_STATICPLUGIN)
add_compile_options("-static")
endif()
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR MINGW)

2
src/android/app/src/main/jni/native.cpp

@ -4,6 +4,8 @@
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#define VMA_IMPLEMENTATION
#include "video_core/vulkan_common/vma.h"
#include <codecvt>
#include <locale>

2
src/common/CMakeLists.txt

@ -252,7 +252,7 @@ if(CXX_CLANG)
endif()
if (BOOST_NO_HEADERS)
target_link_libraries(common PUBLIC Boost::algorithm Boost::icl Boost::pool Boost::filesystem)
target_link_libraries(common PUBLIC Boost::algorithm Boost::icl Boost::pool)
else()
target_link_libraries(common PUBLIC Boost::headers)
endif()

8
src/core/CMakeLists.txt

@ -1199,10 +1199,10 @@ else()
target_link_libraries(core PUBLIC Boost::headers)
endif()
target_link_libraries(core PRIVATE fmt::fmt nlohmann_json::nlohmann_json RenderDoc::API MbedTLS::mbedcrypto MbedTLS::mbedtls)
if (MINGW)
target_link_libraries(core PRIVATE ws2_32 mswsock wlanapi)
endif()
target_link_libraries(core PRIVATE fmt::fmt nlohmann_json::nlohmann_json RenderDoc::API MbedTLS::mbedcrypto${YUZU_STATIC_SUFFIX} MbedTLS::mbedtls${YUZU_STATIC_SUFFIX})
# if (MINGW)
# target_link_libraries(core PRIVATE ws2_32 mswsock wlanapi)
# endif()
if (ENABLE_WEB_SERVICE)
target_compile_definitions(core PUBLIC ENABLE_WEB_SERVICE)

5
src/dedicated_room/CMakeLists.txt

@ -4,9 +4,6 @@
# SPDX-FileCopyrightText: 2017 Citra Emulator Project
# SPDX-License-Identifier: GPL-2.0-or-later
# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
# SPDX-License-Identifier: GPL-3.0-or-later
add_library(yuzu-room STATIC EXCLUDE_FROM_ALL
yuzu_room.cpp
yuzu_room.h
@ -19,7 +16,7 @@ if (ENABLE_WEB_SERVICE)
target_link_libraries(yuzu-room PRIVATE web_service)
endif()
target_link_libraries(yuzu-room PRIVATE MbedTLS::mbedcrypto MbedTLS::mbedtls)
target_link_libraries(yuzu-room PRIVATE MbedTLS::mbedcrypto${YUZU_STATIC_SUFFIX} MbedTLS::mbedtls${YUZU_STATIC_SUFFIX})
if (MSVC)
target_link_libraries(yuzu-room PRIVATE getopt)
endif()

9
src/tests/CMakeLists.txt

@ -27,3 +27,12 @@ target_link_libraries(tests PRIVATE common core input_common video_core)
target_link_libraries(tests PRIVATE ${PLATFORM_LIBRARIES} Catch2::Catch2WithMain Threads::Threads)
add_test(NAME tests COMMAND tests)
# needed for vma
if (NOT MSVC)
target_compile_options(tests PRIVATE
-Wno-conversion
-Wno-unused-variable
-Wno-unused-parameter
-Wno-missing-field-initializers)
endif()

6
src/tests/common/bit_field.cpp

@ -1,6 +1,12 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: 2019 Citra Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#define VMA_IMPLEMENTATION
#include "video_core/vulkan_common/vma.h"
#include <array>
#include <cstring>
#include <type_traits>

4
src/video_core/CMakeLists.txt

@ -312,7 +312,6 @@ add_library(video_core STATIC
vulkan_common/vulkan_wrapper.h
vulkan_common/nsight_aftermath_tracker.cpp
vulkan_common/nsight_aftermath_tracker.h
vulkan_common/vma.cpp
vulkan_common/vma.h
vulkan_common/vulkan.h
)
@ -369,9 +368,6 @@ else()
# xbyak
set_source_files_properties(macro/macro_jit_x64.cpp PROPERTIES COMPILE_OPTIONS "-Wno-conversion;-Wno-shadow")
# VMA
set_source_files_properties(vulkan_common/vma.cpp PROPERTIES COMPILE_OPTIONS "-Wno-conversion;-Wno-unused-variable;-Wno-unused-parameter;-Wno-missing-field-initializers")
# Get around GCC failing with intrinsics in Debug
if (CXX_GCC AND CMAKE_BUILD_TYPE MATCHES "Debug")
set_source_files_properties(host1x/vic.cpp PROPERTIES COMPILE_OPTIONS "-O2")

6
src/video_core/vulkan_common/vma.cpp

@ -1,6 +0,0 @@
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#define VMA_IMPLEMENTATION
#include "video_core/vulkan_common/vma.h"

44
src/yuzu/CMakeLists.txt

@ -370,15 +370,18 @@ if (APPLE)
if (YUZU_USE_BUNDLED_MOLTENVK)
set(MOLTENVK_PLATFORM "macOS")
set(MOLTENVK_VERSION "v1.3.0")
set(MOLTENVK_VERSION "v1.4.0")
download_moltenvk(${MOLTENVK_PLATFORM} ${MOLTENVK_VERSION})
endif()
set(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib")
find_library(MOLTENVK_LIBRARY MoltenVK REQUIRED)
message(STATUS "Using MoltenVK at ${MOLTENVK_LIBRARY}.")
set_source_files_properties(${MOLTENVK_LIBRARY} PROPERTIES MACOSX_PACKAGE_LOCATION Frameworks
set_source_files_properties(${MOLTENVK_LIBRARY} PROPERTIES
MACOSX_PACKAGE_LOCATION Frameworks
XCODE_FILE_ATTRIBUTES "CodeSignOnCopy")
target_sources(yuzu PRIVATE ${MOLTENVK_LIBRARY})
elseif(WIN32)
# compile as a win32 gui application instead of a console application
target_link_libraries(yuzu PRIVATE Qt6::EntryPointPrivate)
@ -447,4 +450,39 @@ if (YUZU_ROOM)
target_link_libraries(yuzu PRIVATE Qt6::Widgets)
endif()
if (NOT MSVC AND (APPLE OR NOT YUZU_STATIC_BUILD))
# needed for vma
target_compile_options(yuzu PRIVATE
-Wno-conversion
-Wno-unused-variable
-Wno-unused-parameter
-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)
extra_libs(wsock32 ws2_32 crypt32 mswsock wlanapi)
endif()
create_target_directory_groups(yuzu)

18
src/yuzu/main_window.cpp

@ -1,6 +1,11 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// Qt on macOS doesn't define VMA shit
#if defined(QT_STATICPLUGIN) && !defined(__APPLE__)
#undef VMA_IMPLEMENTATION
#endif
#include "common/fs/ryujinx_compat.h"
#include "main_window.h"
#include "network/network.h"
@ -44,6 +49,7 @@
// Qt Stuff //
#define QT_NO_OPENGL
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
#include <QStyleHints>
#endif
@ -263,7 +269,14 @@ using namespace Common::Literals;
#endif
#ifdef QT_STATICPLUGIN
#include <QtPlugin>
#if defined(_WIN32)
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin);
#elif defined(__APPLE__)
Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin)
#endif
#endif
#ifdef _WIN32
@ -4897,3 +4910,8 @@ void VolumeButton::ResetMultiplier() {
#ifdef main
#undef main
#endif
#if !defined(QT_STATICPLUGIN) || defined(__APPLE__)
#define VMA_IMPLEMENTATION
#include "video_core/vulkan_common/vma.h"
#endif

9
src/yuzu_cmd/CMakeLists.txt

@ -56,3 +56,12 @@ if(WIN32)
endif()
create_target_directory_groups(yuzu-cmd)
# needed for vma
if (NOT MSVC)
target_compile_options(yuzu-cmd PRIVATE
-Wno-conversion
-Wno-unused-variable
-Wno-unused-parameter
-Wno-missing-field-initializers)
endif()

6
src/yuzu_cmd/yuzu.cpp

@ -4,12 +4,10 @@
// SPDX-FileCopyrightText: 2014 Citra Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <chrono>
#include <iostream>
#include <memory>
#include <regex>
#include <string>
#include <thread>
#include <fmt/ostream.h>
@ -17,7 +15,6 @@
#include "common/logging/backend.h"
#include "common/logging/log.h"
#include "common/scm_rev.h"
#include "common/scope_exit.h"
#include "common/settings.h"
#include "common/string_util.h"
#include "core/core.h"
@ -453,3 +450,6 @@ int main(int argc, char** argv) {
detached_tasks.WaitForAllTasks();
return 0;
}
#define VMA_IMPLEMENTATION
#include "video_core/vulkan_common/vma.h"

5
src/yuzu_room_standalone/CMakeLists.txt

@ -1,3 +1,6 @@
# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
# SPDX-License-Identifier: GPL-3.0-or-later
add_executable(yuzu_room_standalone
yuzu_room_standalone.cpp
)
@ -9,3 +12,5 @@ target_link_libraries(yuzu_room_standalone PRIVATE yuzu-room)
if(UNIX AND NOT APPLE)
install(TARGETS yuzu_room_standalone RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
endif()
create_target_directory_groups(yuzu_room_standalone)
Loading…
Cancel
Save