diff options
Diffstat (limited to 'CMakeLists.txt')
| -rw-r--r-- | CMakeLists.txt | 78 |
1 files changed, 38 insertions, 40 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index ac7c3ce90..a4a6da2e1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
| @@ -11,6 +11,7 @@ project(yuzu) | |||
| 11 | # Set bundled sdl2/qt as dependent options. | 11 | # Set bundled sdl2/qt as dependent options. |
| 12 | # OFF by default, but if ENABLE_SDL2 and MSVC are true then ON | 12 | # OFF by default, but if ENABLE_SDL2 and MSVC are true then ON |
| 13 | option(ENABLE_SDL2 "Enable the SDL2 frontend" ON) | 13 | option(ENABLE_SDL2 "Enable the SDL2 frontend" ON) |
| 14 | CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_SDL2 "Download bundled SDL2 binaries" ON "ENABLE_SDL2;MSVC" OFF) | ||
| 14 | 15 | ||
| 15 | option(ENABLE_QT "Enable the Qt frontend" ON) | 16 | option(ENABLE_QT "Enable the Qt frontend" ON) |
| 16 | option(ENABLE_QT_TRANSLATION "Enable translations for the Qt frontend" OFF) | 17 | option(ENABLE_QT_TRANSLATION "Enable translations for the Qt frontend" OFF) |
| @@ -166,12 +167,12 @@ macro(yuzu_find_packages) | |||
| 166 | # Cmake Pkg Prefix Version Conan Pkg | 167 | # Cmake Pkg Prefix Version Conan Pkg |
| 167 | "Catch2 2.13 catch2/2.13.0" | 168 | "Catch2 2.13 catch2/2.13.0" |
| 168 | "fmt 7.1 fmt/7.1.2" | 169 | "fmt 7.1 fmt/7.1.2" |
| 169 | # can't use until https://github.com/bincrafters/community/issues/1173 | ||
| 170 | #"libzip 1.5 libzip/1.5.2@bincrafters/stable" | ||
| 171 | "lz4 1.8 lz4/1.9.2" | 170 | "lz4 1.8 lz4/1.9.2" |
| 172 | "nlohmann_json 3.8 nlohmann_json/3.8.0" | 171 | "nlohmann_json 3.8 nlohmann_json/3.8.0" |
| 173 | "ZLIB 1.2 zlib/1.2.11" | 172 | "ZLIB 1.2 zlib/1.2.11" |
| 174 | "zstd 1.4 zstd/1.4.8" | 173 | "zstd 1.4 zstd/1.4.8" |
| 174 | # can't use opus until AVX check is fixed: https://github.com/yuzu-emu/yuzu/pull/4068 | ||
| 175 | #"opus 1.3 opus/1.3.1" | ||
| 175 | ) | 176 | ) |
| 176 | 177 | ||
| 177 | foreach(PACKAGE ${REQUIRED_LIBS}) | 178 | foreach(PACKAGE ${REQUIRED_LIBS}) |
| @@ -249,22 +250,44 @@ if(ENABLE_QT) | |||
| 249 | if (ENABLE_QT_TRANSLATION) | 250 | if (ENABLE_QT_TRANSLATION) |
| 250 | find_package(Qt5 REQUIRED COMPONENTS LinguistTools ${QT_PREFIX_HINT}) | 251 | find_package(Qt5 REQUIRED COMPONENTS LinguistTools ${QT_PREFIX_HINT}) |
| 251 | endif() | 252 | endif() |
| 252 | if (NOT Qt5_FOUND) | ||
| 253 | list(APPEND CONAN_REQUIRED_LIBS "qt/5.14.1@bincrafters/stable") | ||
| 254 | endif() | ||
| 255 | endif() | 253 | endif() |
| 256 | # find SDL2 exports a bunch of variables that are needed, so its easier to do this outside of the yuzu_find_package | 254 | # find SDL2 exports a bunch of variables that are needed, so its easier to do this outside of the yuzu_find_package |
| 257 | if(ENABLE_SDL2) | 255 | if (ENABLE_SDL2) |
| 258 | if(EXISTS ${CMAKE_BINARY_DIR}/sdl2Config.cmake) | 256 | if (YUZU_USE_BUNDLED_SDL2) |
| 259 | include(${CMAKE_BINARY_DIR}/sdl2Config.cmake) | 257 | # Detect toolchain and platform |
| 260 | list(APPEND CMAKE_MODULE_PATH "${CONAN_SDL2_ROOT_RELEASE}") | 258 | if ((MSVC_VERSION GREATER_EQUAL 1910 AND MSVC_VERSION LESS 1930) AND ARCHITECTURE_x86_64) |
| 261 | list(APPEND CMAKE_PREFIX_PATH "${CONAN_SDL2_ROOT_RELEASE}") | 259 | set(SDL2_VER "SDL2-2.0.14") |
| 262 | endif() | 260 | else() |
| 263 | find_package(SDL2) | 261 | message(FATAL_ERROR "No bundled SDL2 binaries for your toolchain. Disable YUZU_USE_BUNDLED_SDL2 and provide your own.") |
| 264 | if (NOT SDL2_FOUND) | 262 | endif() |
| 265 | # otherwise add this to the list of libraries to install | 263 | |
| 266 | list(APPEND CONAN_REQUIRED_LIBS "sdl2/2.0.14@bincrafters/stable") | 264 | if (DEFINED SDL2_VER) |
| 265 | download_bundled_external("sdl2/" ${SDL2_VER} SDL2_PREFIX) | ||
| 266 | endif() | ||
| 267 | |||
| 268 | set(SDL2_FOUND YES) | ||
| 269 | set(SDL2_INCLUDE_DIR "${SDL2_PREFIX}/include" CACHE PATH "Path to SDL2 headers") | ||
| 270 | set(SDL2_LIBRARY "${SDL2_PREFIX}/lib/x64/SDL2.lib" CACHE PATH "Path to SDL2 library") | ||
| 271 | set(SDL2_DLL_DIR "${SDL2_PREFIX}/lib/x64/" CACHE PATH "Path to SDL2.dll") | ||
| 272 | |||
| 273 | add_library(SDL2 INTERFACE) | ||
| 274 | target_link_libraries(SDL2 INTERFACE "${SDL2_LIBRARY}") | ||
| 275 | target_include_directories(SDL2 INTERFACE "${SDL2_INCLUDE_DIR}") | ||
| 276 | else() | ||
| 277 | find_package(SDL2 REQUIRED) | ||
| 278 | |||
| 279 | # Some installations don't set SDL2_LIBRARIES | ||
| 280 | if("${SDL2_LIBRARIES}" STREQUAL "") | ||
| 281 | message(WARNING "SDL2_LIBRARIES wasn't set, manually setting to SDL2::SDL2") | ||
| 282 | set(SDL2_LIBRARIES "SDL2::SDL2") | ||
| 283 | endif() | ||
| 284 | |||
| 285 | include_directories(SYSTEM ${SDL2_INCLUDE_DIRS}) | ||
| 286 | add_library(SDL2 INTERFACE) | ||
| 287 | target_link_libraries(SDL2 INTERFACE "${SDL2_LIBRARIES}") | ||
| 267 | endif() | 288 | endif() |
| 289 | else() | ||
| 290 | set(SDL2_FOUND NO) | ||
| 268 | endif() | 291 | endif() |
| 269 | 292 | ||
| 270 | # Install any missing dependencies with conan install | 293 | # Install any missing dependencies with conan install |
| @@ -285,9 +308,6 @@ if (CONAN_REQUIRED_LIBS) | |||
| 285 | ) | 308 | ) |
| 286 | 309 | ||
| 287 | conan_check(VERSION 1.24.0 REQUIRED) | 310 | conan_check(VERSION 1.24.0 REQUIRED) |
| 288 | # Add the bincrafters remote | ||
| 289 | conan_add_remote(NAME bincrafters | ||
| 290 | URL https://api.bintray.com/conan/bincrafters/public-conan) | ||
| 291 | 311 | ||
| 292 | # Manually add iconv to fix a dep conflict between qt and sdl2 | 312 | # Manually add iconv to fix a dep conflict between qt and sdl2 |
| 293 | # We don't need to add it through find_package or anything since the other two can find it just fine | 313 | # We don't need to add it through find_package or anything since the other two can find it just fine |
| @@ -338,11 +358,6 @@ if (CONAN_REQUIRED_LIBS) | |||
| 338 | find_package(Qt5 REQUIRED COMPONENTS WebEngineCore WebEngineWidgets) | 358 | find_package(Qt5 REQUIRED COMPONENTS WebEngineCore WebEngineWidgets) |
| 339 | endif() | 359 | endif() |
| 340 | endif() | 360 | endif() |
| 341 | if(ENABLE_SDL2) | ||
| 342 | list(APPEND CMAKE_MODULE_PATH "${CONAN_SDL2_ROOT_RELEASE}") | ||
| 343 | list(APPEND CMAKE_PREFIX_PATH "${CONAN_SDL2_ROOT_RELEASE}") | ||
| 344 | find_package(SDL2 REQUIRED) | ||
| 345 | endif() | ||
| 346 | 361 | ||
| 347 | endif() | 362 | endif() |
| 348 | 363 | ||
| @@ -358,23 +373,6 @@ elseif (TARGET Boost::boost) | |||
| 358 | add_library(boost ALIAS Boost::boost) | 373 | add_library(boost ALIAS Boost::boost) |
| 359 | endif() | 374 | endif() |
| 360 | 375 | ||
| 361 | if (TARGET sdl2::sdl2) | ||
| 362 | # imported from the conan generated sdl2Config.cmake | ||
| 363 | set_target_properties(sdl2::sdl2 PROPERTIES IMPORTED_GLOBAL TRUE) | ||
| 364 | add_library(SDL2 ALIAS sdl2::sdl2) | ||
| 365 | elseif(SDL2_FOUND) | ||
| 366 | # found through the system package manager | ||
| 367 | # Some installations don't set SDL2_LIBRARIES | ||
| 368 | if("${SDL2_LIBRARIES}" STREQUAL "") | ||
| 369 | message(WARNING "SDL2_LIBRARIES wasn't set, manually setting to SDL2::SDL2") | ||
| 370 | set(SDL2_LIBRARIES "SDL2::SDL2") | ||
| 371 | endif() | ||
| 372 | |||
| 373 | include_directories(SYSTEM ${SDL2_INCLUDE_DIRS}) | ||
| 374 | add_library(SDL2 INTERFACE) | ||
| 375 | target_link_libraries(SDL2 INTERFACE "${SDL2_LIBRARIES}") | ||
| 376 | endif() | ||
| 377 | |||
| 378 | # Ensure libusb is properly configured (based on dolphin libusb include) | 376 | # Ensure libusb is properly configured (based on dolphin libusb include) |
| 379 | if(NOT APPLE) | 377 | if(NOT APPLE) |
| 380 | include(FindPkgConfig) | 378 | include(FindPkgConfig) |