Add ability to use OpenSSL on apple platforms.
This commit is contained in:
		@@ -114,12 +114,11 @@ if (WIN32)
 | 
				
			|||||||
  set(USE_MBED_TLS TRUE)
 | 
					  set(USE_MBED_TLS TRUE)
 | 
				
			||||||
endif()
 | 
					endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set(USE_OPEN_SSL FALSE)
 | 
					 | 
				
			||||||
if (USE_TLS)
 | 
					if (USE_TLS)
 | 
				
			||||||
    if (USE_MBED_TLS)
 | 
					    if (USE_MBED_TLS)
 | 
				
			||||||
        list( APPEND IXWEBSOCKET_HEADERS ixwebsocket/IXSocketMbedTLS.h)
 | 
					        list( APPEND IXWEBSOCKET_HEADERS ixwebsocket/IXSocketMbedTLS.h)
 | 
				
			||||||
        list( APPEND IXWEBSOCKET_SOURCES ixwebsocket/IXSocketMbedTLS.cpp)
 | 
					        list( APPEND IXWEBSOCKET_SOURCES ixwebsocket/IXSocketMbedTLS.cpp)
 | 
				
			||||||
    elseif (APPLE)
 | 
					    elseif (APPLE AND NOT USE_OPEN_SSL)
 | 
				
			||||||
        list( APPEND IXWEBSOCKET_HEADERS ixwebsocket/IXSocketAppleSSL.h)
 | 
					        list( APPEND IXWEBSOCKET_HEADERS ixwebsocket/IXSocketAppleSSL.h)
 | 
				
			||||||
        list( APPEND IXWEBSOCKET_SOURCES ixwebsocket/IXSocketAppleSSL.cpp)
 | 
					        list( APPEND IXWEBSOCKET_SOURCES ixwebsocket/IXSocketAppleSSL.cpp)
 | 
				
			||||||
    elseif (WIN32)
 | 
					    elseif (WIN32)
 | 
				
			||||||
@@ -141,6 +140,8 @@ if (USE_TLS)
 | 
				
			|||||||
    target_compile_definitions(ixwebsocket PUBLIC IXWEBSOCKET_USE_TLS)
 | 
					    target_compile_definitions(ixwebsocket PUBLIC IXWEBSOCKET_USE_TLS)
 | 
				
			||||||
    if (USE_MBED_TLS)
 | 
					    if (USE_MBED_TLS)
 | 
				
			||||||
        target_compile_definitions(ixwebsocket PUBLIC IXWEBSOCKET_USE_MBED_TLS)
 | 
					        target_compile_definitions(ixwebsocket PUBLIC IXWEBSOCKET_USE_MBED_TLS)
 | 
				
			||||||
 | 
					    elseif (USE_OPEN_SSL)
 | 
				
			||||||
 | 
					        target_compile_definitions(ixwebsocket PUBLIC IXWEBSOCKET_USE_OPEN_SSL)
 | 
				
			||||||
    elseif (APPLE)
 | 
					    elseif (APPLE)
 | 
				
			||||||
    elseif (WIN32)
 | 
					    elseif (WIN32)
 | 
				
			||||||
    else()
 | 
					    else()
 | 
				
			||||||
@@ -163,6 +164,13 @@ if (UNIX)
 | 
				
			|||||||
endif()
 | 
					endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if (USE_TLS AND USE_OPEN_SSL)
 | 
					if (USE_TLS AND USE_OPEN_SSL)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  # Help finding Homebrew's OpenSSL on macOS
 | 
				
			||||||
 | 
					  if (APPLE)
 | 
				
			||||||
 | 
					    set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /usr/local/opt/openssl/lib)
 | 
				
			||||||
 | 
					    set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} /usr/local/opt/openssl/include)
 | 
				
			||||||
 | 
					  endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  find_package(OpenSSL REQUIRED)
 | 
					  find_package(OpenSSL REQUIRED)
 | 
				
			||||||
  add_definitions(${OPENSSL_DEFINITIONS})
 | 
					  add_definitions(${OPENSSL_DEFINITIONS})
 | 
				
			||||||
  message(STATUS "OpenSSL: " ${OPENSSL_VERSION})
 | 
					  message(STATUS "OpenSSL: " ${OPENSSL_VERSION})
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1 +1 @@
 | 
				
			|||||||
6.3.0
 | 
					6.3.1
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,10 @@
 | 
				
			|||||||
# Changelog
 | 
					# Changelog
 | 
				
			||||||
All notable changes to this project will be documented in this file.
 | 
					All notable changes to this project will be documented in this file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## [6.3.1] - 2019-09-29
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- Add ability to use OpenSSL on apple platforms.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## [6.3.0] - 2019-09-28
 | 
					## [6.3.0] - 2019-09-28
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- ixcobra / fix crash in CobraConnection::publishNext when the queue is empty + handle CobraConnection_PublishMode_Batch in CobraMetricsThreadedPublisher
 | 
					- ixcobra / fix crash in CobraConnection::publishNext when the queue is empty + handle CobraConnection_PublishMode_Batch in CobraMetricsThreadedPublisher
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,12 +10,12 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#ifdef IXWEBSOCKET_USE_MBED_TLS
 | 
					#ifdef IXWEBSOCKET_USE_MBED_TLS
 | 
				
			||||||
#include <ixwebsocket/IXSocketMbedTLS.h>
 | 
					#include <ixwebsocket/IXSocketMbedTLS.h>
 | 
				
			||||||
#elif __APPLE__
 | 
					 | 
				
			||||||
#include <ixwebsocket/IXSocketAppleSSL.h>
 | 
					 | 
				
			||||||
#elif defined(_WIN32)
 | 
					#elif defined(_WIN32)
 | 
				
			||||||
#include <ixwebsocket/IXSocketSChannel.h>
 | 
					#include <ixwebsocket/IXSocketSChannel.h>
 | 
				
			||||||
#elif defined(IXWEBSOCKET_USE_OPEN_SSL)
 | 
					#elif defined(IXWEBSOCKET_USE_OPEN_SSL)
 | 
				
			||||||
#include <ixwebsocket/IXSocketOpenSSL.h>
 | 
					#include <ixwebsocket/IXSocketOpenSSL.h>
 | 
				
			||||||
 | 
					#elif __APPLE__
 | 
				
			||||||
 | 
					#include <ixwebsocket/IXSocketAppleSSL.h>
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
@@ -42,12 +42,12 @@ namespace ix
 | 
				
			|||||||
#ifdef IXWEBSOCKET_USE_TLS
 | 
					#ifdef IXWEBSOCKET_USE_TLS
 | 
				
			||||||
#if defined(IXWEBSOCKET_USE_MBED_TLS)
 | 
					#if defined(IXWEBSOCKET_USE_MBED_TLS)
 | 
				
			||||||
            socket = std::make_shared<SocketMbedTLS>(tlsOptions);
 | 
					            socket = std::make_shared<SocketMbedTLS>(tlsOptions);
 | 
				
			||||||
#elif defined(__APPLE__)
 | 
					#elif defined(IXWEBSOCKET_USE_OPEN_SSL)
 | 
				
			||||||
            socket = std::make_shared<SocketAppleSSL>(tlsOptions);
 | 
					            socket = std::make_shared<SocketOpenSSL>(tlsOptions);
 | 
				
			||||||
#elif defined(_WIN32)
 | 
					#elif defined(_WIN32)
 | 
				
			||||||
            socket = std::make_shared<SocketSChannel>(tlsOptions);
 | 
					            socket = std::make_shared<SocketSChannel>(tlsOptions);
 | 
				
			||||||
#else
 | 
					#elif defined(__APPLE__)
 | 
				
			||||||
            socket = std::make_shared<SocketOpenSSL>(tlsOptions);
 | 
					            socket = std::make_shared<SocketAppleSSL>(tlsOptions);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
            errorMsg = "TLS support is not enabled on this platform.";
 | 
					            errorMsg = "TLS support is not enabled on this platform.";
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,4 +6,4 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define IX_WEBSOCKET_VERSION "6.3.0"
 | 
					#define IX_WEBSOCKET_VERSION "6.3.1"
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										7
									
								
								makefile
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								makefile
									
									
									
									
									
								
							@@ -14,6 +14,9 @@ brew:
 | 
				
			|||||||
ws:
 | 
					ws:
 | 
				
			||||||
	mkdir -p build && (cd build ; cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_WS=1 -DUSE_MBED_TLS=1 .. ; make -j 4)
 | 
						mkdir -p build && (cd build ; cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_WS=1 -DUSE_MBED_TLS=1 .. ; make -j 4)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ws_openssl:
 | 
				
			||||||
 | 
						mkdir -p build && (cd build ; cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_WS=1 -DUSE_OPEN_SSL=1 .. ; make -j 4)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
uninstall:
 | 
					uninstall:
 | 
				
			||||||
	xargs rm -fv < build/install_manifest.txt
 | 
						xargs rm -fv < build/install_manifest.txt
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -64,6 +67,10 @@ test:
 | 
				
			|||||||
	mkdir -p build && (cd build ; cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_WS=1 -DUSE_TEST=1 .. ; make -j 4)
 | 
						mkdir -p build && (cd build ; cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_WS=1 -DUSE_TEST=1 .. ; make -j 4)
 | 
				
			||||||
	(cd test ; python2.7 run.py -r)
 | 
						(cd test ; python2.7 run.py -r)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					test_openssl:
 | 
				
			||||||
 | 
						mkdir -p build && (cd build ; cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_OPEN_SSL=1 -DUSE_WS=1 -DUSE_TEST=1 .. ; make -j 4)
 | 
				
			||||||
 | 
						(cd test ; python2.7 run.py -r)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ws_test: ws
 | 
					ws_test: ws
 | 
				
			||||||
	(cd ws ; env DEBUG=1 PATH=../ws/build:$$PATH bash test_ws.sh)
 | 
						(cd ws ; env DEBUG=1 PATH=../ws/build:$$PATH bash test_ws.sh)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user