From c9b2bd9077aef1238ddde75e1ee781bf7ff13fbd Mon Sep 17 00:00:00 2001 From: Vitor K Date: Fri, 21 Apr 2023 14:09:40 -0300 Subject: [PATCH] msvc: copy openssl dlls (#6428) --- .ci/windows-msvc/build.sh | 3 ++- CMakeLists.txt | 3 +++ CMakeModules/CopyCitraOpensslDeps.cmake | 6 ++++++ src/citra/CMakeLists.txt | 4 ++++ src/citra_qt/CMakeLists.txt | 4 ++++ src/dedicated_room/CMakeLists.txt | 4 ++++ 6 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 CMakeModules/CopyCitraOpensslDeps.cmake diff --git a/.ci/windows-msvc/build.sh b/.ci/windows-msvc/build.sh index de7c7f2fb..7daddc269 100644 --- a/.ci/windows-msvc/build.sh +++ b/.ci/windows-msvc/build.sh @@ -12,7 +12,8 @@ cmake .. \ -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON \ -DUSE_DISCORD_PRESENCE=ON \ -DENABLE_MF=ON \ - -DENABLE_FFMPEG_VIDEO_DUMPER=ON + -DENABLE_FFMPEG_VIDEO_DUMPER=ON \ + -DOPENSSL_DLL_DIR="C:\Program Files\OpenSSL\bin" ninja # show the caching efficiency diff --git a/CMakeLists.txt b/CMakeLists.txt index 1511b9778..8dc1c757d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,9 @@ option(ENABLE_QT_TRANSLATION "Enable translations for the Qt frontend" OFF) CMAKE_DEPENDENT_OPTION(CITRA_USE_BUNDLED_QT "Download bundled Qt binaries" ON "ENABLE_QT;MSVC" OFF) option(ENABLE_WEB_SERVICE "Enable web services (telemetry, etc.)" ON) +if (MSVC) + set(OPENSSL_DLL_DIR "" CACHE PATH "Location of the Openssl dlls") +endif() option(ENABLE_CUBEB "Enables the cubeb audio backend" ON) diff --git a/CMakeModules/CopyCitraOpensslDeps.cmake b/CMakeModules/CopyCitraOpensslDeps.cmake new file mode 100644 index 000000000..e53ad628f --- /dev/null +++ b/CMakeModules/CopyCitraOpensslDeps.cmake @@ -0,0 +1,6 @@ +function(copy_citra_openssl_deps target_dir) + include(WindowsCopyFiles) + set(DLL_DEST "${CMAKE_BINARY_DIR}/bin/$/") + windows_copy_files(${target_dir} ${OPENSSL_DLL_DIR} ${DLL_DEST} libcrypto-1_1-x64.dll) + windows_copy_files(${target_dir} ${OPENSSL_DLL_DIR} ${DLL_DEST} libssl-1_1-x64.dll) +endfunction(copy_citra_openssl_deps) diff --git a/src/citra/CMakeLists.txt b/src/citra/CMakeLists.txt index 55494d376..03006f984 100644 --- a/src/citra/CMakeLists.txt +++ b/src/citra/CMakeLists.txt @@ -34,6 +34,10 @@ endif() if (MSVC) include(CopyCitraSDLDeps) copy_citra_SDL_deps(citra) + if (ENABLE_WEB_SERVICE AND OPENSSL_DLL_DIR) + include(CopyCitraOpensslDeps) + copy_citra_openssl_deps(citra) + endif() endif() if (CITRA_USE_PRECOMPILED_HEADERS) diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt index 5b4e9802d..ed4af583a 100644 --- a/src/citra_qt/CMakeLists.txt +++ b/src/citra_qt/CMakeLists.txt @@ -322,6 +322,10 @@ if (MSVC) include(CopyCitraSDLDeps) copy_citra_Qt5_deps(citra-qt) copy_citra_SDL_deps(citra-qt) + if (ENABLE_WEB_SERVICE AND OPENSSL_DLL_DIR) + include(CopyCitraOpensslDeps) + copy_citra_openssl_deps(citra-qt) + endif() if (ENABLE_FFMPEG) include(CopyCitraFFmpegDeps) diff --git a/src/dedicated_room/CMakeLists.txt b/src/dedicated_room/CMakeLists.txt index 480c61bd9..ec2dc5ffd 100644 --- a/src/dedicated_room/CMakeLists.txt +++ b/src/dedicated_room/CMakeLists.txt @@ -12,6 +12,10 @@ target_link_libraries(citra-room PRIVATE common network) if (ENABLE_WEB_SERVICE) target_compile_definitions(citra-room PRIVATE -DENABLE_WEB_SERVICE) target_link_libraries(citra-room PRIVATE web_service) + if (MSVC AND OPENSSL_DLL_DIR) + include(CopyCitraOpensslDeps) + copy_citra_openssl_deps(citra-room) + endif() endif() target_link_libraries(citra-room PRIVATE cryptopp)