From dc28ba1eff4884e9fb831d774bf2f4444db143f1 Mon Sep 17 00:00:00 2001 From: Edgar Date: Sun, 6 Apr 2025 13:04:41 +0200 Subject: [PATCH] :bug: Fixed missing openssl DLL's on Windows --- cmake/macros/ManuallyInstallOpenSSLForQt.cmake | 15 ++++++++++----- cmake/macros/TargetOpenSSL.cmake | 5 ++--- conanfile.py | 6 +++++- ice-server/CMakeLists.txt | 12 ++---------- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/cmake/macros/ManuallyInstallOpenSSLForQt.cmake b/cmake/macros/ManuallyInstallOpenSSLForQt.cmake index 3493e19616..6d6016c6d5 100644 --- a/cmake/macros/ManuallyInstallOpenSSLForQt.cmake +++ b/cmake/macros/ManuallyInstallOpenSSLForQt.cmake @@ -16,20 +16,25 @@ macro(manually_install_openssl_for_qt) # So even though we don't need the dynamic version of OpenSSL for our direct-use purposes # we use this macro to include the two SSL DLLs with the targets using QtNetwork if (WIN32) - # we have to call find_package(OpenSSL) here even though this target may not directly need it - find_package(OpenSSL REQUIRED) - install( - FILES "${VCPKG_INSTALL_ROOT}/bin/libcrypto-3-x64.dll" + FILES "${CMAKE_BINARY_DIR}/conanlibs/$/libcrypto-1_1-x64.dll" DESTINATION ${TARGET_INSTALL_DIR} COMPONENT ${TARGET_INSTALL_COMPONENT} ) install( - FILES "${VCPKG_INSTALL_ROOT}/bin/libssl-3-x64.dll" + FILES "${CMAKE_BINARY_DIR}/conanlibs/$/libssl-1_1-x64.dll" DESTINATION ${TARGET_INSTALL_DIR} COMPONENT ${TARGET_INSTALL_COMPONENT} ) + + add_custom_command( + TARGET ${TARGET_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/conanlibs/$/libcrypto-1_1-x64.dll" "${CMAKE_CURRENT_BINARY_DIR}/libcrypto-1_1-x64.dll" + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/conanlibs/$/libssl-1_1-x64.dll" "${CMAKE_CURRENT_BINARY_DIR}/libssl-1_1-x64.dll" + COMMENT "Copy openssl dlls" + ) + endif() endmacro() diff --git a/cmake/macros/TargetOpenSSL.cmake b/cmake/macros/TargetOpenSSL.cmake index 1b6c1d2721..c08f00cf98 100644 --- a/cmake/macros/TargetOpenSSL.cmake +++ b/cmake/macros/TargetOpenSSL.cmake @@ -7,7 +7,6 @@ # See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html # macro(TARGET_OPENSSL) - find_package(OpenSSL 1.1.0 REQUIRED) - include_directories(SYSTEM "${OPENSSL_INCLUDE_DIR}") - target_link_libraries(${TARGET_NAME} ${OPENSSL_LIBRARIES}) + find_package(OpenSSL REQUIRED) + target_link_libraries(${TARGET_NAME} OpenSSL::SSL OpenSSL::Crypto) endmacro() diff --git a/conanfile.py b/conanfile.py index c9b785ae80..5039be97b7 100644 --- a/conanfile.py +++ b/conanfile.py @@ -23,6 +23,7 @@ class Overte(ConanFile): "sdl*:xscrnsaver": "False", "sdl*:xshape": "False", "sdl*:xvm": "False", + "openssl*:shared": "True", "qt*:shared": "True", "qt*:gui": "True", "qt*:qtdeclarative": "True", @@ -76,11 +77,12 @@ class Overte(ConanFile): self.requires("vulkan-memory-allocator/3.0.1") self.requires("zlib/1.2.13") self.requires("glm/0.9.9.5", force=True) + openssl = "openssl/1.1.1q" if self.options.qt_source == "system": self.requires("qt/5.15.2@overte/system", force=True) if self.settings.os == "Linux": - self.requires("openssl/system@anotherfoxguy/stable", force=True) + openssl = "openssl/system@anotherfoxguy/stable" elif self.options.qt_source == "aqt": self.requires("qt/5.15.2@overte/aqt", force=True) else: @@ -96,6 +98,8 @@ class Overte(ConanFile): if self.options.with_webrtc: self.requires("webrtc-prebuild/2021.01.05@overte/stable", force=True) + self.requires(openssl, force=True) + def generate(self): tc = CMakeToolchain(self) tc.variables["DISABLE_WEBRTC"] = "OFF" if self.options.with_webrtc else "ON" diff --git a/ice-server/CMakeLists.txt b/ice-server/CMakeLists.txt index eed795ca39..e24365a9c5 100644 --- a/ice-server/CMakeLists.txt +++ b/ice-server/CMakeLists.txt @@ -8,18 +8,10 @@ link_hifi_libraries(embedded-webserver networking shared) package_libraries_for_deployment() # find OpenSSL -find_package(OpenSSL 1.1.0 REQUIRED) - -if (APPLE AND ${OPENSSL_INCLUDE_DIR} STREQUAL "/usr/include") - # this is a user on OS X using system OpenSSL, which is going to throw warnings since they're deprecating for their common crypto - message(WARNING "The found version of OpenSSL is the OS X system version. This will produce deprecation warnings." - "\nWe recommend you install a newer version (at least 1.0.1h) in a different directory and set OPENSSL_ROOT_DIR in your env so Cmake can find it.") -endif () - -include_directories(SYSTEM "${OPENSSL_INCLUDE_DIR}") +find_package(OpenSSL REQUIRED) setup_memory_debugger() setup_thread_debugger() # append OpenSSL to our list of libraries to link -target_link_libraries(${TARGET_NAME} ${OPENSSL_LIBRARIES}) +target_link_libraries(${TARGET_NAME} OpenSSL::SSL OpenSSL::Crypto)