Skip to content

Commit

Permalink
Fix native ocdm build. rialto 484 (#46)
Browse files Browse the repository at this point in the history
Summary: Fix the native build for OCDM. The cmake and make commands
should work with the same arguments as supplied in the rialto-gstreamer
native build
Type: Fix
Test Plan: Unit tests, component tests and native build
Jira: RIALTO-484
  • Loading branch information
skyproudmanp authored Feb 8, 2024
1 parent 5295b17 commit 01786b2
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 12 deletions.
97 changes: 97 additions & 0 deletions .github/workflows/native_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#
# If not stated otherwise in this file or this component's LICENSE file the
# following copyright and licenses apply:
#
# Copyright 2024 Sky UK
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

name: Native Build

on:
pull_request:
branches: [ "master", "rdkcentral:master" ]
push:
branches: [ "master", "rdkcentral:master" ]
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-22.04

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
path: rialto-ocdm

- name: Check out rialto
uses: actions/checkout@v3
with:
repository: rdkcentral/rialto
path: ./rialto
fetch-depth: 0

- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install cmake
sudo apt-get install libunwind-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev libgstreamer1.0-dev
- name: Install protobuf
run: |
sudo apt-get install protobuf-compiler
- name: Switch branch
continue-on-error: true
run: |
BRANCH=${GITHUB_HEAD_REF##*/}
cd rialto
# This will fail if there's no corresponding branch in rialto
# ...but that's ok since we set continue-on-error
git checkout $BRANCH
- name: Native build Rialto
run: |
BASE_DIR=$(pwd)
NATIVE_DIR=$BASE_DIR/native
echo "NATIVE_DIR=$NATIVE_DIR" &> $BASE_DIR/output_file.txt
ls &>> $BASE_DIR/output_file.txt
cd rialto
cmake . -B build -DCMAKE_INSTALL_PREFIX=$NATIVE_DIR -DNATIVE_BUILD=ON -DRIALTO_BUILD_TYPE="Debug" &>> $BASE_DIR/output_file.txt
make -C build install &>> $BASE_DIR/output_file.txt
- name: Native build OCDM
run: |
BASE_DIR=$(pwd)
NATIVE_DIR=$BASE_DIR/native
cd rialto-ocdm
echo "@@@ OCDM BUILD" &>> $BASE_DIR/output_file.txt
cmake . -B build -DCMAKE_INCLUDE_PATH="${NATIVE_DIR}/include" -DCMAKE_LIBRARY_PATH="${NATIVE_DIR}/lib" -DNATIVE_BUILD=ON -DRIALTO_BUILD_TYPE="Debug" &>> $BASE_DIR/output_file.txt
make -C build &>> $BASE_DIR/output_file.txt
- name: Report Build Status Success
if: success()
run: |
echo "Build Succeeded!"
exit 0
- name: Upload Logs on Failure
uses: actions/upload-artifact@v3
if: failure()
with:
name: Output Logs
path: |
output_file.txt
14 changes: 11 additions & 3 deletions cmake/FindRialto.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# If not stated otherwise in this file or this component's LICENSE file the
# following copyright and licenses apply:
#
# Copyright 2022 Sky UK
# Copyright 2024 Sky UK
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -17,14 +17,22 @@
# limitations under the License.
#

#############
# NOTE
# NOTE: This file is a copy of gstreamer/cmake/FindRialto.cmake
# NOTE: Please keep these two files "in step"
# NOTE: ...except for the different licence
# NOTE
#############

# - Try to find the Rialto library.
#
# The following are set after configuration is done:
# RIALTO_FOUND
# RIALTO_INCLUDE_DIRS
# RIALTO_LIBRARY_DIRS
# RIALTO_LIBRARIES
find_path( RIALTO_INCLUDE_DIR NAMES IMediaKeys.h PATH_SUFFIXES rialto)
find_path( RIALTO_INCLUDE_DIR NAMES IMediaPipeline.h PATH_SUFFIXES rialto)
find_library( RIALTO_LIBRARY NAMES libRialtoClient.so RialtoClient )

#message( "RIALTO_INCLUDE_DIR include dir = ${RIALTO_INCLUDE_DIR}" )
Expand All @@ -49,4 +57,4 @@ if( RIALTO_FOUND AND NOT TARGET Rialto::RialtoClient )
set_target_properties( Rialto::RialtoClient PROPERTIES
IMPORTED_LOCATION "${RIALTO_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${RIALTO_INCLUDE_DIR}" )
endif()
endif()
15 changes: 6 additions & 9 deletions library/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
# limitations under the License.
#

find_package( Rialto REQUIRED )
find_package( ocdm REQUIRED )
find_package(Rialto 1.0 REQUIRED)

set(LIB_OCDM_RIALTO_SOURCES
add_library(ocdmRialto

SHARED
source/open_cdm.cpp
source/open_cdm_adapter.cpp
source/open_cdm_ext.cpp
Expand All @@ -34,8 +35,6 @@ set(LIB_OCDM_RIALTO_SOURCES
source/MessageDispatcher.cpp
source/RialtoGStreamerEMEProtectionMetadata.cpp)

add_library(ocdmRialto SHARED ${LIB_OCDM_RIALTO_SOURCES} )

set_target_properties(
ocdmRialto
PROPERTIES LINK_FLAGS "-Wl,--unresolved-symbols=report-all"
Expand All @@ -46,12 +45,10 @@ set_target_properties(
target_include_directories(
ocdmRialto

PUBLIC
$<INSTALL_INTERFACE:include/rialto>

PRIVATE
include
${RIALTO_INCLUDE_DIR}
${CMAKE_INCLUDE_PATH}
${CMAKE_INCLUDE_PATH}/rialto
${GStreamerApp_INCLUDE_DIRS}
)

Expand Down

0 comments on commit 01786b2

Please sign in to comment.