@ -5,73 +5,23 @@ cmake_minimum_required(VERSION 3.22)
project ( yuzu )
project ( yuzu )
if ( ${ CMAKE_SYSTEM_NAME } STREQUAL "SunOS" )
set ( PLATFORM_SUN 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" )
set ( PLATFORM_HAIKU ON )
elseif ( ${ CMAKE_SYSTEM_NAME } STREQUAL "Linux" )
set ( PLATFORM_LINUX ON )
endif ( )
# d u m b h e u r i s t i c t o d e t e c t m s y s 2
if ( CMAKE_COMMAND MATCHES "msys64" )
set ( PLATFORM_MSYS ON )
endif ( )
if ( CMAKE_CXX_COMPILER_ID STREQUAL "Clang" )
set ( CXX_CLANG ON )
if ( MSVC )
set ( CXX_CLANG_CL ON )
endif ( )
elseif ( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
set ( CXX_GCC ON )
elseif ( CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" )
set ( CXX_CL ON )
elseif ( CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM" )
set ( CXX_ICC ON )
elseif ( CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" )
set ( CXX_APPLE ON )
endif ( )
list ( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules" )
list ( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules" )
list ( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/externals/cmake-modules" )
list ( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/externals/cmake-modules" )
# h t t p s : / / g i t l a b . k i t w a r e . c o m / c m a k e / c m a k e / - / m e r g e _ r e q u e s t s / 1 1 1 1 2
# T h i s w o r k s t o t a l l y f i n e o n M i n G W 6 4 , b u t n o t C L A N G { , A R M } 6 4
if ( MINGW AND CXX_CLANG )
set ( CMAKE_SYSTEM_VERSION 10.0.0 )
endif ( )
set ( CPM_SOURCE_CACHE ${ CMAKE_SOURCE_DIR } /.cache/cpm )
# N B : t h i s d o e s n o t a c c o u n t f o r S P A R C
# I f y o u g e t E d e n w o r k i n g o n S P A R C , p l e a s e s h o o t c r u e t e r @ c r u e t e r . x y z m u l t i p l e e m a i l s
# a n d y o u w i l l b e h a i l e d f o r e t e r n i t y
if ( PLATFORM_SUN )
# T e r r i f i c S o l a r i s p k g s h e n a n i g a n s
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" )
# A m a z i n g - a b s o l u t e l y i n c r e d i b l e
list ( APPEND CMAKE_PREFIX_PATH "${CMAKE_SYSROOT}/usr/lib/amd64/cmake" )
list ( APPEND CMAKE_MODULE_PATH "${CMAKE_SYSROOT}/usr/lib/amd64/cmake" )
# F o r s o m e m i g h t y r e a s o n , d o i n g a n o r m a l r e l e a s e b u i l d s o m e t i m e s m a y n o t t r i g g e r
# t h e p r o p e r - O 3 s w i t c h t o m a t e r i a l i z e
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 ( )
include ( DetectPlatform )
include ( DetectArchitecture )
include ( DefaultConfig )
include ( DownloadExternals )
include ( CMakeDependentOption )
include ( CTest )
include ( CPMUtil )
DetectArchitecture ( )
if ( NOT DEFINED ARCHITECTURE )
message ( FATAL_ERROR "Architecture didn't make it out of scope, did you delete DetectArchitecture.cmake?" )
endif ( )
endif ( )
# N e e d e d f o r F F m p e g w / V A A P I a n d D R M
# N e e d e d f o r F F m p e g w / V A A P I a n d D R M
@ -90,34 +40,10 @@ if (PLATFORM_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 ( )
# M S Y S 2 u t i l i t i e s
if ( PLATFORM_MSYS )
include ( FixMsysPaths )
# r e a l l y , r e a l l y d u m b h e u r i s t i c t o d e t e c t w h a t e n v i r o n m e n t w e a r e i n
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 ) w a n t t o p r i o r i t i z e e n v i r o n m e n t - s p e c i f i c b i n a r i e s i f p o s s i b l e
# s o m e , l i k e a u t o c o n f , a r e n o t p r e s e n t o n e n v i r o n m e n t s b e s i d e s m s y s 2 t h o u g h
set ( CMAKE_PROGRAM_PATH C:/msys64/ ${ MSYSTEM } /bin C:/msys64/usr/bin )
set ( ENV{PKG_CONFIG_PATH} C:/msys64/ ${ MSYSTEM } /lib/pkgconfig )
endif ( )
# s t a t i c s t u f f
# s t a t i c s t u f f
option ( YUZU_STATIC_BUILD "Use static libraries and executables if available" OFF )
option ( YUZU_STATIC_BUILD "Use static libraries and executables if available" OFF )
# T O D O : S t a t i c B u i l d . c m a k e
if ( YUZU_STATIC_BUILD )
if ( YUZU_STATIC_BUILD )
include ( StaticQtLibs )
include ( StaticQtLibs )
@ -177,92 +103,6 @@ if (YUZU_STATIC_BUILD)
endif ( )
endif ( )
endif ( )
endif ( )
# D e t e c t c u r r e n t c o m p i l a t i o n a r c h i t e c t u r e a n d c r e a t e s t a n d a r d d e f i n i t i o n s
# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
include ( CheckSymbolExists )
function ( detect_architecture symbol arch )
if ( NOT DEFINED ARCHITECTURE )
set ( CMAKE_REQUIRED_QUIET 1 )
check_symbol_exists ( "${symbol}" "" ARCHITECTURE_ ${ arch } )
unset ( CMAKE_REQUIRED_QUIET )
# T h e o u t p u t v a r i a b l e n e e d s t o b e u n i q u e a c r o s s i n v o c a t i o n s o t h e r w i s e
# C M a k e ' s c r a z y s c o p e r u l e s w i l l k e e p i t d e f i n e d
if ( ARCHITECTURE_ ${ arch } )
set ( ARCHITECTURE "${arch}" PARENT_SCOPE )
set ( ARCHITECTURE_ ${ arch } 1 PARENT_SCOPE )
add_definitions ( "-DARCHITECTURE_${arch}=1" )
endif ( )
endif ( )
endfunction ( )
if ( NOT ENABLE_GENERIC )
# h t t p s : / / s o u r c e f o r g e . n e t / p / p r e d e f / w i k i / A r c h i t e c t u r e s /
# T O D O : T H I S I S F U C K I N G F L A W E D O N L Y T H E F I R S T S Y M B O L T H A T A P P E A R S W I L L B E C O N S I D E R E D : (
if ( MSVC )
detect_architecture ( "_M_AMD64" x86_64 )
detect_architecture ( "_M_IX86" x86 )
detect_architecture ( "_M_ARM" arm )
detect_architecture ( "_M_ARM64" arm64 )
else ( )
detect_architecture ( "__x86_64__" x86_64 )
detect_architecture ( "__i386__" x86 )
detect_architecture ( "__arm__" arm )
detect_architecture ( "__aarch64__" arm64 )
endif ( )
detect_architecture ( "__ARM64__" arm64 )
detect_architecture ( "__aarch64__" arm64 )
detect_architecture ( "_M_ARM64" arm64 )
detect_architecture ( "__arm__" arm )
detect_architecture ( "__TARGET_ARCH_ARM" arm )
detect_architecture ( "_M_ARM" arm )
detect_architecture ( "__x86_64" x86_64 )
detect_architecture ( "__x86_64__" x86_64 )
detect_architecture ( "__amd64" x86_64 )
detect_architecture ( "_M_X64" x86_64 )
detect_architecture ( "__i386" x86 )
detect_architecture ( "__i386__" x86 )
detect_architecture ( "_M_IX86" x86 )
detect_architecture ( "__ia64" ia64 )
detect_architecture ( "__ia64__" ia64 )
detect_architecture ( "_M_IA64" ia64 )
detect_architecture ( "__mips" mips )
detect_architecture ( "__mips__" mips )
detect_architecture ( "_M_MRX000" mips )
detect_architecture ( "__powerpc64__" ppc64 )
detect_architecture ( "__ppc64__" ppc64 )
detect_architecture ( "__PPC64__" ppc64 )
detect_architecture ( "_ARCH_PPC64" ppc64 )
detect_architecture ( "__ppc__" ppc )
detect_architecture ( "__ppc" ppc )
detect_architecture ( "__powerpc__" ppc )
detect_architecture ( "_ARCH_COM" ppc )
detect_architecture ( "_ARCH_PWR" ppc )
detect_architecture ( "_ARCH_PPC" ppc )
detect_architecture ( "_M_MPPC" ppc )
detect_architecture ( "_M_PPC" ppc )
detect_architecture ( "__riscv" riscv )
detect_architecture ( "__EMSCRIPTEN__" wasm )
endif ( )
if ( NOT DEFINED ARCHITECTURE )
set ( ARCHITECTURE "GENERIC" )
set ( ARCHITECTURE_GENERIC 1 )
add_definitions ( -DARCHITECTURE_GENERIC=1 )
endif ( )
message ( STATUS "Target architecture: ${ARCHITECTURE}" )
if ( MSVC AND ARCHITECTURE_x86 )
if ( MSVC AND ARCHITECTURE_x86 )
message ( FATAL_ERROR " Attempting to build with the x86 environment is not supported. \
message ( FATAL_ERROR " Attempting to build with the x86 environment is not supported. \
T h i s c a n t y p i c a l l y h a p p e n i f y o u u s e d t h e D e v e l o p e r C o m m a n d P r o m p t f r o m t h e s t a r t m e n u ; \
T h i s c a n t y p i c a l l y h a p p e n i f y o u u s e d t h e D e v e l o p e r C o m m a n d P r o m p t f r o m t h e s t a r t m e n u ; \
@ -292,21 +132,11 @@ if (CXX_CLANG_CL)
endif ( )
endif ( )
endif ( )
endif ( )
set ( CPM_SOURCE_CACHE ${ CMAKE_SOURCE_DIR } /.cache/cpm )
include ( DownloadExternals )
include ( CMakeDependentOption )
include ( CTest )
# D i s a b l e W a r n i n g s a s E r r o r s f o r MSVC
# D i s a b l e W a r n i n g s a s E r r o r s f o r MSVC
if ( MSVC AND NOT CXX_CLANG )
if ( MSVC AND NOT CXX_CLANG )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3 /WX-" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3 /WX-" )
endif ( )
endif ( )
if ( PLATFORM_FREEBSD OR PLATFORM_DRAGONFLYBSD )
set ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L${CMAKE_SYSROOT}/usr/local/lib" )
endif ( )
# S e t b u n d l e d s d l 2 / q t a s d e p e n d e n t o p t i o n s .
# S e t b u n d l e d s d l 2 / q t a s d e p e n d e n t o p t i o n s .
# O n L i n u x s y s t e m S D L 2 i s l i k e l y t o b e l a c k i n g H I D A P I s u p p o r t w h i c h h a v e d r a w b a c k s b u t i s n e e d e d f o r S D L m o t i o n
# O n L i n u x s y s t e m S D L 2 i s l i k e l y t o b e l a c k i n g H I D A P I s u p p o r t w h i c h h a v e d r a w b a c k s b u t i s n e e d e d f o r S D L m o t i o n
cmake_dependent_option ( ENABLE_SDL2 "Enable the SDL2 frontend" ON "NOT ANDROID" OFF )
cmake_dependent_option ( ENABLE_SDL2 "Enable the SDL2 frontend" ON "NOT ANDROID" OFF )
@ -358,13 +188,7 @@ option(YUZU_TESTS "Compile tests" "${BUILD_TESTING}")
option ( YUZU_ENABLE_LTO "Enable link-time optimization" OFF )
option ( YUZU_ENABLE_LTO "Enable link-time optimization" OFF )
if ( YUZU_ENABLE_LTO )
if ( YUZU_ENABLE_LTO )
include ( CheckIPOSupported )
check_ipo_supported ( RESULT COMPILER_SUPPORTS_LTO )
if ( NOT COMPILER_SUPPORTS_LTO )
message ( FATAL_ERROR "Your compiler does not support interprocedural optimization (IPO). Re-run CMake with -DYUZU_ENABLE_LTO=OFF." )
endif ( )
set ( CMAKE_POLICY_DEFAULT_CMP0069 NEW )
set ( CMAKE_INTERPROCEDURAL_OPTIMIZATION ${ COMPILER_SUPPORTS_LTO } )
include ( UseLTO )
endif ( )
endif ( )
option ( USE_CCACHE "Use ccache for compilation" OFF )
option ( USE_CCACHE "Use ccache for compilation" OFF )
@ -391,7 +215,6 @@ if(USE_CCACHE)
endif ( )
endif ( )
endif ( )
endif ( )
# TODO ( crueter ) : C I t h i s ?
option ( YUZU_DOWNLOAD_ANDROID_VVL "Download validation layer binary for android" ON )
option ( YUZU_DOWNLOAD_ANDROID_VVL "Download validation layer binary for android" ON )
option ( YUZU_LEGACY "Apply patches that improve compatibility with older GPUs (e.g. Snapdragon 865) at the cost of performance" OFF )
option ( YUZU_LEGACY "Apply patches that improve compatibility with older GPUs (e.g. Snapdragon 865) at the cost of performance" OFF )
@ -401,12 +224,12 @@ cmake_dependent_option(YUZU_ROOM_STANDALONE "Enable standalone room executable"
cmake_dependent_option ( YUZU_CMD "Compile the eden-cli executable" ON "ENABLE_SDL2;NOT ANDROID" OFF )
cmake_dependent_option ( YUZU_CMD "Compile the eden-cli executable" ON "ENABLE_SDL2;NOT ANDROID" OFF )
cmake_dependent_option ( YUZU_CRASH_DUMPS "Compile crash dump (Minidump) support" OFF "WIN32 OR LINUX" OFF )
cmake_dependent_option ( YUZU_CRASH_DUMPS "Compile crash dump (Minidump) support" OFF "WIN32 OR PLATFORM_ 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" )
cmake_dependent_option ( YUZU_USE_FASTER_LD "Check if a faster linker is available" ON "LINUX" OFF )
cmake_dependent_option ( YUZU_USE_FASTER_LD "Check if a faster linker is available" ON "PLATFORM_ LINUX" OFF )
cmake_dependent_option ( YUZU_USE_BUNDLED_MOLTENVK "Download bundled MoltenVK lib" ON "APPLE" OFF )
cmake_dependent_option ( YUZU_USE_BUNDLED_MOLTENVK "Download bundled MoltenVK lib" ON "APPLE" OFF )
@ -438,41 +261,15 @@ endif()
# TODO ( crueter ) : C P M t h i s
# TODO ( crueter ) : C P M t h i s
if ( ANDROID AND YUZU_DOWNLOAD_ANDROID_VVL )
if ( ANDROID AND YUZU_DOWNLOAD_ANDROID_VVL )
set ( vvl_version "1.4.328.0" )
set ( vvl_zip_file "${CMAKE_BINARY_DIR}/externals/vvl-android-${vvl_version}.zip" )
if ( NOT EXISTS "${vvl_zip_file}" )
# D o w n l o a d a n d e x t r a c t v a l i d a t i o n l a y e r r e l e a s e t o e x t e r n a l s d i r e c t o r y
set ( vvl_base_url "https://github.com/KhronosGroup/Vulkan-ValidationLayers/releases/download" )
file ( DOWNLOAD "${vvl_base_url}/vulkan-sdk-${vvl_version}/android-binaries-${vvl_version}.zip"
" $ { v v l _ z i p _ f i l e } " S H O W _ P R O G R E S S )
execute_process ( COMMAND ${ CMAKE_COMMAND } -E tar xf "${vvl_zip_file}"
W O R K I N G _ D I R E C T O R Y " $ { C M A K E _ B I N A R Y _ D I R } / e x t e r n a l s " )
endif ( )
AddJsonPackage ( vulkan-validation-layers )
# C o p y t h e a r m 6 4 b i n a r y t o s r c / a n d r o i d / a p p / m a i n / j n i L i b s
if ( ARCHITECTURE_arm64 )
set ( vvl_abi arm64-v8a )
elseif ( ARCHITECTURE_x86_64 )
set ( vvl_abi x86_64 )
endif ( )
set ( abi ${ CMAKE_ANDROID_ARCH_ABI } )
set ( vvl_lib_path "${CMAKE_CURRENT_SOURCE_DIR}/src/android/app/src/main/jniLibs/${vvl_ abi}/" )
file ( COPY "${CMAKE_BINARY_DIR}/externals/android-binaries-${vvl_version}/${vvl_ abi}/libVkLayer_khronos_validation.so"
set ( vvl_lib_path "${CMAKE_CURRENT_SOURCE_DIR}/src/android/app/src/main/jniLibs/${abi}/" )
file ( COPY "${VVL_SOURCE_DIR}/${abi}/libVkLayer_khronos_validation.so"
D E S T I N A T I O N " $ { v v l _ l i b _ p a t h } " )
D E S T I N A T I O N " $ { v v l _ l i b _ p a t h } " )
endif ( )
endif ( )
if ( ANDROID )
set ( CMAKE_SKIP_INSTALL_RULES ON )
set ( CMAKE_POLICY_VERSION_MINIMUM 3.5 ) # W o r k a r o u n d f o r O b o e
endif ( )
# D e f a u l t t o a R e l e a s e b u i l d
get_property ( IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG )
if ( NOT IS_MULTI_CONFIG AND NOT CMAKE_BUILD_TYPE )
set ( CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE )
message ( STATUS "Defaulting to a Release build" )
endif ( )
if ( EXISTS ${ PROJECT_SOURCE_DIR } /hooks/pre-commit AND NOT EXISTS ${ PROJECT_SOURCE_DIR } /.git/hooks/pre-commit )
if ( EXISTS ${ PROJECT_SOURCE_DIR } /hooks/pre-commit AND NOT EXISTS ${ PROJECT_SOURCE_DIR } /.git/hooks/pre-commit )
if ( EXISTS ${ PROJECT_SOURCE_DIR } /.git/ )
if ( EXISTS ${ PROJECT_SOURCE_DIR } /.git/ )
message ( STATUS "Copying pre-commit hook" )
message ( STATUS "Copying pre-commit hook" )
@ -480,25 +277,23 @@ if(EXISTS ${PROJECT_SOURCE_DIR}/hooks/pre-commit AND NOT EXISTS ${PROJECT_SOURCE
endif ( )
endif ( )
endif ( )
endif ( )
configure_file ( ${ PROJECT_SOURCE_DIR } /dist/compatibility_list/compatibility_list.qrc
$ { P R O J E C T _ B I N A R Y _ D I R } / d i s t / c o m p a t i b i l i t y _ l i s t / c o m p a t i b i l i t y _ l i s t . q r c
set ( compat_base dist/compatibility_list/compatibility_list )
set ( compat_qrc ${ compat_base } .qrc )
set ( compat_json ${ compat_base } .json )
configure_file ( ${ PROJECT_SOURCE_DIR } / ${ compat_qrc }
$ { P R O J E C T _ B I N A R Y _ D I R } / $ { c o m p a t _ q r c }
C O P Y O N L Y )
C O P Y O N L Y )
if ( EXISTS ${ PROJECT_SOURCE_DIR } /dist/compatibility_list/compatibility_list.json )
configure_file ( "${PROJECT_SOURCE_DIR}/dist/compatibility_list/compatibility_list.json"
" $ { P R O J E C T _ B I N A R Y _ D I R } / d i s t / c o m p a t i b i l i t y _ l i s t / c o m p a t i b i l i t y _ l i s t . j s o n "
if ( EXISTS ${ PROJECT_SOURCE_DIR } / ${ compat_json } )
configure_file ( "${PROJECT_SOURCE_DIR}/${compat_json} "
" $ { P R O J E C T _ B I N A R Y _ D I R } / $ { c o m p a t _ j s o n } "
C O P Y O N L Y )
C O P Y O N L Y )
endif ( )
endif ( )
if ( ENABLE_COMPATIBILITY_LIST_DOWNLOAD AND NOT EXISTS ${ PROJECT_BINARY_DIR } /dist/compatibility_list/compatibility_list.json )
message ( STATUS "Downloading compatibility list for yuzu..." )
file ( DOWNLOAD
h t t p s : / / a p i . y u z u - e m u . o r g / g a m e d b /
" $ { P R O J E C T _ B I N A R Y _ D I R } / d i s t / c o m p a t i b i l i t y _ l i s t / c o m p a t i b i l i t y _ l i s t . j s o n " S H O W _ P R O G R E S S )
endif ( )
if ( NOT EXISTS ${ PROJECT_BINARY_DIR } /dist/compatibility_list/compatibility_list.json )
file ( WRITE ${ PROJECT_BINARY_DIR } /dist/compatibility_list/compatibility_list.json "" )
# T O D O : C o m p a t l i s t d o w n l o a d
if ( NOT EXISTS ${ PROJECT_BINARY_DIR } / ${ compat_json } )
file ( WRITE ${ PROJECT_BINARY_DIR } / ${ compat_json } "" )
endif ( )
endif ( )
if ( YUZU_LEGACY )
if ( YUZU_LEGACY )
@ -580,8 +375,6 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
# S y s t e m i m p o r t e d l i b r a r i e s
# S y s t e m i m p o r t e d l i b r a r i e s
# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
include ( CPMUtil )
# o p e n s s l f u n n i n e s s
# o p e n s s l f u n n i n e s s
if ( ENABLE_OPENSSL )
if ( ENABLE_OPENSSL )
if ( YUZU_USE_BUNDLED_OPENSSL )
if ( YUZU_USE_BUNDLED_OPENSSL )
@ -673,6 +466,7 @@ if (YUZU_USE_CPM)
add_library ( Opus::opus ALIAS opus )
add_library ( Opus::opus ALIAS opus )
endif ( )
endif ( )
else ( )
else ( )
# T O D O : w e c a n p r o b a b l y j u s t u s e C P M f o r t h i s . . . r i g h t ?
# E n f o r c e t h e s e a r c h m o d e o f n o n - r e q u i r e d p a c k a g e s f o r b e t t e r a n d s h o r t e r f a i l u r e m e s s a g e s
# E n f o r c e t h e s e a r c h m o d e o f n o n - r e q u i r e d p a c k a g e s f o r b e t t e r a n d s h o r t e r f a i l u r e m e s s a g e s
find_package ( fmt 8 REQUIRED )
find_package ( fmt 8 REQUIRED )
@ -737,10 +531,9 @@ endfunction()
if ( APPLE )
if ( APPLE )
# U m b r e l l a f r a m e w o r k f o r e v e r y t h i n g G U I - r e l a t e d
# U m b r e l l a f r a m e w o r k f o r e v e r y t h i n g G U I - r e l a t e d
find_library ( COCOA_LIBRARY Cocoa )
find_library ( COCOA_LIBRARY Cocoa REQUIRED )
find_library ( IOKIT_LIBRARY IOKit REQUIRED )
set ( PLATFORM_LIBRARIES ${ COCOA_LIBRARY } ${ IOKIT_LIBRARY } ${ COREVIDEO_LIBRARY } )
set ( PLATFORM_LIBRARIES ${ COCOA_LIBRARY } ${ IOKIT_LIBRARY } ${ COREVIDEO_LIBRARY } )
# find_library ( ICONV_LIBRARY iconv REQUIRED )
# list ( APPEND PLATFORM_LIBRARIES ${ ICONV_LIBRARY } )
elseif ( WIN32 )
elseif ( WIN32 )
# T a r g e t W i n d o w s 1 0
# T a r g e t W i n d o w s 1 0
add_compile_definitions ( _WIN32_WINNT=0x0A00 WINVER=0x0A00 )
add_compile_definitions ( _WIN32_WINNT=0x0A00 WINVER=0x0A00 )
@ -881,11 +674,6 @@ if(ENABLE_QT)
set_target_properties ( Qt6::Platform PROPERTIES INTERFACE_COMPILE_FEATURES "" )
set_target_properties ( Qt6::Platform PROPERTIES INTERFACE_COMPILE_FEATURES "" )
endif ( )
endif ( )
if ( UNIX AND NOT APPLE AND NOT ANDROID )
find_package ( PkgConfig REQUIRED )
pkg_check_modules ( LIBVA libva )
endif ( )
if ( NOT ( YUZU_USE_BUNDLED_FFMPEG OR YUZU_USE_EXTERNAL_FFMPEG ) )
if ( NOT ( YUZU_USE_BUNDLED_FFMPEG OR YUZU_USE_EXTERNAL_FFMPEG ) )
# U s e s y s t e m i n s t a l l e d F F m p e g
# U s e s y s t e m i n s t a l l e d F F m p e g
find_package ( FFmpeg REQUIRED QUIET COMPONENTS ${ FFmpeg_COMPONENTS } )
find_package ( FFmpeg REQUIRED QUIET COMPONENTS ${ FFmpeg_COMPONENTS } )
@ -912,54 +700,6 @@ endif()
set ( THREADS_PREFER_PTHREAD_FLAG ON )
set ( THREADS_PREFER_PTHREAD_FLAG ON )
find_package ( Threads REQUIRED )
find_package ( Threads REQUIRED )
# S e t u p a c u s t o m c l a n g - f o r m a t target ( if clang-format can be found ) t h a t w i l l r u n
# a g a i n s t a l l t h e s r c f i l e s . T h i s s h o u l d b e u s e d b e f o r e m a k i n g a p u l l r e q u e s t .
# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
set ( CLANG_FORMAT_POSTFIX "-15" )
find_program ( CLANG_FORMAT
N A M E S c l a n g - f o r m a t $ { C L A N G _ F O R M A T _ P O S T F I X }
c l a n g - f o r m a t
P A T H S $ { P R O J E C T _ B I N A R Y _ D I R } / e x t e r n a l s )
# i f f i n d _ p r o g r a m d o e s n ' t f i n d i t , t r y t o d o w n l o a d f r o m e x t e r n a l s
if ( NOT CLANG_FORMAT )
if ( WIN32 AND NOT CMAKE_CROSSCOMPILING )
message ( STATUS "Clang format not found! Downloading..." )
set ( CLANG_FORMAT "${PROJECT_BINARY_DIR}/externals/clang-format${CLANG_FORMAT_POSTFIX}.exe" )
file ( DOWNLOAD
h t t p s : / / g i t h u b . c o m / e d e n - e m u l a t o r / e x t - w i n d o w s - b i n / r a w / m a s t e r / c l a n g - f o r m a t $ { C L A N G _ F O R M A T _ P O S T F I X } . e x e
" $ { C L A N G _ F O R M A T } " S H O W _ P R O G R E S S
S T A T U S D O W N L O A D _ S U C C E S S )
if ( NOT DOWNLOAD_SUCCESS EQUAL 0 )
message ( WARNING "Could not download clang format! Disabling the clang format target" )
file ( REMOVE ${ CLANG_FORMAT } )
unset ( CLANG_FORMAT )
endif ( )
else ( )
message ( WARNING "Clang format not found! Disabling the clang format target" )
endif ( )
endif ( )
if ( CLANG_FORMAT )
set ( SRCS ${ PROJECT_SOURCE_DIR } /src )
set ( CCOMMENT "Running clang format against all the .h and .cpp files in src/" )
if ( WIN32 )
add_custom_target ( clang-format
C O M M A N D p o w e r s h e l l . e x e - C o m m a n d " G e t - C h i l d I t e m ' $ { S R C S } / * ' - I n c l u d e * . c p p , * . h - R e c u r s e | F o r e a c h { & ' $ { C L A N G _ F O R M A T } ' - i $ _ . f u l l n a m e } "
C O M M E N T $ { C C O M M E N T } )
elseif ( MINGW )
add_custom_target ( clang-format
C O M M A N D f i n d ` c y g p a t h - u $ { S R C S } ` - i n a m e * . h - o - i n a m e * . c p p | x a r g s ` c y g p a t h - u $ { C L A N G _ F O R M A T } ` - i
C O M M E N T $ { C C O M M E N T } )
else ( )
add_custom_target ( clang-format
C O M M A N D f i n d $ { S R C S } - i n a m e * . h - o - i n a m e * . c p p | x a r g s $ { C L A N G _ F O R M A T } - i
C O M M E N T $ { C C O M M E N T } )
endif ( )
unset ( SRCS )
unset ( CCOMMENT )
endif ( )
# I n c l u d e s o u r c e c o d e
# I n c l u d e s o u r c e c o d e
# = = = = = = = = = = = = = = = = = = =
# = = = = = = = = = = = = = = = = = = =
@ -993,47 +733,8 @@ if (MSVC AND CXX_CLANG)
link_libraries ( llvm-mingw-runtime )
link_libraries ( llvm-mingw-runtime )
endif ( )
endif ( )
# [ [
s e a r c h o r d e r :
- gold ( GCC only ) - t h e b e s t , g e n e r a l l y , b u t u n f o r t u n a t e l y n o t p a c k a g e d a n y m o r e
- mold ( GCC only ) - g e n e r a l l y d o e s w e l l o n G C C
- l d d - p r e f e r r e d o n c l a n g
- b f d - t h e f i n a l f a l l b a c k
- I f n o n e a r e found ( macOS uses ld.prime, etc ) j u s t u s e t h e d e f a u l t l i n k e r
] ]
if ( YUZU_USE_FASTER_LD )
if ( YUZU_USE_FASTER_LD )
find_program ( LINKER_BFD bfd )
if ( LINKER_BFD )
set ( LINKER bfd )
endif ( )
find_program ( LINKER_LLD lld )
if ( LINKER_LLD )
set ( LINKER lld )
endif ( )
if ( CXX_GCC )
find_program ( LINKER_MOLD mold )
if ( LINKER_MOLD AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "12.1" )
set ( LINKER mold )
endif ( )
find_program ( LINKER_GOLD gold )
if ( LINKER_GOLD )
set ( LINKER gold )
endif ( )
endif ( )
if ( LINKER )
message ( NOTICE "Selecting ${LINKER} as linker" )
add_link_options ( "-fuse-ld=${LINKER}" )
else ( )
message ( WARNING "No faster linker found--using default" )
endif ( )
if ( LINKER STREQUAL "lld" AND CXX_GCC )
message ( WARNING "Using lld on GCC may cause issues with certain LTO settings. If the program fails to compile, disable YUZU_USE_FASTER_LD, or install mold or GNU gold." )
endif ( )
include ( FasterLinker )
endif ( )
endif ( )
# S e t r u n t i m e l i b r a r y t o M D / M D d f o r a l l c o n f i g u r a t i o n s
# S e t r u n t i m e l i b r a r y t o M D / M D d f o r a l l c o n f i g u r a t i o n s
@ -1055,14 +756,6 @@ if(MSVC)
)
)
endif ( )
endif ( )
if ( MINGW )
# T h i s s a v e s a t r u l y r i d i c u l o u s a m o u n t o f t i m e d u r i n g l i n k i n g
# I n m y t e s t s , w i t h o u t t h i s i t t a k e s 2 m i n s , w i t h i t t a k e s 3 - 5 s e c o n d s
# o r o n G i t H u b A c t i o n s , 1 0 m i n u t e s - > 3 s e c o n d s
set ( MINGW_FLAGS "-Wl,--strip-all -Wl,--gc-sections" )
set ( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${MINGW_FLAGS}" )
endif ( )
add_subdirectory ( src )
add_subdirectory ( src )
# S e t y u z u p r o j e c t o r y u z u - c m d p r o j e c t a s d e f a u l t S t a r t U p P r o j e c t i n V i s u a l S t u d i o d e p e n d i n g o n w h e t h e r Q T i s e n a b l e d o r n o t
# S e t y u z u p r o j e c t o r y u z u - c m d p r o j e c t a s d e f a u l t S t a r t U p P r o j e c t i n V i s u a l S t u d i o d e p e n d i n g o n w h e t h e r Q T i s e n a b l e d o r n o t