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

kvssink .so with static linkage to cproducer (#1179) #1216

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
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
16 changes: 16 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,22 @@ jobs:
cmake .. -DBUILD_GSTREAMER_PLUGIN=ON -DBUILD_STATIC=ON
make

linux-build-gcc-static-deps-shared-kvssink:
runs-on: ubuntu-20.04
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt clean && sudo apt update
sudo apt install -y libunwind-dev
sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-plugins-base-apps gstreamer1.0-plugins-bad gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-tools
- name: Build repository
run: |
mkdir build && cd build
cmake .. -DBUILD_GSTREAMER_PLUGIN=ON -DBUILD_STATIC=ON -DBUILD_FORCE_KVSSINK_SHARED=ON
make

linux-build-gcc-shared:
runs-on: ubuntu-20.04
steps:
Expand Down
4 changes: 3 additions & 1 deletion CMake/Dependencies/libkvscproducer-CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ include(ExternalProject)
# clone repo only
ExternalProject_Add(libkvscproducer-download
GIT_REPOSITORY https://github.com/awslabs/amazon-kinesis-video-streams-producer-c.git
GIT_TAG v1.5.3
GIT_TAG static-curl-to-shared-producer
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/kvscproducer-src"
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/kvscproducer-build"
CMAKE_ARGS
-DCURL_POSITION_INDEPENDENT_CODE=${CURL_POSITION_INDEPENDENT_CODE}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
Expand Down
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ include(GNUInstallDirs)
option(BUILD_GSTREAMER_PLUGIN "Build kvssink GStreamer plugin" OFF)
option(BUILD_JNI "Build C++ wrapper for JNI to expose the functionality to Java/Android" OFF)
option(BUILD_STATIC "Build with static linkage" OFF)
option(BUILD_FORCE_KVSSINK_SHARED "If building with static linkage, build the kvssink GStreamer plugin as a shared library" OFF)
option(ADD_MUCLIBC "Add -muclibc c flag" OFF)
option(BUILD_DEPENDENCIES "Whether or not to build depending libraries from source" ON)
option(BUILD_OPENSSL_PLATFORM "If buildng OpenSSL what is the target platform" OFF)
Expand Down Expand Up @@ -56,6 +57,11 @@ endif()
add_definitions(-DKVS_CA_CERT_PATH="${CMAKE_CURRENT_SOURCE_DIR}/certs/cert.pem")
add_definitions(-DCMAKE_DETECTED_CACERT_PATH)

# Instruct Producer C to build Curl with Position Independent Code (-fpic).
# This is to allow a static Curl build to link with to a shared Producer Cpp build.
if(BUILD_STATIC AND BUILD_FORCE_KVSSINK_SHARED)
set(CURL_POSITION_INDEPENDENT_CODE TRUE)
endif()

if(BUILD_DEPENDENCIES)
if(NOT EXISTS ${KINESIS_VIDEO_OPEN_SOURCE_SRC})
Expand Down Expand Up @@ -214,7 +220,7 @@ if(BUILD_GSTREAMER_PLUGIN)
include_directories(${GST_APP_INCLUDE_DIRS})
link_directories(${GST_APP_LIBRARY_DIRS})

if(BUILD_STATIC)
if(BUILD_STATIC AND (NOT BUILD_FORCE_KVSSINK_SHARED))
add_library(gstkvssink STATIC ${GST_PLUGIN_SOURCE_FILES})
else()
add_library(gstkvssink MODULE ${GST_PLUGIN_SOURCE_FILES})
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ Please note that GStreamer is not cross-compiled as a part of the cross-compilat
#### CMake Arguments
You can pass the following options to `cmake ..`.

* `-DBUILD_GSTREAMER_PLUGIN` -- Build kvssink GStreamer plugin
* `-DBUILD_GSTREAMER_PLUGIN` -- Build kvssink GStreamer plugin. Default is OFF.
* `-DBUILD_STATIC` -- Build as static libraries. Default is OFF.
* `-BUILD_FORCE_KVSSINK_SHARED` -- If building with static linkage, build the kvssink GStreamer plugin as a shared library. Default is OFF.
* `-DBUILD_JNI` -- Build C++ wrapper for JNI to expose the functionality to Java/Android
* `-DBUILD_DEPENDENCIES` -- Build depending libraries from source
* `-DBUILD_TEST=TRUE` -- Build unit/integration tests, may be useful for confirm support for your device. `./tst/producerTest`
Expand Down
Loading