Skip to content

Commit

Permalink
[unity]添加WOLFSSL的支持
Browse files Browse the repository at this point in the history
  • Loading branch information
chexiongsheng committed Sep 6, 2024
1 parent 1f830f0 commit dc68aaf
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
30 changes: 29 additions & 1 deletion unity/native_src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
# $<$<PLATFORM_ID:Windows>: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 )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down

0 comments on commit dc68aaf

Please sign in to comment.