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
35 lines
953 B
CMake
35 lines
953 B
CMake
# 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
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
|
|
find_package(lz4 QUIET CONFIG)
|
|
if (lz4_CONSIDERED_CONFIGS)
|
|
find_package_handle_standard_args(lz4 CONFIG_MODE)
|
|
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
|
|
)
|
|
endif()
|
|
|
|
if (lz4_FOUND AND NOT TARGET lz4::lz4)
|
|
if (TARGET LZ4::lz4_shared)
|
|
add_library(lz4::lz4 ALIAS LZ4::lz4_shared)
|
|
elseif (TARGET LZ4::lz4_static)
|
|
add_library(lz4::lz4 ALIAS LZ4::lz4_static)
|
|
else()
|
|
add_library(lz4::lz4 ALIAS PkgConfig::LZ4)
|
|
endif()
|
|
endif()
|