Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Commit

Permalink
Initial commit (Version 1.0.0)
Browse files Browse the repository at this point in the history
  • Loading branch information
xlz-jpponcelet committed Sep 12, 2018
0 parents commit 5df0ad0
Show file tree
Hide file tree
Showing 42 changed files with 8,926 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build*
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* Wed Sep 12 2018 Accelize v1.0.0
- NEW: MeteringSessionManager to manage DRM metering sessions
- NEW: C-wrapper API
- NEW: Doxygen documentation
161 changes: 161 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
# Copyright (C) 2018, Accelize
#
# 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.

cmake_minimum_required (VERSION 2.8.12)

project(accelize/drmlib)

# Get version
execute_process(COMMAND git describe --tag --dirty=-d
COMMAND sed s/^v//
COMMAND sed s/-/_/g
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "Library version from Git : ${GIT_VERSION}")
string(REPLACE "." ";" VERSION_LIST ${GIT_VERSION})
list(GET VERSION_LIST 0 VERSION_MAJOR)
set(ABI_VERSION ${VERSION_MAJOR})
message(STATUS "ABI library version from Git : ${ABI_VERSION}")

add_compile_options(-std=c++11)
add_compile_options(-Wall -Wextra -Wnon-virtual-dtor -pedantic)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined")
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)

find_package(Threads REQUIRED)
find_package(CURL REQUIRED)
find_package(jsoncpp REQUIRED)

# Generate public headers
execute_process(COMMAND uname -r OUTPUT_VARIABLE UNAME_R OUTPUT_STRIP_TRAILING_WHITESPACE)
find_program(UNIFDEF_BIN unifdef PATHS /usr/src/kernels/${UNAME_R}/scripts)
if(NOT UNIFDEF_BIN)
message(FATAL_ERROR "unifdef not found")
endif()
set(API_HEADERS
include/accelize/drm/session_manager.h
include/accelize/drm/error.h
include/accelize/drm/metering.h
include/accelize/drm.h
include/accelize/drmc/errorcode.h
include/accelize/drmc/metering.h
include/accelize/drmc/version.h
include/accelize/drmc.h
)
set(PUBLIC_HEADERS_OPTIONS "-UPRIV_HEADER")

set(API_PUBLIC_HEADERS)
foreach(_header_file ${API_HEADERS})
get_filename_component(_header_file_path ${_header_file} DIRECTORY)
add_custom_command(OUTPUT ${_header_file}
COMMAND mkdir -p ${_header_file_path}
COMMAND ${UNIFDEF_BIN} ${PUBLIC_HEADERS_OPTIONS} ${CMAKE_SOURCE_DIR}/${_header_file} > ${_header_file} || [ $$? -eq 0 ] || [ $$? -eq 1 ]
DEPENDS ${CMAKE_SOURCE_DIR}/${_header_file})
list(APPEND API_PUBLIC_HEADERS ${CMAKE_BINARY_DIR}/${_header_file})
endforeach()
configure_file(include/accelize/drm/version.h.in include/accelize/drm/version.h)
list(APPEND API_PUBLIC_HEADERS ${CMAKE_BINARY_DIR}/include/accelize/drm/version.h)
add_custom_target(public_headers ALL DEPENDS ${API_PUBLIC_HEADERS})

set(TARGET_SOURCES
source/ws_client.cpp
source/session_manager.cpp
source/utils.cpp
source/version.cpp
source/error.cpp
)

set(TARGET_C_SOURCES
source/c/wrapperc.cpp
)

include_directories(${CMAKE_BINARY_DIR}/include)
include_directories(internal_inc)
include_directories(include)
include_directories(${CURL_INCLUDE_DIR})
include_directories(drm_controller_sdk/drm_controller_sdk/include)

# DRM_CONTROLLER_SDK
set(DRM_CONTROLLER_SDK_SOURCES
drm_controller_sdk/drm_controller_sdk/source/DrmControllerCommon.cpp
drm_controller_sdk/drm_controller_sdk/source/DrmControllerDataConverter.cpp
drm_controller_sdk/drm_controller_sdk/source/DrmControllerVersion.cpp
drm_controller_sdk/drm_controller_sdk/source/HAL/DrmControllerOperations.cpp
drm_controller_sdk/drm_controller_sdk/source/HAL/DrmControllerRegisters.cpp
)
set_source_files_properties(${DRM_CONTROLLER_SDK_SOURCES} PROPERTIES COMPILE_FLAGS "-Wno-unused-parameter")
add_library(drm_controller_lib STATIC ${DRM_CONTROLLER_SDK_SOURCES})
set_target_properties(drm_controller_lib PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_compile_options(drm_controller_lib PRIVATE -DVERSION_CHECK_DISABLED)

add_library(accelize_drm SHARED ${TARGET_SOURCES})
set_target_properties(accelize_drm PROPERTIES VERSION ${GIT_VERSION} SOVERSION ${ABI_VERSION})
target_link_libraries(accelize_drm ${CURL_LIBRARIES})
target_link_libraries(accelize_drm jsoncpp)
target_link_libraries(accelize_drm drm_controller_lib)
target_link_libraries(accelize_drm ${CMAKE_THREAD_LIBS_INIT})

add_library(accelize_drmc SHARED ${TARGET_C_SOURCES})
set_target_properties(accelize_drmc PROPERTIES VERSION ${GIT_VERSION} SOVERSION ${ABI_VERSION})
target_link_libraries(accelize_drmc accelize_drm)

# Install
include(GNUInstallDirs)
install(TARGETS accelize_drm LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries)
install(TARGETS accelize_drmc LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries)
install(DIRECTORY ${CMAKE_BINARY_DIR}/include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT headers)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/licenses/ DESTINATION ${CMAKE_INSTALL_DOCDIR}/licenses/ COMPONENT licenses)

# Documentation
option(DOC "Produce documentation" OFF)
if(DOC)
find_package(Doxygen REQUIRED)
string(REPLACE ";" " " API_PUBLIC_HEADERS_DOC "${API_PUBLIC_HEADERS}")
configure_file(doc/Doxyfile.in doc/Doxyfile)
add_custom_target(
doc ALL
COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile > /dev/null
DEPENDS ${API_PUBLIC_HEADERS}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/doc
COMMENT "Generating API documentation with Doxygen"
VERBATIM
)
install(DIRECTORY ${CMAKE_BINARY_DIR}/doc/html/ DESTINATION ${CMAKE_INSTALL_DOCDIR}/html/ COMPONENT doc)
endif(DOC)

# Packages
set(CPACK_GENERATOR "TGZ;RPM")
set(CPACK_PACKAGE_NAME "libaccelize_drm")
set(CPACK_PACKAGE_VENDOR "Accelize")
set(CPACK_PACKAGE_CONTACT "accelize.com")
set(CPACK_PACKAGE_MAINTAINER "accelize.com")
set(CPACK_DESCRIPTION_SUMMARY "libaccelize_drm - Library with CPP and C API for Accelize DRM Solution")
set(CPACK_PACKAGE_VERSION ${GIT_VERSION})
set(CPACK_PACKAGE_RELEASE 1)
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-el7.${CMAKE_SYSTEM_PROCESSOR}")
set(CPACK_RPM_CHANGELOG_FILE ${CMAKE_CURRENT_SOURCE_DIR}/CHANGELOG)

# RPM Packages
set(CPACK_RPM_COMPONENT_INSTALL ON)

include(CPack)

# Component groups
cpack_add_component_group(devel)

cpack_add_component(libraries GROUP devel)
cpack_add_component(headers GROUP devel)
cpack_add_component(doc GROUP devel)
cpack_add_component(licenses GROUP devel)
95 changes: 95 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Accelize metering library

Accelize metering library is provided to manage metering sessions between an embedded DRM controller on a FPGA and the AccelStore. It can be used in the QuickPlay accelerator framework or in a custom accelerator framework.

## Licenses

Please consult [license](licenses/LICENSE)

## Changelogs

Please consult [CHANGELOG](CHANGELOG)

## Build

### Requirements

* Linux distribution (tested with centos7)
* GCC toolchain with C++11 support (tested with gcc 4.8.5)
* packages to build :
* cmake (tested with cmake 2.8.12)
* libcurl-devel (tested with libcurl-devel 7.29.0)
* jsoncpp-devel (tested with jsoncpp-devel 1.8.5)
* packages to build packages :
* rpm-build (tested with rpm-build 4.11.3)
* packages to build documentation :
* doxygen (tested with doxygen 1.8.5)
* graphviz (tested with graphviz 2.30.1)

### Build

Basic build :

```console
$mkdir build
$cd build
$cmake ..
$make
```

Build with documentation :

```console
$mkdir build
$cd build
$cmake -DDOC=ON ..
$make
```

Build packages (RPM and TGZ):

```console
$make package
```

Install from build:

```console
$sudo make install
```

### Usage

Please refer to the doxygen generated documentation that document both C and C++ APIs.

### Create the configuration file

The configuration files is a format used in the library to set various options of about the design and the environment

```json
{
"design": {
"udid": "## Please fill the udid communicated by Accelize for your particular application",
"boardType": "## Please fill the boardType communicated by Accelize for your particular application"
},
"webservice": {
"oauth2_url": "https://master.metering.accelize.com/o/token/",
"metering_url": "https://master.metering.accelize.com/auth/metering/genlicense/"
}
}

```

### Create the credential file
Create your credential json file as below

```json
{
"client_id": "## your client id from Accelstore ##",
"client_secret": "## your client id from Accelstore ##"
}

```

# Support and enhancement requests
[Contact us](https://www.accelize.com/contact) for any support or enhancement request.
24 changes: 24 additions & 0 deletions doc/Doxyfile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright (C) 2018, Accelize
#
# 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.

PROJECT_NAME = "Accelize DRMLib C++ and C API"
PROJECT_NUMBER = @GIT_VERSION@
INPUT = @API_PUBLIC_HEADERS_DOC@
FILE_PATTERNS = *.h
RECURSIVE = YES
EXTRACT_ALL = YES
FULL_PATH_NAMES=YES
STRIP_FROM_PATH=@CMAKE_BINARY_DIR@
STRIP_FROM_INC_PATH=@CMAKE_BINARY_DIR@/include
GENERATE_LATEX=NO
Loading

0 comments on commit 5df0ad0

Please sign in to comment.