@ -19,6 +19,9 @@ CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_SDL2 "Download bundled SDL2 binaries" ON
CMAKE_DEPENDENT_OPTION ( YUZU_USE_EXTERNAL_SDL2 "Compile external SDL2" ON "ENABLE_SDL2;NOT MSVC" OFF )
option ( ENABLE_QT "Enable the Qt frontend" ON )
option ( ENABLE_QT6 "Allow usage of Qt6 to be attempted" OFF )
set ( QT6_LOCATION "" CACHE PATH "Additional Location to search for Qt6 libraries like C:/Qt/6.3.1/msvc2019_64/" )
option ( ENABLE_QT_TRANSLATION "Enable translations for the Qt frontend" OFF )
CMAKE_DEPENDENT_OPTION ( YUZU_USE_BUNDLED_QT "Download bundled Qt binaries" "${MSVC}" "ENABLE_QT" OFF )
@ -28,6 +31,8 @@ option(YUZU_USE_BUNDLED_LIBUSB "Compile bundled libusb" OFF)
option ( YUZU_USE_BUNDLED_FFMPEG "Download/Build bundled FFmpeg" "${WIN32}" )
option ( YUZU_USE_QT_MULTIMEDIA "Use QtMultimedia for Camera" OFF )
option ( YUZU_USE_QT_WEB_ENGINE "Use QtWebEngine for web applet implementation" OFF )
option ( ENABLE_CUBEB "Enables the cubeb audio backend" ON )
@ -213,128 +218,166 @@ if (MINGW)
find_library ( MSWSOCK_LIBRARY mswsock REQUIRED )
endif ( )
# P l e a s e c o n s i d e r t h i s a s a s t u b
if ( ENABLE_QT6 AND Qt6_LOCATION )
list ( APPEND CMAKE_PREFIX_PATH "${Qt6_LOCATION}" )
endif ( )
function ( set_yuzu_qt_components )
# B e s t p r a c t i c e i s t o a s k f o r a l l c o m p o n e n t s a t o n c e , s o t h e y a r e f r o m t h e s a m e v e r s i o n
set ( YUZU_QT_COMPONENTS2 Core Widgets Concurrent )
if ( ${ CMAKE_SYSTEM_NAME } STREQUAL "Linux" )
list ( APPEND YUZU_QT_COMPONENTS2 DBus )
endif ( )
if ( YUZU_USE_QT_MULTIMEDIA )
list ( APPEND YUZU_QT_COMPONENTS2 Multimedia )
endif ( )
if ( YUZU_USE_QT_WEB_ENGINE )
list ( APPEND YUZU_QT_COMPONENTS2 WebEngineCore WebEngineWidgets )
endif ( )
if ( ENABLE_QT_TRANSLATION )
list ( APPEND YUZU_QT_COMPONENTS2 LinguistTools )
endif ( )
set ( YUZU_QT_COMPONENTS ${ YUZU_QT_COMPONENTS2 } PARENT_SCOPE )
endfunction ( set_yuzu_qt_components )
# Q t 5 r e q u i r e s t h a t w e f i n d c o m p o n e n t s , s o i t d o e s n ' t f i t o u r p r e t t y l i t t l e f i n d p a c k a g e f u n c t i o n
if ( ENABLE_QT )
set ( QT_VERSION 5.15 )
# T h e s e a r e u s e d t o s p e c i f y m i n i m u m v e r s i o n s
set ( QT5_VERSION 5.15 )
set ( QT6_VERSION 6.3.1 )
# C h e c k f o r s y s t e m Q t o n L i n u x , f a l l b a c k t o b u n d l e d Q t
if ( UNIX AND NOT APPLE )
if ( NOT YUZU_USE_BUNDLED_QT )
find_package ( Qt5 ${ QT_VERSION } COMPONENTS Widgets DBus Multimedia )
endif ( )
if ( ${ CMAKE_SYSTEM_NAME } STREQUAL "Linux" AND ( NOT Qt5_FOUND OR YUZU_USE_BUNDLED_QT ) )
# C h e c k f o r d e p e n d e n c i e s , t h e n e n a b l e b u n d l e d Q t d o w n l o a d
# C h e c k t h a t t h e s y s t e m G L I B C X X v e r s i o n i s c o m p a t i b l e
find_program ( OBJDUMP objdump )
if ( "${OBJDUMP}" STREQUAL "OBJDUMP-NOTFOUND" )
message ( FATAL_ERROR "Required program `objdump` not found." )
endif ( )
find_library ( LIBSTDCXX libstdc++.so.6 )
execute_process (
C O M M A N D
$ { O B J D U M P } - T $ { L I B S T D C X X }
C O M M A N D
g r e p G L I B C X X _ 3 . 4 . 2 8
C O M M A N D
s e d " s / [ 0 - 9 a - f ] * . * / / "
C O M M A N D
s e d " s / . * / / "
C O M M A N D
s o r t - u
O U T P U T _ V A R I A B L E
G L I B C X X _ M E T
)
if ( NOT GLIBCXX_MET )
message ( FATAL_ERROR " Qt too old or not found, and bundled Qt package is not \
c o m p a t i b l e w i t h t h i s s y s t e m . E i t h e r i n s t a l l Q t $ { Q T _ V E R S I O N } , o r p r o v i d e t h e p a t h \
t o Q t b y s e t t i n g t h e v a r i a b l e Q t 5 _ R O O T . " )
endif ( )
# C h e c k f o r h e a d e r s
find_package ( PkgConfig REQUIRED )
pkg_check_modules ( QT_DEP_GLU QUIET glu>=9.0.0 )
if ( NOT QT_DEP_GLU_FOUND )
message ( FATAL_ERROR " Qt bundled pacakge dependency `glu` not found. \
P e r h a p s ` l i b g l u 1 - m e s a - d e v ` n e e d s t o b e i n s t a l l e d ? " )
endif ( )
pkg_check_modules ( QT_DEP_MESA QUIET dri>=20.0.8 )
if ( NOT QT_DEP_MESA_FOUND )
message ( FATAL_ERROR " Qt bundled pacakge dependency `dri` not found. \
P e r h a p s ` m e s a - c o m m o n - d e v ` n e e d s t o b e i n s t a l l e d ? " )
endif ( )
# C h e c k f o r X l i b r a r i e s
set ( BUNDLED_QT_REQUIREMENTS
l i b x c b - i c c c m . s o . 4
l i b x c b - i m a g e . s o . 0
l i b x c b - k e y s y m s . s o . 1
l i b x c b - r a n d r . s o . 0
l i b x c b - r e n d e r - u t i l . s o . 0
l i b x c b - r e n d e r . s o . 0
l i b x c b - s h a p e . s o . 0
l i b x c b - s h m . s o . 0
l i b x c b - s y n c . s o . 1
l i b x c b - x f i x e s . s o . 0
l i b x c b - x i n e r a m a . s o . 0
l i b x c b - x k b . s o . 1
l i b x c b . s o . 1
l i b x k b c o m m o n - x 1 1 . s o . 0
l i b x k b c o m m o n . s o . 0
)
set ( UNRESOLVED_QT_DEPS "" )
foreach ( REQUIREMENT ${ BUNDLED_QT_REQUIREMENTS } )
find_library ( BUNDLED_QT_ ${ REQUIREMENT } ${ REQUIREMENT } )
if ( "${BUNDLED_QT_${REQUIREMENT}}" STREQUAL "BUNDLED_QT_${REQUIREMENT}-NOTFOUND" )
set ( UNRESOLVED_QT_DEPS ${ UNRESOLVED_QT_DEPS } ${ REQUIREMENT } )
endif ( )
unset ( BUNDLED_QT_ ${ REQUIREMENT } )
endforeach ( )
unset ( BUNDLED_QT_REQUIREMENTS )
if ( NOT "${UNRESOLVED_QT_DEPS}" STREQUAL "" )
message ( FATAL_ERROR "Bundled Qt package missing required dependencies: ${UNRESOLVED_QT_DEPS}" )
endif ( )
set ( YUZU_USE_BUNDLED_QT ON CACHE BOOL "Download bundled Qt" FORCE )
endif ( )
if ( YUZU_USE_BUNDLED_QT )
# B i n a r y p a c k a g e c u r r e n t l y d o e s n o t s u p p o r t Q t w e b e n g i n e , s o m a k e s u r e i t ' s d i s a b l e d
set ( YUZU_USE_QT_WEB_ENGINE OFF CACHE BOOL "Use Qt Webengine" FORCE )
endif ( )
set_yuzu_qt_components ( )
if ( ENABLE_QT6 )
find_package ( Qt6 ${ QT6_VERSION } COMPONENTS ${ YUZU_QT_COMPONENTS } )
endif ( )
set ( YUZU_QT_NO_CMAKE_SYSTEM_PATH )
if ( YUZU_USE_BUNDLED_QT )
if ( ( MSVC_VERSION GREATER_EQUAL 1920 AND MSVC_VERSION LESS 1940 ) AND ARCHITECTURE_x86_64 )
set ( QT_BUILD qt-5.15.2-msvc2019_64 )
elseif ( ( ${ CMAKE_SYSTEM_NAME } STREQUAL "Linux" ) AND NOT MINGW AND ARCHITECTURE_x86_64 )
set ( QT_BUILD qt5_5_15_2 )
else ( )
message ( FATAL_ERROR "No bundled Qt binaries for your toolchain. Disable YUZU_USE_BUNDLED_QT and provide your own." )
endif ( )
if ( DEFINED QT_BUILD )
download_bundled_external ( "qt/" ${ QT_BUILD } QT_PREFIX )
endif ( )
set ( QT_PREFIX_HINT HINTS "${QT_PREFIX}" )
set ( YUZU_QT_NO_CMAKE_SYSTEM_PATH "NO_CMAKE_SYSTEM_PATH" )
endif ( )
if ( UNIX AND NOT APPLE AND YUZU_USE_BUNDLED_QT )
find_package ( Qt5 ${ QT_VERSION } REQUIRED COMPONENTS Widgets Concurrent Multimedia DBus ${ QT_PREFIX_HINT } ${ YUZU_QT_NO_CMAKE_SYSTEM_PATH } )
if ( Qt6_FOUND )
message ( STATUS "yuzu/CMakeLists.txt: Qt6Widgets_VERSION ${Qt6Widgets_VERSION}, setting QT_VERSION" )
set ( QT_VERSION ${ Qt6Widgets_VERSION } )
set ( QT_MAJOR_VERSION 6 )
# Q t 6 s e t s c x x _ s t d _ 1 7 a n d w e n e e d t o u n d o t h a t
set_target_properties ( Qt6::Platform PROPERTIES INTERFACE_COMPILE_FEATURES "" )
else ( )
find_package ( Qt5 ${ QT_VERSION } REQUIRED COMPONENTS Widgets Concurrent Multimedia ${ QT_PREFIX_HINT } ${ YUZU_QT_NO_CMAKE_SYSTEM_PATH } )
endif ( )
if ( YUZU_USE_QT_WEB_ENGINE )
find_package ( Qt5 REQUIRED COMPONENTS WebEngineCore WebEngineWidgets )
message ( STATUS "yuzu/CMakeLists.txt: Qt6 not found/not selected, trying for Qt5" )
# W h e n Q t 6 p a r t i a l l y f o u n d , n e e d t h i s s e t t o u s e Q t 5 w h e n n o t s p e c i f y i n g v e r s i o n
set ( QT_DEFAULT_MAJOR_VERSION 5 )
set ( QT_MAJOR_VERSION 5 )
set ( YUZU_USE_QT_MULTIMEDIA ON )
# C h e c k f o r s y s t e m Q t o n L i n u x , f a l l b a c k t o b u n d l e d Q t
if ( UNIX AND NOT APPLE )
if ( NOT YUZU_USE_BUNDLED_QT )
find_package ( Qt5 ${ QT5_VERSION } COMPONENTS Widgets DBus Multimedia )
endif ( )
if ( ${ CMAKE_SYSTEM_NAME } STREQUAL "Linux" AND ( NOT Qt5_FOUND OR YUZU_USE_BUNDLED_QT ) )
# C h e c k f o r d e p e n d e n c i e s , t h e n e n a b l e b u n d l e d Q t d o w n l o a d
# C h e c k t h a t t h e s y s t e m G L I B C X X v e r s i o n i s c o m p a t i b l e
find_program ( OBJDUMP objdump )
if ( NOT OBJDUMP )
message ( FATAL_ERROR "Required program `objdump` not found." )
endif ( )
find_library ( LIBSTDCXX libstdc++.so.6 )
execute_process (
C O M M A N D
$ { O B J D U M P } - T $ { L I B S T D C X X }
C O M M A N D
g r e p G L I B C X X _ 3 . 4 . 2 8
C O M M A N D
s e d " s / [ 0 - 9 a - f ] * . * / / "
C O M M A N D
s e d " s / . * / / "
C O M M A N D
s o r t - u
O U T P U T _ V A R I A B L E
G L I B C X X _ M E T
)
if ( NOT GLIBCXX_MET )
message ( FATAL_ERROR " Qt too old or not found, and bundled Qt package is not \
c o m p a t i b l e w i t h t h i s s y s t e m . E i t h e r i n s t a l l Q t $ { Q T _ V E R S I O N } , o r p r o v i d e t h e p a t h \
t o Q t b y s e t t i n g t h e v a r i a b l e Q t 5 _ R O O T . " )
endif ( )
# C h e c k f o r h e a d e r s
find_package ( PkgConfig REQUIRED )
pkg_check_modules ( QT_DEP_GLU QUIET glu>=9.0.0 )
if ( NOT QT_DEP_GLU_FOUND )
message ( FATAL_ERROR " Qt bundled pacakge dependency `glu` not found. \
P e r h a p s ` l i b g l u 1 - m e s a - d e v ` n e e d s t o b e i n s t a l l e d ? " )
endif ( )
pkg_check_modules ( QT_DEP_MESA QUIET dri>=20.0.8 )
if ( NOT QT_DEP_MESA_FOUND )
message ( FATAL_ERROR " Qt bundled pacakge dependency `dri` not found. \
P e r h a p s ` m e s a - c o m m o n - d e v ` n e e d s t o b e i n s t a l l e d ? " )
endif ( )
# C h e c k f o r X l i b r a r i e s
set ( BUNDLED_QT_REQUIREMENTS
l i b x c b - i c c c m . s o . 4
l i b x c b - i m a g e . s o . 0
l i b x c b - k e y s y m s . s o . 1
l i b x c b - r a n d r . s o . 0
l i b x c b - r e n d e r - u t i l . s o . 0
l i b x c b - r e n d e r . s o . 0
l i b x c b - s h a p e . s o . 0
l i b x c b - s h m . s o . 0
l i b x c b - s y n c . s o . 1
l i b x c b - x f i x e s . s o . 0
l i b x c b - x i n e r a m a . s o . 0
l i b x c b - x k b . s o . 1
l i b x c b . s o . 1
l i b x k b c o m m o n - x 1 1 . s o . 0
l i b x k b c o m m o n . s o . 0
)
set ( UNRESOLVED_QT_DEPS "" )
foreach ( REQUIREMENT ${ BUNDLED_QT_REQUIREMENTS } )
find_library ( BUNDLED_QT_ ${ REQUIREMENT } ${ REQUIREMENT } )
if ( NOT BUNDLED_QT_ ${ REQUIREMENT } )
set ( UNRESOLVED_QT_DEPS ${ UNRESOLVED_QT_DEPS } ${ REQUIREMENT } )
endif ( )
unset ( BUNDLED_QT_ ${ REQUIREMENT } )
endforeach ( )
unset ( BUNDLED_QT_REQUIREMENTS )
if ( NOT "${UNRESOLVED_QT_DEPS}" STREQUAL "" )
message ( FATAL_ERROR "Bundled Qt package missing required dependencies: ${UNRESOLVED_QT_DEPS}" )
endif ( )
set ( YUZU_USE_BUNDLED_QT ON CACHE BOOL "Download bundled Qt" FORCE )
endif ( )
if ( YUZU_USE_BUNDLED_QT )
# B i n a r y p a c k a g e c u r r e n t l y d o e s n o t s u p p o r t Q t w e b e n g i n e , s o m a k e s u r e i t ' s d i s a b l e d
set ( YUZU_USE_QT_WEB_ENGINE OFF CACHE BOOL "Use Qt Webengine" FORCE )
endif ( )
endif ( )
set ( YUZU_QT_NO_CMAKE_SYSTEM_PATH )
if ( YUZU_USE_BUNDLED_QT )
if ( ( MSVC_VERSION GREATER_EQUAL 1920 AND MSVC_VERSION LESS 1940 ) AND ARCHITECTURE_x86_64 )
set ( QT_BUILD qt-5.15.2-msvc2019_64 )
elseif ( ( ${ CMAKE_SYSTEM_NAME } STREQUAL "Linux" ) AND NOT MINGW AND ARCHITECTURE_x86_64 )
set ( QT_BUILD qt5_5_15_2 )
else ( )
message ( FATAL_ERROR "No bundled Qt binaries for your toolchain. Disable YUZU_USE_BUNDLED_QT and provide your own." )
endif ( )
if ( DEFINED QT_BUILD )
download_bundled_external ( "qt/" ${ QT_BUILD } QT_PREFIX )
endif ( )
set ( QT_PREFIX_HINT HINTS "${QT_PREFIX}" )
set ( YUZU_QT_NO_CMAKE_SYSTEM_PATH "NO_CMAKE_SYSTEM_PATH" )
# B i n a r y p a c k a g e f o r Q t 5 h a s Q t M u l t i m e d i a
set ( YUZU_USE_QT_MULTIMEDIA ON CACHE BOOL "Use Qt Multimedia" FORCE )
endif ( )
set_yuzu_qt_components ( )
find_package ( Qt5 ${ QT5_VERSION } COMPONENTS ${ YUZU_QT_COMPONENTS } ${ QT_PREFIX_HINT } ${ YUZU_QT_NO_CMAKE_SYSTEM_PATH } )
endif ( )
if ( ENABLE_QT_TRANSLATION )
find_package ( Qt5 REQUIRED COMPONENTS LinguistTools ${ QT_PREFIX_HINT } )
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