mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-08-14 04:24:31 +00:00
[cmake] Simplify DetectPlatform and normalize platform names (#4183)
Since 3.25 introduced `LINUX` and `BSD`, use them, and standardize other platforms to that style Signed-off-by: crueter <crueter@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4183 Reviewed-by: Samuel <lizzie@eden-emu.dev> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
This commit is contained in:
+15
-15
@@ -28,23 +28,23 @@ if (NOT DEFINED ARCHITECTURE)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Needed for FFmpeg w/ VAAPI and DRM
|
# Needed for FFmpeg w/ VAAPI and DRM
|
||||||
if (PLATFORM_OPENBSD)
|
if (OPENBSD)
|
||||||
# OpenBSD 7.8 broke libcxx when upgrading, so we must define the PSTL backend manually
|
# OpenBSD 7.8 broke libcxx when upgrading, so we must define the PSTL backend manually
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${CMAKE_SYSROOT}/usr/X11R6/include -D_LIBCPP_PSTL_BACKEND_SERIAL=1")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${CMAKE_SYSROOT}/usr/X11R6/include -D_LIBCPP_PSTL_BACKEND_SERIAL=1")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${CMAKE_SYSROOT}/usr/X11R6/include -D_LIBCPP_PSTL_BACKEND_SERIAL=1")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${CMAKE_SYSROOT}/usr/X11R6/include -D_LIBCPP_PSTL_BACKEND_SERIAL=1")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L${CMAKE_SYSROOT}/usr/X11R6/lib")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L${CMAKE_SYSROOT}/usr/X11R6/lib")
|
||||||
elseif (PLATFORM_NETBSD)
|
elseif (NETBSD)
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${CMAKE_SYSROOT}/usr/X11R7/include -I${CMAKE_SYSROOT}/usr/pkg/include/c++/v1")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${CMAKE_SYSROOT}/usr/X11R7/include -I${CMAKE_SYSROOT}/usr/pkg/include/c++/v1")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${CMAKE_SYSROOT}/usr/X11R7/include -I${CMAKE_SYSROOT}/usr/pkg/include/c++/v1")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${CMAKE_SYSROOT}/usr/X11R7/include -I${CMAKE_SYSROOT}/usr/pkg/include/c++/v1")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L${CMAKE_SYSROOT}/usr/X11R7/lib")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L${CMAKE_SYSROOT}/usr/X11R7/lib")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# NetBSD: Fun for the whole family!
|
# NetBSD: Fun for the whole family!
|
||||||
if (PLATFORM_NETBSD)
|
if (NETBSD)
|
||||||
set(ENV{PKG_CONFIG_PATH} "${PKG_CONFIG_PATH}:${CMAKE_SYSROOT}/usr/pkg/lib/ffmpeg7/pkgconfig")
|
set(ENV{PKG_CONFIG_PATH} "${PKG_CONFIG_PATH}:${CMAKE_SYSROOT}/usr/pkg/lib/ffmpeg7/pkgconfig")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
cmake_dependent_option(YUZU_STATIC_ROOM "Build a static room executable only (CI only)" OFF "PLATFORM_LINUX" OFF)
|
cmake_dependent_option(YUZU_STATIC_ROOM "Build a static room executable only (CI only)" OFF "LINUX" OFF)
|
||||||
if (YUZU_STATIC_ROOM)
|
if (YUZU_STATIC_ROOM)
|
||||||
set(YUZU_ROOM ON)
|
set(YUZU_ROOM ON)
|
||||||
set(YUZU_ROOM_STANDALONE ON)
|
set(YUZU_ROOM_STANDALONE ON)
|
||||||
@@ -224,7 +224,7 @@ endif()
|
|||||||
|
|
||||||
# ffmpeg
|
# ffmpeg
|
||||||
option(YUZU_USE_BUNDLED_FFMPEG "Download bundled FFmpeg" ${EXT_DEFAULT})
|
option(YUZU_USE_BUNDLED_FFMPEG "Download bundled FFmpeg" ${EXT_DEFAULT})
|
||||||
cmake_dependent_option(YUZU_USE_EXTERNAL_FFMPEG "Build FFmpeg from external source" "${PLATFORM_SUN}" "NOT WIN32 AND NOT ANDROID" OFF)
|
cmake_dependent_option(YUZU_USE_EXTERNAL_FFMPEG "Build FFmpeg from external source" "${SOLARIS}" "NOT WIN32 AND NOT ANDROID" OFF)
|
||||||
|
|
||||||
# sirit
|
# sirit
|
||||||
set(BUNDLED_SIRIT_DEFAULT OFF)
|
set(BUNDLED_SIRIT_DEFAULT OFF)
|
||||||
@@ -235,7 +235,7 @@ endif()
|
|||||||
option(YUZU_USE_BUNDLED_SIRIT "Download bundled sirit" ${BUNDLED_SIRIT_DEFAULT})
|
option(YUZU_USE_BUNDLED_SIRIT "Download bundled sirit" ${BUNDLED_SIRIT_DEFAULT})
|
||||||
|
|
||||||
# FreeBSD 15+ has libusb, versions below should disable it
|
# FreeBSD 15+ has libusb, versions below should disable it
|
||||||
cmake_dependent_option(ENABLE_LIBUSB "Enable the use of LibUSB" ON "WIN32 OR PLATFORM_LINUX OR PLATFORM_FREEBSD OR APPLE" OFF)
|
cmake_dependent_option(ENABLE_LIBUSB "Enable the use of LibUSB" ON "WIN32 OR LINUX OR FREEBSD OR APPLE" OFF)
|
||||||
|
|
||||||
cmake_dependent_option(ENABLE_OPENGL "Enable OpenGL" ON "NOT (WIN32 AND ARCHITECTURE_arm64) AND NOT APPLE" OFF)
|
cmake_dependent_option(ENABLE_OPENGL "Enable OpenGL" ON "NOT (WIN32 AND ARCHITECTURE_arm64) AND NOT APPLE" OFF)
|
||||||
mark_as_advanced(FORCE ENABLE_OPENGL)
|
mark_as_advanced(FORCE ENABLE_OPENGL)
|
||||||
@@ -249,7 +249,7 @@ option(YUZU_TESTS "Compile tests" "${BUILD_TESTING}")
|
|||||||
|
|
||||||
# Install udev rules on Linux (mainly for gyros)
|
# Install udev rules on Linux (mainly for gyros)
|
||||||
# Only acts on joysticks and nothing else.
|
# Only acts on joysticks and nothing else.
|
||||||
cmake_dependent_option(YUZU_INSTALL_UDEV_RULES "Install udev rules for gyro access" OFF "PLATFORM_LINUX" OFF)
|
cmake_dependent_option(YUZU_INSTALL_UDEV_RULES "Install udev rules for gyro access" OFF "LINUX" OFF)
|
||||||
|
|
||||||
option(YUZU_DOWNLOAD_ANDROID_VVL "Download validation layer binary for android" ON)
|
option(YUZU_DOWNLOAD_ANDROID_VVL "Download validation layer binary for android" ON)
|
||||||
|
|
||||||
@@ -262,7 +262,7 @@ cmake_dependent_option(YUZU_ROOM_STANDALONE "Enable standalone room executable"
|
|||||||
|
|
||||||
cmake_dependent_option(YUZU_CMD "Compile the eden-cli executable" ON "NOT ANDROID" OFF)
|
cmake_dependent_option(YUZU_CMD "Compile the eden-cli executable" ON "NOT ANDROID" OFF)
|
||||||
|
|
||||||
cmake_dependent_option(YUZU_CRASH_DUMPS "Compile crash dump (Minidump) support" OFF "WIN32 OR PLATFORM_LINUX" OFF)
|
cmake_dependent_option(YUZU_CRASH_DUMPS "Compile crash dump (Minidump) support" OFF "WIN32 OR LINUX" OFF)
|
||||||
|
|
||||||
option(YUZU_DOWNLOAD_TIME_ZONE_DATA "Always download time zone binaries" ON)
|
option(YUZU_DOWNLOAD_TIME_ZONE_DATA "Always download time zone binaries" ON)
|
||||||
set(YUZU_TZDB_PATH "" CACHE STRING "Path to a pre-downloaded timezone database")
|
set(YUZU_TZDB_PATH "" CACHE STRING "Path to a pre-downloaded timezone database")
|
||||||
@@ -272,7 +272,7 @@ cmake_dependent_option(YUZU_USE_BUNDLED_MOLTENVK "Download bundled MoltenVK lib"
|
|||||||
option(YUZU_DISABLE_LLVM "Disable LLVM (useful for CI)" OFF)
|
option(YUZU_DISABLE_LLVM "Disable LLVM (useful for CI)" OFF)
|
||||||
|
|
||||||
set(DEFAULT_YUZU_USE_BUNDLED_OPENSSL OFF)
|
set(DEFAULT_YUZU_USE_BUNDLED_OPENSSL OFF)
|
||||||
if (EXT_DEFAULT OR PLATFORM_SUN OR PLATFORM_OPENBSD)
|
if (EXT_DEFAULT OR SOLARIS OR OPENBSD)
|
||||||
set(DEFAULT_YUZU_USE_BUNDLED_OPENSSL ON)
|
set(DEFAULT_YUZU_USE_BUNDLED_OPENSSL ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -295,7 +295,7 @@ if(EXISTS ${PROJECT_SOURCE_DIR}/hooks/pre-commit AND NOT EXISTS ${PROJECT_SOURCE
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (ARCHITECTURE_arm64 AND (ANDROID OR PLATFORM_LINUX))
|
if (ARCHITECTURE_arm64 AND (ANDROID OR LINUX))
|
||||||
set(HAS_NCE 1)
|
set(HAS_NCE 1)
|
||||||
add_compile_definitions(HAS_NCE=1)
|
add_compile_definitions(HAS_NCE=1)
|
||||||
endif()
|
endif()
|
||||||
@@ -304,7 +304,7 @@ if (YUZU_ROOM)
|
|||||||
add_compile_definitions(YUZU_ROOM)
|
add_compile_definitions(YUZU_ROOM)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (UNIX AND NOT (PLATFORM_LINUX OR WIN32))
|
if (UNIX AND NOT (LINUX OR WIN32))
|
||||||
if(CXX_APPLE OR CXX_CLANG)
|
if(CXX_APPLE OR CXX_CLANG)
|
||||||
# libc++ has stop_token and jthread as experimental
|
# libc++ has stop_token and jthread as experimental
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexperimental-library")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexperimental-library")
|
||||||
@@ -418,7 +418,7 @@ if (Boost_ADDED)
|
|||||||
|
|
||||||
if (NOT MSVC OR CXX_CLANG)
|
if (NOT MSVC OR CXX_CLANG)
|
||||||
# boost sucks
|
# boost sucks
|
||||||
if (PLATFORM_SUN)
|
if (SOLARIS)
|
||||||
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:-pthreads>)
|
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:-pthreads>)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -522,9 +522,9 @@ elseif (WIN32)
|
|||||||
# PSAPI is the Process Status API
|
# PSAPI is the Process Status API
|
||||||
set(PLATFORM_LIBRARIES ${PLATFORM_LIBRARIES} psapi imm32 version crypt32 rpcrt4 gdi32 wldap32 mswsock)
|
set(PLATFORM_LIBRARIES ${PLATFORM_LIBRARIES} psapi imm32 version crypt32 rpcrt4 gdi32 wldap32 mswsock)
|
||||||
endif()
|
endif()
|
||||||
elseif (PLATFORM_MANAGARM)
|
elseif (MANAGARM)
|
||||||
set(PLATFORM_LIBRARIES iconv intl)
|
set(PLATFORM_LIBRARIES iconv intl)
|
||||||
elseif (PLATFORM_HAIKU)
|
elseif (HAIKUOS)
|
||||||
# Haiku is so special :)
|
# Haiku is so special :)
|
||||||
set(PLATFORM_LIBRARIES bsd /boot/system/lib/libnetwork.so)
|
set(PLATFORM_LIBRARIES bsd /boot/system/lib/libnetwork.so)
|
||||||
elseif (CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU|SunOS)$")
|
elseif (CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU|SunOS)$")
|
||||||
@@ -618,7 +618,7 @@ if (ENABLE_QT)
|
|||||||
|
|
||||||
# Best practice is to ask for all components at once, so they are from the same version
|
# Best practice is to ask for all components at once, so they are from the same version
|
||||||
set(YUZU_QT_COMPONENTS Core Widgets Charts Concurrent Gui)
|
set(YUZU_QT_COMPONENTS Core Widgets Charts Concurrent Gui)
|
||||||
if (PLATFORM_LINUX OR PLATFORM_FREEBSD)
|
if (LINUX OR FREEBSD)
|
||||||
list(APPEND YUZU_QT_COMPONENTS DBus)
|
list(APPEND YUZU_QT_COMPONENTS DBus)
|
||||||
# yes Qt, we get it
|
# yes Qt, we get it
|
||||||
set(QT_NO_PRIVATE_MODULE_WARNING ON)
|
set(QT_NO_PRIVATE_MODULE_WARNING ON)
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ find_package_handle_standard_args(Opus
|
|||||||
VERSION_VAR OPUS_VERSION
|
VERSION_VAR OPUS_VERSION
|
||||||
)
|
)
|
||||||
|
|
||||||
if (PLATFORM_MSYS)
|
if (MSYS2)
|
||||||
FixMsysPath(PkgConfig::OPUS)
|
FixMsysPath(PkgConfig::OPUS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ find_package_handle_standard_args(enet
|
|||||||
VERSION_VAR ENET_VERSION
|
VERSION_VAR ENET_VERSION
|
||||||
)
|
)
|
||||||
|
|
||||||
if (PLATFORM_MSYS)
|
if (MSYS2)
|
||||||
FixMsysPath(PkgConfig::ENET)
|
FixMsysPath(PkgConfig::ENET)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ find_package_handle_standard_args(libusb
|
|||||||
VERSION_VAR LIBUSB_VERSION
|
VERSION_VAR LIBUSB_VERSION
|
||||||
)
|
)
|
||||||
|
|
||||||
if (PLATFORM_MSYS)
|
if (MSYS2)
|
||||||
FixMsysPath(PkgConfig::LIBUSB)
|
FixMsysPath(PkgConfig::LIBUSB)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ else()
|
|||||||
find_package(PkgConfig QUIET)
|
find_package(PkgConfig QUIET)
|
||||||
pkg_search_module(LZ4 QUIET IMPORTED_TARGET liblz4)
|
pkg_search_module(LZ4 QUIET IMPORTED_TARGET liblz4)
|
||||||
|
|
||||||
if (PLATFORM_MSYS)
|
if (MSYS2)
|
||||||
FixMsysPath(PkgConfig::LZ4)
|
FixMsysPath(PkgConfig::LZ4)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
-1
@@ -164,7 +164,7 @@ if (NOT ANDROID)
|
|||||||
AddJsonPackage(sdl3)
|
AddJsonPackage(sdl3)
|
||||||
else()
|
else()
|
||||||
message(STATUS "Using bundled SDL3")
|
message(STATUS "Using bundled SDL3")
|
||||||
if (PLATFORM_FREEBSD)
|
if (FREEBSD)
|
||||||
set(BUILD_SHARED_LIBS ON)
|
set(BUILD_SHARED_LIBS ON)
|
||||||
endif()
|
endif()
|
||||||
AddJsonPackage(sdl3-ci)
|
AddJsonPackage(sdl3-ci)
|
||||||
|
|||||||
+23
-80
@@ -1,45 +1,46 @@
|
|||||||
# SPDX-FileCopyrightText: Copyright 2025 crueter
|
# SPDX-FileCopyrightText: Copyright 2026 crueter
|
||||||
# SPDX-License-Identifier: LGPL-3.0-or-later
|
# SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
|
||||||
## DetectPlatform ##
|
## DetectPlatform ##
|
||||||
|
|
||||||
# This is a small helper that sets PLATFORM_<platform> variables for various
|
# This is a small helper that sets platform variables for various
|
||||||
# operating systems and distributions. Note that Apple, Windows, Android, etc.
|
# operating systems and distributions. Note that Apple, Windows, Android, etc.
|
||||||
# are not covered, as CMake already does that for us.
|
# are not covered, as CMake already does that for us.
|
||||||
|
|
||||||
# It also sets CXX_<compiler> for the C++ compiler.
|
# It also sets CXX_<compiler> for the C++ compiler.
|
||||||
|
|
||||||
# Furthermore, some platforms have really silly requirements/quirks, so this
|
|
||||||
# also does a few of those.
|
|
||||||
|
|
||||||
# This module contains contributions from the Eden Emulator Project,
|
# This module contains contributions from the Eden Emulator Project,
|
||||||
# notably from crueter and Lizzie.
|
# notably from crueter and Lizzie.
|
||||||
|
|
||||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "SunOS")
|
if (${CMAKE_SYSTEM_NAME} STREQUAL "SunOS")
|
||||||
set(PLATFORM_SUN ON)
|
set(SOLARIS ON)
|
||||||
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "OpenOrbis")
|
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "OpenOrbis")
|
||||||
set(PLATFORM_PS4 ON)
|
set(OPENORBIS ON)
|
||||||
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "managarm")
|
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "managarm")
|
||||||
set(PLATFORM_MANAGARM ON)
|
set(MANAGARM ON)
|
||||||
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
|
||||||
set(PLATFORM_FREEBSD ON)
|
|
||||||
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
|
|
||||||
set(PLATFORM_OPENBSD ON)
|
|
||||||
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "NetBSD")
|
|
||||||
set(PLATFORM_NETBSD ON)
|
|
||||||
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "DragonFly")
|
|
||||||
set(PLATFORM_DRAGONFLYBSD ON)
|
|
||||||
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Haiku")
|
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Haiku")
|
||||||
set(PLATFORM_HAIKU ON)
|
set(HAIKUOS ON)
|
||||||
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
endif()
|
||||||
set(PLATFORM_LINUX ON)
|
|
||||||
|
# BSD
|
||||||
|
if (DEFINED BSD)
|
||||||
|
if ("${BSD}" STREQUAL "DragonFlyBSD")
|
||||||
|
set(DRAGONFLYBSD ON)
|
||||||
|
elseif ("${BSD}" STREQUAL "FreeBSD")
|
||||||
|
set(FREEBSD ON)
|
||||||
|
elseif ("${BSD}" STREQUAL "OpenBSD")
|
||||||
|
set(OPENBSD ON)
|
||||||
|
elseif ("${BSD}" STREQUAL "NetBSD")
|
||||||
|
set(NETBSD ON)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# dumb heuristic to detect msys2
|
# dumb heuristic to detect msys2
|
||||||
if (CMAKE_COMMAND MATCHES "msys64")
|
if (CMAKE_COMMAND MATCHES "msys64")
|
||||||
set(PLATFORM_MSYS ON)
|
set(MSYS2 ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# compiler checks
|
||||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
set(CXX_CLANG ON)
|
set(CXX_CLANG ON)
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
@@ -47,8 +48,6 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
|||||||
endif()
|
endif()
|
||||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
set(CXX_GCC ON)
|
set(CXX_GCC ON)
|
||||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
|
||||||
set(CXX_CL ON)
|
|
||||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")
|
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")
|
||||||
set(CXX_ICC ON)
|
set(CXX_ICC ON)
|
||||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
||||||
@@ -61,37 +60,13 @@ if(MINGW AND CXX_CLANG)
|
|||||||
set(CMAKE_SYSTEM_VERSION 10.0.0)
|
set(CMAKE_SYSTEM_VERSION 10.0.0)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# NB: this does not account for SPARC
|
|
||||||
if (PLATFORM_SUN)
|
|
||||||
# Terrific OpenIndiana pkg shenanigans
|
|
||||||
list(APPEND CMAKE_PREFIX_PATH
|
|
||||||
"${CMAKE_SYSROOT}/usr/lib/qt/6.6/lib/amd64/cmake")
|
|
||||||
list(APPEND CMAKE_MODULE_PATH
|
|
||||||
"${CMAKE_SYSROOT}/usr/lib/qt/6.6/lib/amd64/cmake")
|
|
||||||
|
|
||||||
# Amazing - absolutely incredible
|
|
||||||
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_SYSROOT}/usr/lib/amd64/cmake")
|
|
||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SYSROOT}/usr/lib/amd64/cmake")
|
|
||||||
|
|
||||||
# For some mighty reason, doing a normal release build sometimes
|
|
||||||
# may not trigger the proper -O3 switch to materialize
|
|
||||||
if (CMAKE_BUILD_TYPE MATCHES "Release")
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
|
|
||||||
endif()
|
|
||||||
if (CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo")
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2")
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# MSYS2 utilities
|
# MSYS2 utilities
|
||||||
|
|
||||||
# Sometimes, PkgConfig modules will incorrectly reference / when CMake
|
# Sometimes, PkgConfig modules will incorrectly reference / when CMake
|
||||||
# wants you to reference it as C:/msys64/. This function corrects that.
|
# wants you to reference it as C:/msys64/. This function corrects that.
|
||||||
# Example in a Find module:
|
# Example in a Find module:
|
||||||
#[[
|
#[[
|
||||||
if (PLATFORM_MSYS)
|
if (MSYS2)
|
||||||
FixMsysPath(PkgConfig::OPUS)
|
FixMsysPath(PkgConfig::OPUS)
|
||||||
endif()
|
endif()
|
||||||
]]
|
]]
|
||||||
@@ -116,41 +91,9 @@ function(FixMsysPath target)
|
|||||||
INTERFACE_INCLUDE_DIRECTORIES ${include_dir})
|
INTERFACE_INCLUDE_DIRECTORIES ${include_dir})
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
# MSYSTEM handling + program_path
|
# Saves linking time
|
||||||
if (PLATFORM_MSYS)
|
|
||||||
# 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()
|
|
||||||
|
|
||||||
# This saves a truly ridiculous amount of time during linking
|
|
||||||
# In my tests, without this, Eden takes 2 mins, with this, it takes 3-5 seconds
|
|
||||||
# or on GitHub Actions, 10 minutes -> 3 seconds
|
|
||||||
if (MINGW)
|
if (MINGW)
|
||||||
set(MINGW_FLAGS "-Wl,--strip-all -Wl,--gc-sections")
|
set(MINGW_FLAGS "-Wl,--strip-all -Wl,--gc-sections")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE
|
set(CMAKE_EXE_LINKER_FLAGS_RELEASE
|
||||||
"${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${MINGW_FLAGS}")
|
"${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${MINGW_FLAGS}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# awesome
|
|
||||||
if (PLATFORM_FREEBSD OR PLATFORM_DRAGONFLYBSD)
|
|
||||||
set(CMAKE_EXE_LINKER_FLAGS
|
|
||||||
"${CMAKE_EXE_LINKER_FLAGS} -L${CMAKE_SYSROOT}/usr/local/lib")
|
|
||||||
endif()
|
|
||||||
|
|||||||
Vendored
+5
-5
@@ -56,7 +56,7 @@ if (NOT YUZU_USE_BUNDLED_FFMPEG)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (PLATFORM_PS4 OR PLATFORM_MANAGARM)
|
if (OPENORBIS OR MANAGARM)
|
||||||
# Doesn't support VA-API, don't go thru the embarrassment of trying to enable it
|
# Doesn't support VA-API, don't go thru the embarrassment of trying to enable it
|
||||||
list(APPEND FFmpeg_HWACCEL_FLAGS --disable-vaapi)
|
list(APPEND FFmpeg_HWACCEL_FLAGS --disable-vaapi)
|
||||||
elseif (ANDROID)
|
elseif (ANDROID)
|
||||||
@@ -75,7 +75,7 @@ elseif (UNIX AND NOT DEFINED FFmpeg_IS_CROSS_COMPILING AND NOT ANDROID)
|
|||||||
if(X11_FOUND)
|
if(X11_FOUND)
|
||||||
if (NOT APPLE)
|
if (NOT APPLE)
|
||||||
# In Solaris needs explicit linking for ffmpeg which links to /lib/amd64/libX11.so
|
# In Solaris needs explicit linking for ffmpeg which links to /lib/amd64/libX11.so
|
||||||
if(PLATFORM_SUN)
|
if(SOLARIS)
|
||||||
list(APPEND FFmpeg_HWACCEL_LIBRARIES
|
list(APPEND FFmpeg_HWACCEL_LIBRARIES
|
||||||
X11
|
X11
|
||||||
"${CMAKE_SYSROOT}/usr/lib/xorg/amd64/libdrm.so")
|
"${CMAKE_SYSROOT}/usr/lib/xorg/amd64/libdrm.so")
|
||||||
@@ -158,7 +158,7 @@ elseif (UNIX AND NOT DEFINED FFmpeg_IS_CROSS_COMPILING AND NOT ANDROID)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (PLATFORM_PS4)
|
if (OPENORBIS)
|
||||||
list(APPEND FFmpeg_CROSS_COMPILE_LIBS
|
list(APPEND FFmpeg_CROSS_COMPILE_LIBS
|
||||||
-lkernel
|
-lkernel
|
||||||
-lSceUserService
|
-lSceUserService
|
||||||
@@ -172,7 +172,7 @@ if (PLATFORM_PS4)
|
|||||||
--extra-cxxflags=${CMAKE_SYSROOT}/usr/include
|
--extra-cxxflags=${CMAKE_SYSROOT}/usr/include
|
||||||
--extra-libs="${FFmpeg_CROSS_COMPILE_LIBS}"
|
--extra-libs="${FFmpeg_CROSS_COMPILE_LIBS}"
|
||||||
)
|
)
|
||||||
elseif (PLATFORM_MANAGARM)
|
elseif (MANAGARM)
|
||||||
# Required for proper stuff
|
# Required for proper stuff
|
||||||
list(APPEND FFmpeg_CROSS_COMPILE_FLAGS
|
list(APPEND FFmpeg_CROSS_COMPILE_FLAGS
|
||||||
--disable-pthreads
|
--disable-pthreads
|
||||||
@@ -299,7 +299,7 @@ else()
|
|||||||
set(FFmpeg_BUILD_LIBRARIES ${FFmpeg_LIBRARIES})
|
set(FFmpeg_BUILD_LIBRARIES ${FFmpeg_LIBRARIES})
|
||||||
|
|
||||||
# BSD make or Solaris make don't support ffmpeg make-j8
|
# BSD make or Solaris make don't support ffmpeg make-j8
|
||||||
if (PLATFORM_LINUX OR ANDROID OR APPLE OR WIN32 OR PLATFORM_FREEBSD)
|
if (LINUX OR ANDROID OR APPLE OR WIN32 OR FREEBSD)
|
||||||
set(FFmpeg_MAKE_ARGS -j${SYSTEM_THREADS})
|
set(FFmpeg_MAKE_ARGS -j${SYSTEM_THREADS})
|
||||||
else()
|
else()
|
||||||
set(FFmpeg_MAKE_ARGS "")
|
set(FFmpeg_MAKE_ARGS "")
|
||||||
|
|||||||
Vendored
+1
-1
@@ -11,7 +11,7 @@ if (NOT libusb_ADDED)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# TODO: *BSD fails to compile--may need different configs/symbols
|
# TODO: *BSD fails to compile--may need different configs/symbols
|
||||||
if (MINGW OR PLATFORM_LINUX OR APPLE)
|
if (MINGW OR LINUX OR APPLE)
|
||||||
set(LIBUSB_FOUND ON CACHE BOOL "libusb is present" FORCE)
|
set(LIBUSB_FOUND ON CACHE BOOL "libusb is present" FORCE)
|
||||||
set(LIBUSB_VERSION "1.0.24" CACHE STRING "libusb version string" FORCE)
|
set(LIBUSB_VERSION "1.0.24" CACHE STRING "libusb version string" FORCE)
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -193,7 +193,7 @@ else()
|
|||||||
|
|
||||||
if (ARCHITECTURE_x86_64)
|
if (ARCHITECTURE_x86_64)
|
||||||
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:-mcx16>)
|
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:-mcx16>)
|
||||||
if (PLATFORM_LINUX OR PLATFORM_FREEBSD)
|
if (LINUX OR FREEBSD)
|
||||||
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:-mtls-dialect=gnu2>)
|
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:-mtls-dialect=gnu2>)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -1173,7 +1173,7 @@ add_library(core STATIC
|
|||||||
|
|
||||||
if (ENABLE_WIFI_SCAN)
|
if (ENABLE_WIFI_SCAN)
|
||||||
target_sources(core PRIVATE internal_network/wifi_scanner.cpp)
|
target_sources(core PRIVATE internal_network/wifi_scanner.cpp)
|
||||||
if (PLATFORM_LINUX)
|
if (LINUX)
|
||||||
target_link_libraries(core PRIVATE iw)
|
target_link_libraries(core PRIVATE iw)
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ endif()
|
|||||||
# Dynarmic project options
|
# Dynarmic project options
|
||||||
option(DYNARMIC_ENABLE_CPU_FEATURE_DETECTION "Turning this off causes dynarmic to assume the host CPU doesn't support anything later than SSE3" ON)
|
option(DYNARMIC_ENABLE_CPU_FEATURE_DETECTION "Turning this off causes dynarmic to assume the host CPU doesn't support anything later than SSE3" ON)
|
||||||
|
|
||||||
if (PLATFORM_OPENBSD OR PLATFORM_DRAGONFLY OR PLATFORM_NETBSD)
|
if (OPENBSD OR DRAGONFLY OR NETBSD)
|
||||||
set(REQUIRE_WX ON)
|
set(REQUIRE_WX ON)
|
||||||
else()
|
else()
|
||||||
set(REQUIRE_WX OFF)
|
set(REQUIRE_WX OFF)
|
||||||
|
|||||||
@@ -363,7 +363,7 @@ elseif (APPLE)
|
|||||||
backend/exception_handler_macos_mig.c
|
backend/exception_handler_macos_mig.c
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
elseif (UNIX AND NOT PLATFORM_HAIKU)
|
elseif (UNIX AND NOT HAIKUOS)
|
||||||
# Haiku lacks <ucontext.h>
|
# Haiku lacks <ucontext.h>
|
||||||
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
target_link_libraries(dynarmic PRIVATE rt)
|
target_link_libraries(dynarmic PRIVATE rt)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
# SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
# SPDX-FileCopyrightText: 2022 yuzu Emulator Project
|
# SPDX-FileCopyrightText: 2022 yuzu Emulator Project
|
||||||
@@ -28,6 +28,6 @@ if (ENABLE_WEB_SERVICE)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Solaris uses /lib/amd64/libsocket.so and /lib/amd64/libnsl.so
|
# Solaris uses /lib/amd64/libsocket.so and /lib/amd64/libnsl.so
|
||||||
if (PLATFORM_SUN)
|
if (SOLARIS)
|
||||||
target_link_libraries(network PRIVATE socket nsl)
|
target_link_libraries(network PRIVATE socket nsl)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ set(SHADER_FILES
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/sgsr1_shader_mobile_edge_direction.frag
|
${CMAKE_CURRENT_SOURCE_DIR}/sgsr1_shader_mobile_edge_direction.frag
|
||||||
)
|
)
|
||||||
|
|
||||||
if (PLATFORM_HAIKU)
|
if (HAIKUOS)
|
||||||
# glslangValidator WILL crash, glslang will not
|
# glslangValidator WILL crash, glslang will not
|
||||||
set(GLSLANGVALIDATOR "glslang")
|
set(GLSLANGVALIDATOR "glslang")
|
||||||
else()
|
else()
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|||||||
|
|
||||||
# Set the RPATH for Qt Libraries
|
# Set the RPATH for Qt Libraries
|
||||||
# This must be done before the `yuzu` target is created
|
# This must be done before the `yuzu` target is created
|
||||||
if (YUZU_USE_BUNDLED_QT AND PLATFORM_LINUX)
|
if (YUZU_USE_BUNDLED_QT AND LINUX)
|
||||||
set(CMAKE_BUILD_RPATH "${CMAKE_BINARY_DIR}/bin/lib/")
|
set(CMAKE_BUILD_RPATH "${CMAKE_BINARY_DIR}/bin/lib/")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user