diff --git a/CMakeLists.txt b/CMakeLists.txt index dd3bfd387..fb14f7f35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -221,6 +221,9 @@ endif() if (AWS_USE_APPLE_NETWORK_FRAMEWORK) target_compile_definitions(${PROJECT_NAME} PRIVATE "-DAWS_USE_APPLE_NETWORK_FRAMEWORK") + option(AWS_USE_APPLE_NETWORK_FRAMEWORK + "Use apple network framework as default event loop and socket options." + ON) endif() target_include_directories(${PROJECT_NAME} PUBLIC diff --git a/source/event_loop.c b/source/event_loop.c index f78c3b89d..1a5103d5d 100644 --- a/source/event_loop.c +++ b/source/event_loop.c @@ -618,6 +618,7 @@ static int aws_event_loop_type_validate_platform(enum aws_event_loop_type type) return AWS_OP_SUCCESS; } +#ifndef AWS_ENABLE_DISPATCH_QUEUE struct aws_event_loop *aws_event_loop_new_dispatch_queue_with_options( struct aws_allocator *alloc, const struct aws_event_loop_options *options) { @@ -628,6 +629,7 @@ struct aws_event_loop *aws_event_loop_new_dispatch_queue_with_options( AWS_LOGF_DEBUG(AWS_LS_IO_EVENT_LOOP, "Dispatch Queue is not supported on the platform"); return NULL; } +#endif // AWS_ENABLE_DISPATCH_QUEUE #ifndef AWS_ENABLE_IO_COMPLETION_PORTS struct aws_event_loop *aws_event_loop_new_iocp_with_options( diff --git a/source/socket.c b/source/socket.c index 013530f17..fb5267f3e 100644 --- a/source/socket.c +++ b/source/socket.c @@ -127,9 +127,7 @@ int aws_socket_init(struct aws_socket *socket, struct aws_allocator *alloc, cons case AWS_SIT_WINSOCK: return aws_socket_init_winsock(socket, alloc, options); break; - case AWS_SIT_APPLE_NETWORK_FRAMEWORK: - AWS_ASSERT(false && "Invalid socket implementation on platform."); return aws_socket_init_apple_nw_socket(socket, alloc, options); break; default: @@ -260,6 +258,7 @@ int aws_socket_init_winsock( } #endif +#ifndef AWS_ENABLE_DISPATCH_QUEUE int aws_socket_init_apple_nw_socket( struct aws_socket *socket, struct aws_allocator *alloc, @@ -270,3 +269,4 @@ int aws_socket_init_apple_nw_socket( AWS_LOGF_DEBUG(AWS_LS_IO_SOCKET, "Apple Network Framework is not supported on the platform."); return aws_raise_error(AWS_ERROR_PLATFORM_NOT_SUPPORTED); } +#endif