@ -11,6 +11,7 @@ project(yuzu)
# 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 F F b y d e f a u l t , b u t i f E N A B L E _ S D L 2 a n d MSVC a r e t r u e t h e n O N
option ( ENABLE_SDL2 "Enable the SDL2 frontend" ON )
CMAKE_DEPENDENT_OPTION ( YUZU_USE_BUNDLED_SDL2 "Download bundled SDL2 binaries" ON "ENABLE_SDL2;MSVC" OFF )
option ( ENABLE_QT "Enable the Qt frontend" ON )
option ( ENABLE_QT_TRANSLATION "Enable translations for the Qt frontend" OFF )
@ -166,8 +167,6 @@ macro(yuzu_find_packages)
# C m a k e P k g P r e f i x V e r s i o n C o n a n P k g
" C a t c h 2 2 . 1 3 c a t c h 2 / 2 . 1 3 . 0 "
" f m t 7 . 1 f m t / 7 . 1 . 2 "
# c a n ' t u s e u n t i l h t t p s : / / g i t h u b . c o m / b i n c r a f t e r s / c o m m u n i t y / i s s u e s / 1 1 7 3
# " l i b z i p 1 . 5 l i b z i p / 1 . 5 . 2 @ b i n c r a f t e r s / s t a b l e "
" l z 4 1 . 8 l z 4 / 1 . 9 . 2 "
" n l o h m a n n _ j s o n 3 . 8 n l o h m a n n _ j s o n / 3 . 8 . 0 "
" Z L I B 1 . 2 z l i b / 1 . 2 . 1 1 "
@ -251,22 +250,44 @@ if(ENABLE_QT)
if ( ENABLE_QT_TRANSLATION )
find_package ( Qt5 REQUIRED COMPONENTS LinguistTools ${ QT_PREFIX_HINT } )
endif ( )
if ( NOT Qt5_FOUND )
list ( APPEND CONAN_REQUIRED_LIBS "qt/5.14.1@bincrafters/stable" )
endif ( )
endif ( )
# f i n d S D L 2 e x p o r t s a b u n c h o f v a r i a b l e s t h a t a r e n e e d e d , s o i t s e a s i e r t o d o t h i s o u t s i d e o f t h e y u z u _ f i n d _ p a c k a g e
if ( ENABLE_SDL2 )
if ( EXISTS ${ CMAKE_BINARY_DIR } /sdl2Config.cmake )
include ( ${ CMAKE_BINARY_DIR } /sdl2Config.cmake )
list ( APPEND CMAKE_MODULE_PATH "${CONAN_SDL2_ROOT_RELEASE}" )
list ( APPEND CMAKE_PREFIX_PATH "${CONAN_SDL2_ROOT_RELEASE}" )
if ( ENABLE_SDL2 )
if ( YUZU_USE_BUNDLED_SDL2 )
# D e t e c t t o o l c h a i n a n d p l a t f o r m
if ( ( MSVC_VERSION GREATER_EQUAL 1910 AND MSVC_VERSION LESS 1930 ) AND ARCHITECTURE_x86_64 )
set ( SDL2_VER "SDL2-2.0.14" )
else ( )
message ( FATAL_ERROR "No bundled SDL2 binaries for your toolchain. Disable YUZU_USE_BUNDLED_SDL2 and provide your own." )
endif ( )
if ( DEFINED SDL2_VER )
download_bundled_external ( "sdl2/" ${ SDL2_VER } SDL2_PREFIX )
endif ( )
find_package ( SDL2 )
if ( NOT SDL2_FOUND )
# o t h e r w i s e a d d t h i s t o t h e l i s t o f l i b r a r i e s t o i n s t a l l
list ( APPEND CONAN_REQUIRED_LIBS "sdl2/2.0.14@bincrafters/stable" )
set ( SDL2_FOUND YES )
set ( SDL2_INCLUDE_DIR "${SDL2_PREFIX}/include" CACHE PATH "Path to SDL2 headers" )
set ( SDL2_LIBRARY "${SDL2_PREFIX}/lib/x64/SDL2.lib" CACHE PATH "Path to SDL2 library" )
set ( SDL2_DLL_DIR "${SDL2_PREFIX}/lib/x64/" CACHE PATH "Path to SDL2.dll" )
add_library ( SDL2 INTERFACE )
target_link_libraries ( SDL2 INTERFACE "${SDL2_LIBRARY}" )
target_include_directories ( SDL2 INTERFACE "${SDL2_INCLUDE_DIR}" )
else ( )
find_package ( SDL2 REQUIRED )
# S o m e i n s t a l l a t i o n s d o n ' t s e t S D L 2 _ L I B R A R I E S
if ( "${SDL2_LIBRARIES}" STREQUAL "" )
message ( WARNING "SDL2_LIBRARIES wasn't set, manually setting to SDL2::SDL2" )
set ( SDL2_LIBRARIES "SDL2::SDL2" )
endif ( )
include_directories ( SYSTEM ${ SDL2_INCLUDE_DIRS } )
add_library ( SDL2 INTERFACE )
target_link_libraries ( SDL2 INTERFACE "${SDL2_LIBRARIES}" )
endif ( )
else ( )
set ( SDL2_FOUND NO )
endif ( )
# I n s t a l l a n y m i s s i n g d e p e n d e n c i e s w i t h c o n a n i n s t a l l
@ -287,9 +308,6 @@ if (CONAN_REQUIRED_LIBS)
)
conan_check ( VERSION 1.24.0 REQUIRED )
# A d d t h e b i n c r a f t e r s r e m o t e
conan_add_remote ( NAME bincrafters
U R L h t t p s : / / a p i . b i n t r a y . c o m / c o n a n / b i n c r a f t e r s / p u b l i c - c o n a n )
# M a n u a l l y a d d i c o n v t o f i x a d e p c o n f l i c t b e t w e e n q t a n d s d l 2
# W e d o n ' t n e e d t o a d d i t t h r o u g h f i n d _ p a c k a g e o r a n y t h i n g s i n c e t h e o t h e r t w o c a n f i n d i t j u s t f i n e
@ -340,11 +358,6 @@ if (CONAN_REQUIRED_LIBS)
find_package ( Qt5 REQUIRED COMPONENTS WebEngineCore WebEngineWidgets )
endif ( )
endif ( )
if ( ENABLE_SDL2 )
list ( APPEND CMAKE_MODULE_PATH "${CONAN_SDL2_ROOT_RELEASE}" )
list ( APPEND CMAKE_PREFIX_PATH "${CONAN_SDL2_ROOT_RELEASE}" )
find_package ( SDL2 REQUIRED )
endif ( )
endif ( )
@ -360,23 +373,6 @@ elseif (TARGET Boost::boost)
add_library ( boost ALIAS Boost::boost )
endif ( )
if ( TARGET sdl2::sdl2 )
# i m p o r t e d f r o m t h e c o n a n g e n e r a t e d s d l 2 C o n f i g . c m a k e
set_target_properties ( sdl2::sdl2 PROPERTIES IMPORTED_GLOBAL TRUE )
add_library ( SDL2 ALIAS sdl2::sdl2 )
elseif ( SDL2_FOUND )
# f o u n d t h r o u g h t h e s y s t e m p a c k a g e m a n a g e r
# S o m e i n s t a l l a t i o n s d o n ' t s e t S D L 2 _ L I B R A R I E S
if ( "${SDL2_LIBRARIES}" STREQUAL "" )
message ( WARNING "SDL2_LIBRARIES wasn't set, manually setting to SDL2::SDL2" )
set ( SDL2_LIBRARIES "SDL2::SDL2" )
endif ( )
include_directories ( SYSTEM ${ SDL2_INCLUDE_DIRS } )
add_library ( SDL2 INTERFACE )
target_link_libraries ( SDL2 INTERFACE "${SDL2_LIBRARIES}" )
endif ( )
# E n s u r e l i b u s b i s p r o p e r l y configured ( based on dolphin libusb include )
if ( NOT APPLE )
include ( FindPkgConfig )