@ -144,82 +144,34 @@ endif()
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
# I f n o t f o u n d , d o w n l o a d a n y m i s s i n g t h r o u g h C o n a n
# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
set ( CONAN_CMAKE_SILENT_OUTPUT TRUE )
set ( CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE )
if ( YUZU_CONAN_INSTALLED )
if ( IS_MULTI_CONFIG )
include ( ${ CMAKE_BINARY_DIR } /conanbuildinfo_multi.cmake )
else ( )
include ( ${ CMAKE_BINARY_DIR } /conanbuildinfo.cmake )
endif ( )
list ( APPEND CMAKE_MODULE_PATH "${CMAKE_BINARY_DIR}" )
list ( APPEND CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}" )
conan_basic_setup ( )
message ( STATUS "Adding conan installed libraries to the search path" )
find_package ( fmt 8.0.1 REQUIRED CONFIG )
find_package ( lz4 1.8 REQUIRED )
find_package ( nlohmann_json 3.8 REQUIRED CONFIG )
find_package ( ZLIB 1.2 REQUIRED )
# S e a r c h f o r c o n f i g - o n l y p a c k a g e first ( for vcpkg ) , t h e n t r y n o n - c o n f i g
find_package ( zstd 1.5 CONFIG )
if ( NOT zstd_FOUND )
find_package ( zstd 1.5 REQUIRED )
endif ( )
macro( yuzu_find_packages )
set( options FORCE_REQUIRED )
cmake_parse_arguments ( FN "${options}" "" "" ${ ARGN } )
if ( YUZU_TESTS )
find_package( Catch2 2.13.7 REQUIRED CONFIG )
endif ( )
# C m a k e h a s a * s e r i o u s * l a c k o f 2 D a r r a y o r a s s o c i a t i v e a r r a y . . .
# C a p i t a l i z a t i o n m a t t e r s h e r e . W e n e e d t h e n a m i n g t o m a t c h t h e g e n e r a t e d p a t h s f r o m C o n a n
set ( REQUIRED_LIBS
# 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
" f m t 8 . 0 . 1 f m t / 8 . 1 . 1 "
" 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 "
" z s t d 1 . 5 z s t d / 1 . 5 . 0 "
# c a n ' t u s e o p u s u n t i l A V X c h e c k i s f i x e d : h t t p s : / / g i t h u b . c o m / y u z u - e m u / y u z u / p u l l / 4 0 6 8
# " o p u s 1 . 3 o p u s / 1 . 3 . 1 "
)
if ( YUZU_TESTS )
list ( APPEND REQUIRED_LIBS
" C a t c h 2 2 . 1 3 . 7 c a t c h 2 / 2 . 1 3 . 7 "
)
endif ( )
foreach ( PACKAGE ${ REQUIRED_LIBS } )
string ( REGEX REPLACE "[ \t\r\n]+" ";" PACKAGE_SPLIT ${ PACKAGE } )
list ( GET PACKAGE_SPLIT 0 PACKAGE_PREFIX )
list ( GET PACKAGE_SPLIT 1 PACKAGE_VERSION )
list ( GET PACKAGE_SPLIT 2 PACKAGE_CONAN )
# T h i s f u n c t i o n i s c a l l e d t w i c e , o n c e t o c h e c k i f t h e p a c k a g e s e x i s t o n t h e s y s t e m a l r e a d y
# a n d a s e c o n d t i m e t o c h e c k i f c o n a n i n s t a l l e d t h e m p r o p e r l y . T h e s e c o n d c h e c k p a s s e s i n F O R C E _ R E Q U I R E D
if ( NOT ${ PACKAGE_PREFIX } _FOUND )
if ( FN_FORCE_REQUIRED )
find_package ( ${ PACKAGE_PREFIX } ${ PACKAGE_VERSION } REQUIRED )
else ( )
find_package ( ${ PACKAGE_PREFIX } ${ PACKAGE_VERSION } )
endif ( )
endif ( )
if ( NOT ${ PACKAGE_PREFIX } _FOUND )
list ( APPEND CONAN_REQUIRED_LIBS ${ PACKAGE_CONAN } )
else ( )
# S e t a l e g a c y f i n d P a c k a g e . c m a k e s t y l e P A C K A G E _ L I B R A R I E S v a r i a b l e f o r s u b p r o j e c t s t h a t r e l y o n t h i s
set ( ${ PACKAGE_PREFIX } _LIBRARIES "${PACKAGE_PREFIX}::${PACKAGE_PREFIX}" )
endif ( )
endforeach ( )
unset ( FN_FORCE_REQUIRED )
endmacro ( )
find_package ( Boost 1.73.0 COMPONENTS context headers )
find_package ( Boost 1.73.0 COMPONENTS context )
if ( Boost_FOUND )
set ( Boost_LIBRARIES Boost::boost )
# C o n d i t i o n a l l y a d d B o o s t : : c o n t e x t o n l y i f t h e ac t i v e v e r s i o n o f t h e C o n a n o r s y s t e m B o o s t p a c k a g e p r o v i d e s i t
# C o n d i t i o n a l l y a d d B o o s t : : c o n t e x t o n l y i f t h e f o u n d B o o s t p a c k a g e p r o v i d e s i t
# T h e o l d v e r s i o n i s m i s s i n g B o o s t : : c o n t e x t , s o w e w a n t t o a v o i d a d d i n g i n t h a t c a s e
# T h e n e w v e r s i o n r e q u i r e s a d d i n g B o o s t : : c o n t e x t t o p r e v e n t l i n k i n g i s s u e s
#
# T h i s o n e i s u s e d b y C o n a n o n s u b s e q u e n t C M a k e c o n f i g u r e s , n o t t h e f i r s t c o n f i g u r e .
if ( TARGET Boost::context )
list ( APPEND Boost_LIBRARIES Boost::context )
endif ( )
else ( )
message ( STATUS "Boost 1.79.0 or newer not found, falling back to Conan" )
list ( APPEND CONAN_REQUIRED_LIBS "boost/1.79.0" )
message ( FATAL_ERROR "Boost 1.73.0 or newer not found" )
endif ( )
# b o o s t : a s i o h a s f u n c t i o n s t h a t r e q u i r e A c c e p t E x e t a l
@ -227,19 +179,9 @@ if (MINGW)
find_library ( MSWSOCK_LIBRARY mswsock REQUIRED )
endif ( )
# A t t e m p t t o l o c a t e a n y p a c k a g e s t h a t a r e r e q u i r e d a n d r e p o r t t h e m i s s i n g o n e s i n C O N A N _ R E Q U I R E D _ L I B S
yuzu_find_packages ( )
# 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 )
# W e w a n t t o l o a d t h e g e n e r a t e d c o n a n q t c o n f i g s o t h a t w e g e t t h e Q T _ R O O T v a r s o t h a t w e c a n u s e t h e o f f i c i a l
# Q t 5 C o n f i g i n s i d e t h e r o o t f o l d e r i n s t e a d o f t h e c o n a n g e n e r a t e d o n e .
if ( EXISTS ${ CMAKE_BINARY_DIR } /qtConfig.cmake )
include ( ${ CMAKE_BINARY_DIR } /qtConfig.cmake )
list ( APPEND CMAKE_MODULE_PATH "${CONAN_QT_ROOT_RELEASE}" )
list ( APPEND CMAKE_PREFIX_PATH "${CONAN_QT_ROOT_RELEASE}" )
endif ( )
# 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 ( ${ CMAKE_SYSTEM_NAME } STREQUAL "Linux" )
@ -330,9 +272,6 @@ if(ENABLE_QT)
set ( YUZU_QT_NO_CMAKE_SYSTEM_PATH )
# W o r k a r o u n d f o r a n i s s u e w h e r e c o n a n t r i e s t o b u i l d Q t f r o m s c r a t c h i n s t e a d o f d o w n l o a d p r e b u i l t b i n a r i e s
set ( QT_PREFIX_HINT )
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 )
@ -403,71 +342,8 @@ if (ENABLE_SDL2)
endif ( )
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
if ( CONAN_REQUIRED_LIBS )
message ( STATUS "Packages ${CONAN_REQUIRED_LIBS} not found!" )
# U s e C o n a n t o f e t c h t h e l i b r a r i e s t h a t a r e n ' t f o u n d
# D o w n l o a d c o n a n . c m a k e a u t o m a t i c a l l y , y o u c a n a l s o j u s t c o p y t h e c o n a n . c m a k e f i l e
if ( NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake" )
message ( STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan" )
file ( DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/release/0.18/conan.cmake" "${CMAKE_BINARY_DIR}/conan.cmake" )
endif ( )
include ( ${ CMAKE_BINARY_DIR } /conan.cmake )
conan_check ( VERSION 1.45.0 REQUIRED )
# 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
if ( "${CONAN_REQUIRED_LIBS}" MATCHES "qt" AND "${CONAN_REQUIRED_LIBS}" MATCHES "sdl" )
list ( APPEND CONAN_REQUIRED_LIBS "libiconv/1.16" )
endif ( )
if ( IS_MULTI_CONFIG )
conan_cmake_run ( REQUIRES ${ CONAN_REQUIRED_LIBS }
O P T I O N S $ { C O N A N _ L I B _ O P T I O N S }
B U I L D m i s s i n g
C O N F I G U R A T I O N _ T Y P E S " R e l e a s e ; D e b u g "
G E N E R A T O R S c m a k e _ m u l t i c m a k e _ f i n d _ p a c k a g e _ m u l t i )
include ( ${ CMAKE_BINARY_DIR } /conanbuildinfo_multi.cmake )
else ( )
conan_cmake_run ( REQUIRES ${ CONAN_REQUIRED_LIBS }
O P T I O N S $ { C O N A N _ L I B _ O P T I O N S }
B U I L D m i s s i n g
G E N E R A T O R S c m a k e c m a k e _ f i n d _ p a c k a g e _ m u l t i )
include ( ${ CMAKE_BINARY_DIR } /conanbuildinfo.cmake )
endif ( )
list ( APPEND CMAKE_MODULE_PATH "${CMAKE_BINARY_DIR}" )
list ( APPEND CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}" )
conan_basic_setup ( )
set ( YUZU_CONAN_INSTALLED TRUE CACHE BOOL "If true, the following builds will add conan to the lib search path" FORCE )
# N o w t h a t w e ' v e i n s t a l l e d w h a t w e a r e m i s s i n g , t r y t o l o c a t e t h e m a g a i n ,
# t h i s t i m e w i t h r e q u i r e d , s o w e b a i l i f i t s n o t f o u n d .
yuzu_find_packages ( FORCE_REQUIRED )
if ( NOT Boost_FOUND )
find_package ( Boost 1.73.0 REQUIRED COMPONENTS context headers )
set ( Boost_LIBRARIES Boost::boost )
# C o n d i t i o n a l l y a d d B o o s t : : c o n t e x t o n l y i f t h e a c t i v e v e r s i o n o f t h e C o n a n B o o s t p a c k a g e p r o v i d e s i t
# T h e o l d v e r s i o n i s m i s s i n g B o o s t : : c o n t e x t , s o w e w a n t t o a v o i d a d d i n g i n t h a t c a s e
# T h e n e w v e r s i o n r e q u i r e s a d d i n g B o o s t : : c o n t e x t t o p r e v e n t l i n k i n g i s s u e s
if ( TARGET Boost::context )
list ( APPEND Boost_LIBRARIES Boost::context )
endif ( )
endif ( )
# D u e t o i s s u e s w i t h v a r i a b l e s c o p e s i n f u n c t i o n s , w e n e e d t o a l s o find_package ( qt5 ) o u t s i d e o f t h e f u n c t i o n
if ( ENABLE_QT )
list ( APPEND CMAKE_MODULE_PATH "${CONAN_QT_ROOT_RELEASE}" )
list ( APPEND CMAKE_PREFIX_PATH "${CONAN_QT_ROOT_RELEASE}" )
find_package ( Qt5 5.15 REQUIRED COMPONENTS Widgets )
if ( YUZU_USE_QT_WEB_ENGINE )
find_package ( Qt5 REQUIRED COMPONENTS WebEngineCore WebEngineWidgets )
endif ( )
endif ( )
endif ( )
# TODO ( lat9nq ) : D e t e r m i n e w h a t i f a n y o f t h i s w e s t i l l n e e d
#
# R e e x p o r t s o m e t a r g e t s t h a t a r e n a m e d d i f f e r e n t l y w h e n u s i n g t h e u p s t r e a m C m a k e C o n f i g v s t h e g e n e r a t e d C o n a n c o n f i g
# I n o r d e r t o A L I A S t a r g e t s t o a n e w n a m e , t h e y f i r s t n e e d t o b e I M P O R T E D _ G L O B A L
# D y n a r m i c c h e c k s f o r t a r g e t ` b o o s t ` a n d s o w e w a n t t o m a k e s u r e i t c a n f i n d i t t h r o u g h o u r s y s t e m i n s t e a d o f u s i n g t h e i r e x t e r n a l