-
Notifications
You must be signed in to change notification settings - Fork 68
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 improvements #441
base: develop
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #441 +/- ##
===========================================
- Coverage 63.93% 63.76% -0.18%
===========================================
Files 32 32
Lines 5077 5078 +1
===========================================
- Hits 3246 3238 -8
- Misses 1831 1840 +9 ☔ View full report in Codecov by Sentry. |
@@ -1,3 +1,4 @@ | |||
REM NOTE: May need to replace "Enterprise" with "Community" int the below command |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: int -> in
This reverts commit 93993b0.
Something to consider:
|
message(${CC_NAME}) | ||
if(${CC_NAME} MATCHES ".*gcc-.*") | ||
build_dependency(gtest) | ||
endif() | ||
endif() | ||
|
||
find_package(PkgConfig REQUIRED) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: PkgConfig probably does not need to be checked for on Windows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yet to review the rest. But publishing first half.
project(KinesisVideoProducerC VERSION 1.5.1 LANGUAGES C) | ||
|
||
set(KINESIS_VIDEO_PRODUCER_C_MAJOR_VERSION 1) | ||
set(KINESIS_VIDEO_PRODUCER_C_MINOR_VERSION 5) | ||
set(KINESIS_VIDEO_PRODUCER_C_PATCH_VERSION 1) | ||
set(KINESIS_VIDEO_PRODUCER_C_VERSION ${KINESIS_VIDEO_PRODUCER_C_MAJOR_VERSION}.${KINESIS_VIDEO_PRODUCER_C_MINOR_VERSION}.${KINESIS_VIDEO_PRODUCER_C_PATCH_VERSION}) | ||
|
||
include(GNUInstallDirs) | ||
set(SUPPORTED_CRYPTO_LIBRARIES "{OpenSSL, MbedTLS}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice
option(USE_OPENSSL "Use openssl as crypto library" ON) | ||
option(USE_MBEDTLS "Use mbedtls as crypto library" OFF) | ||
option(BUILD_COMMON_LWS "Whether or not to build ProducerC libwebsockets common library" OFF) | ||
option(BUILD_COMMON_CURL "Whether or not to build ProducerC curl common library" ON) | ||
option(BUILD_STATIC "Static build" OFF) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a CI for this and also add a verification step in the CI to confirm the generated libraries are in fact static? Similar to this:
https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-c/blob/develop/.github/workflows/ci.yml#L801-L805
option(BUILD_OPENSSL_PLATFORM "If buildng OpenSSL what is the target platform" OFF) | ||
option(LOCAL_OPENSSL_BUILD "Whether or not to use local OpenSSL build" OFF) | ||
option(BUILD_CRYPTO "Whether to build OpenSSL or MbedTLS, if not, will use system-installed version" ON) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice!
if (NOT OPEN_SRC_INSTALL_PREFIX) | ||
set(OPEN_SRC_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/open-source) | ||
set(OPEN_SRC_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}/open-source) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be ${CMAKE_CURRENT_SOURCE_DIR}
? Did we test webrtc with this build to confirm it works and does not break existing behavior if OPEN_SRC_INSTALL_PREFIX
is not set?
option(BUILD_COMMON_CURL "Whether or not to build ProducerC curl common library" ON) | ||
option(BUILD_STATIC "Static build" OFF) | ||
option(BUILD_DEPENDENCIES "Whether to build dependency libraries from source" ON) # This is a master OFF switch, none will be built if off, but if it is ON, some can be specified to be not built | ||
option(BUILD_COMMON_LWS "Whether to build ProducerC libwebsockets common library" OFF) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. For future enhancements, let us see if we can mask these behind a BUILD_ONLY
overarching flag. Similar to how AWS SDK does: https://github.com/aws/aws-sdk-cpp/blob/main/docs/CMake_Parameters.md#build_only
set(BUILD_ARGS -DBUILD_STATIC=${BUILD_STATIC} | ||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} | ||
-DOPENSSL_DIR=${OPEN_SRC_INSTALL_PREFIX} | ||
-DUSE_OPENSSL=${USE_OPENSSL} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we removing this?
What was changed?
Build improvements including the following:
cmake ..
twice for M1 CI testsWhy was it changed?
The SDK build can be very inconsistent when we use
find_package
andpkg_check_modules
for project-built-from-source dependencies. Sometimes they find the system-installed libraries instead of the ones this project builds from source, and this has been the cause for some CI build failures. These commands are no longer used when building the dependencies from source along with the project because setting the known include/header and library directories is sufficient - these are both always in our open-source folder that is generated during the build configurationcmake ..
stage.These kind of build issues were also experienced when building locally on Mac, specifically when there was a rouge version of KVS PIC SDK installed in the usr/local/lib default system library directory and when there was already an openssl library installed via HomeBrew.
How was it changed?
This project's CMakeLists.txt and CI jobs were modified as described in the above sections.
What testing was done for the changes?
otool -L <library>.dylib
was used with the local M2 Mac build to verify that Producer C SDK's dependencies and the Producer C SDK itself when built as a dependency for the above SDKs were not linked to duplicate dependency librariesDraft PR for Producer CPP tests: awslabs/amazon-kinesis-video-streams-producer-sdk-cpp#1154
Draft PR for WebRTC C tests: awslabs/amazon-kinesis-video-streams-webrtc-sdk-c#1952
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.