diff --git a/unity/native_src/CMakeLists.txt b/unity/native_src/CMakeLists.txt index e45d153b8b..5da3c9dc1e 100644 --- a/unity/native_src/CMakeLists.txt +++ b/unity/native_src/CMakeLists.txt @@ -159,7 +159,7 @@ else () endif () endif () -if ( WITH_WEBSOCKET EQUAL 2 ) +if ( WITH_WEBSOCKET EQUAL 3 ) set(OPENSSL_SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/openssl-src) # default path by CMake set(OPENSSL_INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/openssl) set(OPENSSL_INCLUDE_DIR ${OPENSSL_INSTALL_DIR}/include) @@ -215,6 +215,34 @@ if ( WITH_WEBSOCKET EQUAL 2 ) list(APPEND PUERTS_COMPILE_DEFINITIONS WITH_WEBSOCKET_SSL) endif () +if ( WITH_WEBSOCKET EQUAL 2 ) + include(FetchContent) + + FetchContent_Declare( + wolfssl + GIT_REPOSITORY https://github.com/wolfSSL/wolfssl.git + GIT_TAG v5.7.2-stable + ) + set(WOLFSSL_EXAMPLES OFF) + set(WOLFSSL_CRYPT_TESTS OFF) + #set(BUILD_SHARED_LIBS OFF) + + FetchContent_MakeAvailable(wolfssl) + + target_compile_definitions(wolfssl PUBLIC WOLFSSL_OPENSSLEXTRA WOLFSSL_OPENSSLALL OPENSSL_EXTRA OPENSSL_ALL HAVE_EX_DATA WOLFSSL_OPENSSH) + + target_link_libraries(puerts wolfssl) + + target_include_directories(puerts PRIVATE ${wolfssl_SOURCE_DIR}/wolfssl) + + list(APPEND PUERTS_COMPILE_DEFINITIONS WITH_WEBSOCKET_SSL OPENSSL_EXTRA OPENSSL_ALL WOLFSSL_OPENSSH PUERTS_USE_WOLFSSL) + #if(WIN32) + # For Windows link ws2_32 + # target_link_libraries(puerts + # $<$:ws2_32 crypt32>) + #endif() +endif () + option ( USING_V8 "using v8" ON ) option ( USING_QJS "using quickjs" ON ) option ( USING_QJS_SUFFIX "add _qjs to namespace of simule v8 api " ON ) diff --git a/unreal/Puerts/ThirdParty/Include/asio/asio/ssl/detail/impl/openssl_init.ipp b/unreal/Puerts/ThirdParty/Include/asio/asio/ssl/detail/impl/openssl_init.ipp index 4dac54d7d6..666768a7b2 100644 --- a/unreal/Puerts/ThirdParty/Include/asio/asio/ssl/detail/impl/openssl_init.ipp +++ b/unreal/Puerts/ThirdParty/Include/asio/asio/ssl/detail/impl/openssl_init.ipp @@ -85,7 +85,7 @@ public: #endif // (OPENSSL_VERSION_NUMBER >= 0x10002000L) // && (OPENSSL_VERSION_NUMBER < 0x10100000L) // && !defined(SSL_OP_NO_COMPRESSION) -#if !defined(OPENSSL_IS_BORINGSSL) && !defined(ASIO_USE_WOLFSSL) +#if !defined(OPENSSL_IS_BORINGSSL) && !defined(ASIO_USE_WOLFSSL) && !defined(PUERTS_USE_WOLFSSL) ::CONF_modules_unload(1); #endif // !defined(OPENSSL_IS_BORINGSSL) && !defined(ASIO_USE_WOLFSSL) #if !defined(OPENSSL_NO_ENGINE) \