diff options
| -rw-r--r-- | .ci/templates/build-msvc.yml | 2 | ||||
| -rw-r--r-- | CMakeLists.txt | 76 |
2 files changed, 37 insertions, 41 deletions
diff --git a/.ci/templates/build-msvc.yml b/.ci/templates/build-msvc.yml index 097367018..74e688c12 100644 --- a/.ci/templates/build-msvc.yml +++ b/.ci/templates/build-msvc.yml | |||
| @@ -8,7 +8,7 @@ steps: | |||
| 8 | displayName: 'Install vulkan-sdk' | 8 | displayName: 'Install vulkan-sdk' |
| 9 | - script: python -m pip install --upgrade pip conan | 9 | - script: python -m pip install --upgrade pip conan |
| 10 | displayName: 'Install conan' | 10 | displayName: 'Install conan' |
| 11 | - script: refreshenv && mkdir build && cd build && cmake -G "Visual Studio 16 2019" -A x64 -DYUZU_USE_BUNDLED_QT=1 -DYUZU_USE_QT_WEB_ENGINE=ON -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DYUZU_ENABLE_COMPATIBILITY_REPORTING=${COMPAT} -DUSE_DISCORD_PRESENCE=ON -DENABLE_QT_TRANSLATION=ON -DDISPLAY_VERSION=${{ parameters['version'] }} .. && cmake --install . --config Release && cd .. | 11 | - script: refreshenv && mkdir build && cd build && cmake -G "Visual Studio 16 2019" -A x64 -DYUZU_USE_BUNDLED_QT=1 -DYUZU_USE_BUNDLED_SDL2=1 -DYUZU_USE_QT_WEB_ENGINE=ON -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DYUZU_ENABLE_COMPATIBILITY_REPORTING=${COMPAT} -DUSE_DISCORD_PRESENCE=ON -DENABLE_QT_TRANSLATION=ON -DDISPLAY_VERSION=${{ parameters['version'] }} .. && cmake --install . --config Release && cd .. |
| 12 | displayName: 'Configure CMake' | 12 | displayName: 'Configure CMake' |
| 13 | - task: MSBuild@1 | 13 | - task: MSBuild@1 |
| 14 | displayName: 'Build' | 14 | displayName: 'Build' |
diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ea6c650e..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,8 +167,6 @@ 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" |
| @@ -251,22 +250,44 @@ if(ENABLE_QT) | |||
| 251 | if (ENABLE_QT_TRANSLATION) | 250 | if (ENABLE_QT_TRANSLATION) |
| 252 | find_package(Qt5 REQUIRED COMPONENTS LinguistTools ${QT_PREFIX_HINT}) | 251 | find_package(Qt5 REQUIRED COMPONENTS LinguistTools ${QT_PREFIX_HINT}) |
| 253 | endif() | 252 | endif() |
| 254 | if (NOT Qt5_FOUND) | ||
| 255 | list(APPEND CONAN_REQUIRED_LIBS "qt/5.14.1@bincrafters/stable") | ||
| 256 | endif() | ||
| 257 | endif() | 253 | endif() |
| 258 | # 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 |
| 259 | if(ENABLE_SDL2) | 255 | if (ENABLE_SDL2) |
| 260 | if(EXISTS ${CMAKE_BINARY_DIR}/sdl2Config.cmake) | 256 | if (YUZU_USE_BUNDLED_SDL2) |
| 261 | include(${CMAKE_BINARY_DIR}/sdl2Config.cmake) | 257 | # Detect toolchain and platform |
| 262 | 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) |
| 263 | list(APPEND CMAKE_PREFIX_PATH "${CONAN_SDL2_ROOT_RELEASE}") | 259 | set(SDL2_VER "SDL2-2.0.14") |
| 264 | endif() | 260 | else() |
| 265 | find_package(SDL2) | 261 | message(FATAL_ERROR "No bundled SDL2 binaries for your toolchain. Disable YUZU_USE_BUNDLED_SDL2 and provide your own.") |
| 266 | if (NOT SDL2_FOUND) | 262 | endif() |
| 267 | # otherwise add this to the list of libraries to install | 263 | |
| 268 | 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}") | ||
| 269 | endif() | 288 | endif() |
| 289 | else() | ||
| 290 | set(SDL2_FOUND NO) | ||
| 270 | endif() | 291 | endif() |
| 271 | 292 | ||
| 272 | # Install any missing dependencies with conan install | 293 | # Install any missing dependencies with conan install |
| @@ -287,9 +308,6 @@ if (CONAN_REQUIRED_LIBS) | |||
| 287 | ) | 308 | ) |
| 288 | 309 | ||
| 289 | conan_check(VERSION 1.24.0 REQUIRED) | 310 | conan_check(VERSION 1.24.0 REQUIRED) |
| 290 | # Add the bincrafters remote | ||
| 291 | conan_add_remote(NAME bincrafters | ||
| 292 | URL https://api.bintray.com/conan/bincrafters/public-conan) | ||
| 293 | 311 | ||
| 294 | # 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 |
| 295 | # 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 |
| @@ -340,11 +358,6 @@ if (CONAN_REQUIRED_LIBS) | |||
| 340 | find_package(Qt5 REQUIRED COMPONENTS WebEngineCore WebEngineWidgets) | 358 | find_package(Qt5 REQUIRED COMPONENTS WebEngineCore WebEngineWidgets) |
| 341 | endif() | 359 | endif() |
| 342 | endif() | 360 | endif() |
| 343 | if(ENABLE_SDL2) | ||
| 344 | list(APPEND CMAKE_MODULE_PATH "${CONAN_SDL2_ROOT_RELEASE}") | ||
| 345 | list(APPEND CMAKE_PREFIX_PATH "${CONAN_SDL2_ROOT_RELEASE}") | ||
| 346 | find_package(SDL2 REQUIRED) | ||
| 347 | endif() | ||
| 348 | 361 | ||
| 349 | endif() | 362 | endif() |
| 350 | 363 | ||
| @@ -360,23 +373,6 @@ elseif (TARGET Boost::boost) | |||
| 360 | add_library(boost ALIAS Boost::boost) | 373 | add_library(boost ALIAS Boost::boost) |
| 361 | endif() | 374 | endif() |
| 362 | 375 | ||
| 363 | if (TARGET sdl2::sdl2) | ||
| 364 | # imported from the conan generated sdl2Config.cmake | ||
| 365 | set_target_properties(sdl2::sdl2 PROPERTIES IMPORTED_GLOBAL TRUE) | ||
| 366 | add_library(SDL2 ALIAS sdl2::sdl2) | ||
| 367 | elseif(SDL2_FOUND) | ||
| 368 | # found through the system package manager | ||
| 369 | # Some installations don't set SDL2_LIBRARIES | ||
| 370 | if("${SDL2_LIBRARIES}" STREQUAL "") | ||
| 371 | message(WARNING "SDL2_LIBRARIES wasn't set, manually setting to SDL2::SDL2") | ||
| 372 | set(SDL2_LIBRARIES "SDL2::SDL2") | ||
| 373 | endif() | ||
| 374 | |||
| 375 | include_directories(SYSTEM ${SDL2_INCLUDE_DIRS}) | ||
| 376 | add_library(SDL2 INTERFACE) | ||
| 377 | target_link_libraries(SDL2 INTERFACE "${SDL2_LIBRARIES}") | ||
| 378 | endif() | ||
| 379 | |||
| 380 | # Ensure libusb is properly configured (based on dolphin libusb include) | 376 | # Ensure libusb is properly configured (based on dolphin libusb include) |
| 381 | if(NOT APPLE) | 377 | if(NOT APPLE) |
| 382 | include(FindPkgConfig) | 378 | include(FindPkgConfig) |