Skip to content

Commit

Permalink
fix mac build mbedtls, add option for ca cert
Browse files Browse the repository at this point in the history
  • Loading branch information
hassanctech committed Aug 30, 2024
1 parent e40fab5 commit ad2922a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CMake/Dependencies/libkvsCommonLws-CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ include(ExternalProject)

ExternalProject_Add(libkvsCommonLws-download
GIT_REPOSITORY https://github.com/awslabs/amazon-kinesis-video-streams-producer-c.git
GIT_TAG v1.5.2
GIT_TAG link-mbedtls-properly
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/build
LIST_SEPARATOR |
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${OPEN_SRC_INSTALL_PREFIX}
-DCMAKE_PREFIX_PATH=${OPEN_SRC_INSTALL_PREFIX}
-DBUILD_COMMON_LWS=ON
-DBUILD_COMMON_CURL=OFF
-DBUILD_DEPENDENCIES=FALSE
Expand Down
2 changes: 2 additions & 0 deletions CMake/Dependencies/libwebsockets-CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ ExternalProject_Add(project_libwebsockets
-DLWS_WITH_STATIC=1
-DLWS_WITH_SHARED=${LWS_WITH_SHARED}
-DLWS_WITH_MBEDTLS=${LWS_WITH_MBEDTLS}
-DLWS_MBEDTLS_LIBRARIES=${LWS_MBEDTLS_LIBRARIES}
-DLWS_MBEDTLS_INCLUDE_DIRS=${LWS_MBEDTLS_INCLUDE_DIRS}
-DLWS_WITH_MINIMAL_EXAMPLES=1
-DLWS_HAVE_PTHREAD_H=1
-DLWS_WITH_THREADPOOL=${LWS_WITH_THREADPOOL}
Expand Down
19 changes: 18 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ message(STATUS "Kinesis Video WebRTC Client path is ${KINESIS_VIDEO_WEBRTC_CLIEN
message(STATUS "dependencies install path is ${OPEN_SRC_INSTALL_PREFIX}")

# pass ca cert location to sdk
add_definitions(-DKVS_CA_CERT_PATH="${CMAKE_SOURCE_DIR}/certs/cert.pem")

if(NOT DEFINED KVS_CA_CERT_PATH)
add_definitions(-DKVS_CA_CERT_PATH="${CMAKE_SOURCE_DIR}/certs/cert.pem")
endif()

add_definitions(-DCMAKE_DETECTED_CACERT_PATH)

if (ENABLE_KVS_THREADPOOL)
Expand Down Expand Up @@ -163,6 +167,17 @@ if(BUILD_DEPENDENCIES)
build_dependency(mbedtls ${BUILD_ARGS})
endif()

# This step is necessary because the next set of dependencies have a dependency on
# mbedtls/openssl and the find_package command populates certain cmake variables which
# are needed to pass to the cmake commands for the next set of dependencies
if (USE_OPENSSL)
find_package(OpenSSL REQUIRED)
set(OPEN_SRC_INCLUDE_DIRS ${OPEN_SRC_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR})
else()
find_package(MbedTLS REQUIRED)
set(OPEN_SRC_INCLUDE_DIRS ${OPEN_SRC_INCLUDE_DIRS} ${MBEDTLS_INCLUDE_DIRS})
string(REPLACE ";" "|" MBEDTLS_LIBRARIES_ALT_SEP "${MBEDTLS_LIBRARIES}")
endif()

if(WIN32)
set(OPENSSL_INCLUDE_DIRS "${OPEN_SRC_INSTALL_PREFIX}/include/")
Expand All @@ -188,6 +203,8 @@ if(BUILD_DEPENDENCIES)
-DLWS_OPENSSL_CRYPTO_LIBRARY=${OPENSSL_CRYPTO_LIBRARY}
-DLWS_OPENSSL_SSL_LIBRARY=${OPENSSL_SSL_LIBRARY}
-DLWS_OPENSSL_INCLUDE_DIRS=${OPENSSL_INCLUDE_DIR}
-DLWS_MBEDTLS_INCLUDE_DIRS=${MBEDTLS_INCLUDE_DIRS}
-DLWS_MBEDTLS_LIBRARIES=${MBEDTLS_LIBRARIES_ALT_SEP}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS})
endif()
build_dependency(websockets ${BUILD_ARGS})
Expand Down

0 comments on commit ad2922a

Please sign in to comment.