Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMAKE_BUILD_TYPE=Release build #1897

Merged
merged 8 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,32 @@ jobs:
- name: Sample check
run: |
./scripts/check-sample.sh
sample-check-no-data-channel:
if: github.repository == 'awslabs/amazon-kinesis-video-streams-webrtc-sdk-c'
runs-on: ubuntu-latest
env:
AWS_KVS_LOG_LEVEL: 2
permissions:
id-token: write
contents: read
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: ${{ secrets.AWS_REGION }}
role-duration-seconds: 10800
- name: Build repository
run: |
sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6'
mkdir build && cd build
cmake .. -DENABLE_DATA_CHANNEL=OFF
make
- name: Sample check without data channel
run: |
./scripts/check-sample.sh
ubuntu-os-build:
runs-on: ubuntu-20.04
env:
Expand Down
2 changes: 1 addition & 1 deletion CMake/Dependencies/libmbedtls-CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ ExternalProject_Add(
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${OPEN_SRC_INSTALL_PREFIX}
-DUSE_SHARED_MBEDTLS_LIBRARY=${BUILD_SHARED}
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_MACOSX_RPATH=${CMAKE_MACOSX_RPATH}
-DENABLE_TESTING=OFF
-DENABLE_PROGRAMS=OFF
Expand Down
3 changes: 2 additions & 1 deletion CMake/Dependencies/libusrsctp-CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ ExternalProject_Add(project_libusrsctp
GIT_REPOSITORY https://github.com/sctplab/usrsctp.git
GIT_TAG 1ade45cbadfd19298d2c47dc538962d4425ad2dd
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/build
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${OPEN_SRC_INSTALL_PREFIX}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${OPEN_SRC_INSTALL_PREFIX}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
"-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -fPIC"
-Dsctp_werror=0
BUILD_ALWAYS TRUE
Expand Down
1 change: 1 addition & 0 deletions CMake/Dependencies/libwebsockets-CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ ExternalProject_Add(project_libwebsockets
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${OPEN_SRC_INSTALL_PREFIX}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DLWS_WITH_HTTP2=1
-DLWS_HAVE_HMAC_CTX_new=1
-DLWS_HAVE_SSL_EXTRA_CHAIN_CERTS=1
Expand Down
14 changes: 12 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ if(WIN32)
set(EXT_PTHREAD_LIBRARIES "" CACHE FILEPATH "Path to PThread libraries")
endif()

if(NOT CMAKE_BUILD_TYPE)
message(STATUS "Setting CMAKE_BUILD_TYPE to Release by default")
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build." FORCE)
endif()

execute_process(
COMMAND git rev-parse HEAD
Expand Down Expand Up @@ -148,12 +152,14 @@ if(BUILD_DEPENDENCIES)

if (USE_OPENSSL)
set(BUILD_ARGS -DBUILD_STATIC_LIBS=${BUILD_STATIC_LIBS}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DBUILD_OPENSSL_PLATFORM=${BUILD_OPENSSL_PLATFORM}
-DOPENSSL_EXTRA=${OPENSSL_EXTRA})
build_dependency(openssl ${BUILD_ARGS})
set(OPENSSL_ROOT_DIR ${OPEN_SRC_INSTALL_PREFIX})
elseif(USE_MBEDTLS)
set(BUILD_ARGS -DBUILD_STATIC_LIBS=${BUILD_STATIC_LIBS}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
"-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -std=c99")
build_dependency(mbedtls ${BUILD_ARGS})
endif()
Expand All @@ -166,15 +172,17 @@ if(BUILD_DEPENDENCIES)
set(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY})
string(REPLACE ";" "|" OPENSSL_LIBRARIES_ALT_SEP "${OPENSSL_LIBRARIES}")
set(BUILD_ARGS -DBUILD_STATIC_LIBS=${BUILD_STATIC_LIBS}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DUSE_OPENSSL=${USE_OPENSSL}
-DUSE_MBEDTLS=${USE_MBEDTLS}
-DUSE_MBEDTLS=${USE_MBEDTLS}
-DLWS_EXT_PTHREAD_INCLUDE_DIR=${EXT_PTHREAD_INCLUDE_DIR}
-DLWS_EXT_PTHREAD_LIBRARIES=${EXT_PTHREAD_LIBRARIES}
-DLWS_OPENSSL_INCLUDE_DIRS=${OPENSSL_INCLUDE_DIRS}
-DLWS_OPENSSL_LIBRARIES=${OPENSSL_LIBRARIES_ALT_SEP}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS})
else()
set(BUILD_ARGS -DBUILD_STATIC_LIBS=${BUILD_STATIC_LIBS}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DOPENSSL_DIR=${OPEN_SRC_INSTALL_PREFIX}
-DUSE_OPENSSL=${USE_OPENSSL}
-DUSE_MBEDTLS=${USE_MBEDTLS}
Expand All @@ -187,16 +195,18 @@ if(BUILD_DEPENDENCIES)

set(BUILD_ARGS
-DBUILD_STATIC_LIBS=${BUILD_STATIC_LIBS}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DOPENSSL_DIR=${OPEN_SRC_INSTALL_PREFIX}
-DBUILD_LIBSRTP_HOST_PLATFORM=${BUILD_LIBSRTP_HOST_PLATFORM}
-DBUILD_LIBSRTP_DESTINATION_PLATFORM=${BUILD_LIBSRTP_DESTINATION_PLATFORM}
-DUSE_OPENSSL=${USE_OPENSSL}
-DUSE_MBEDTLS=${USE_MBEDTLS}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS})

build_dependency(srtp ${BUILD_ARGS})

set(BUILD_ARGS
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS})

build_dependency(usrsctp ${BUILD_ARGS})
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ You can pass the following options to `cmake ..`.
* `-DMEMORY_SANITIZER` -- Build with MemorySanitizer
* `-DTHREAD_SANITIZER` -- Build with ThreadSanitizer
* `-DUNDEFINED_BEHAVIOR_SANITIZER` -- Build with UndefinedBehaviorSanitizer
* `-DCMAKE_BUILD_TYPE` -- Build Release/Debug libraries. By default, the SDK generates Release build. The standard options are listed [here](https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#default-and-custom-configurations)
* `-DLINK_PROFILER` -- Link with gperftools (available profiler options are listed [here](https://github.com/gperftools/gperftools))

To clean up the `open-source` and `build` folders from previous build, use `cmake --build . --target clean` from the `build` folder
Expand Down
Loading