Skip to content

Commit

Permalink
Prebuild aws-lc (#648)
Browse files Browse the repository at this point in the history
  • Loading branch information
sfod authored Oct 8, 2024
1 parent 83aacf7 commit 188cff7
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,35 +84,36 @@ if(BUILD_DEPS)

if(UNIX AND NOT APPLE AND NOT BYO_CRYPTO)
if(NOT USE_OPENSSL)
set(DISABLE_PERL ON CACHE BOOL "Disable Perl for AWS-LC.")
set(DISABLE_GO ON CACHE BOOL "Disable Go for AWS-LC.")
set(BUILD_LIBSSL OFF CACHE BOOL "Build libssl for AWS-LC.")
include(AwsPrebuildDependency)

# temporarily disable certain warnings as errors for the aws-lc build
set(OLD_CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
set(AWSLC_CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")

# temporarily disable certain warnings as errors for the aws-lc build
if(NOT MSVC)
check_c_compiler_flag(-Wno-stringop-overflow HAS_WNO_STRINGOP_OVERFLOW)

if(HAS_WNO_STRINGOP_OVERFLOW)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-stringop-overflow")
set(AWSLC_CMAKE_C_FLAGS "${AWSLC_CMAKE_C_FLAGS} -Wno-stringop-overflow")
endif()

check_c_compiler_flag(-Wno-array-parameter HAS_WNO_ARRAY_PARAMETER)

if(HAS_WNO_ARRAY_PARAMETER)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-array-parameter")
set(AWSLC_CMAKE_C_FLAGS "${AWSLC_CMAKE_C_FLAGS} -Wno-array-parameter")
endif()
endif()

add_subdirectory(crt/aws-lc)

# restore previous build flags
set(CMAKE_C_FLAGS "${OLD_CMAKE_C_FLAGS}")

set(SEARCH_LIBCRYPTO OFF CACHE BOOL "Let S2N use libcrypto from AWS-LC.")
else()
set(SEARCH_LIBCRYPTO ON CACHE BOOL "Let S2N search libcrypto in the system.")
# s2n-tls uses libcrypto during its configuration, so we need to prebuild aws-lc.
prebuild_dependency(
DEPENDENCY_NAME AWSLC
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/crt/aws-lc
CMAKE_ARGUMENTS
-DDISABLE_GO=ON
-DDISABLE_PERL=ON
-DBUILD_LIBSSL=OFF
-DBUILD_TESTING=OFF
-DCMAKE_C_FLAGS=${AWSLC_CMAKE_C_FLAGS}
)
endif()

set(UNSAFE_TREAT_WARNINGS_AS_ERRORS OFF CACHE BOOL "Disable warnings-as-errors when building S2N")
Expand Down

0 comments on commit 188cff7

Please sign in to comment.