Merge pull request #21427 from zackgalbreath/cmake_ssl_assembly

Conditionally enable OPENSSL_NO_ASM for Visual Studio
This commit is contained in:
Jan Tattermusch 2019-12-17 13:45:33 +01:00 committed by GitHub
commit b5c3056d25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 7 deletions

View File

@ -20,15 +20,26 @@ if(gRPC_SSL_PROVIDER STREQUAL "module")
if(NOT BORINGSSL_ROOT_DIR)
set(BORINGSSL_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/boringssl)
endif()
if(EXISTS "${BORINGSSL_ROOT_DIR}/CMakeLists.txt")
if (MSVC AND NOT CMAKE_GENERATOR STREQUAL "Ninja")
# Visual Studio build with assembly optimizations is broken,
# but it works with Ninja generator.
# This will get eventually fixed in cmake, but until then
# we need to disable assembly optimizations.
# See https://github.com/grpc/grpc/issues/16376
set(OPENSSL_NO_ASM ON)
if(CMAKE_GENERATOR MATCHES "Visual Studio")
if(CMAKE_VERSION VERSION_LESS 3.13)
# Visual Studio build with assembly optimizations is broken for older
# version of CMake (< 3.13).
message(WARNING "Disabling SSL assembly support because CMake version ${CMAKE_VERSION} is too old (less than 3.13)")
set(OPENSSL_NO_ASM ON)
else()
# If we're using a new enough version of CMake, make sure that the
# NASM assembler can be found.
include(CheckLanguage)
check_language(ASM_NASM)
if(NOT CMAKE_ASM_NASM_COMPILER)
message(WARNING "Disabling SSL assembly support because NASM could not be found")
set(OPENSSL_NO_ASM ON)
endif()
endif()
endif()
add_subdirectory(${BORINGSSL_ROOT_DIR} third_party/boringssl)
if(TARGET ssl)
set(_gRPC_SSL_LIBRARIES ssl)