Skip to content

Commit

Permalink
Merge pull request #51 from mpeg5/dev-CPackPackaging
Browse files Browse the repository at this point in the history
Configured NSIS and DEB generators for binary windows installer and d…
  • Loading branch information
mpeg5 authored May 22, 2022
2 parents d28d299 + 66f9cd0 commit 4b17da9
Show file tree
Hide file tree
Showing 4 changed files with 208 additions and 42 deletions.
95 changes: 93 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ set(CMAKE_C_STANDARD 99)
project (XEVE VERSION 1.0.0)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

# Set compiler flags and options.
# Set compiler flags and options.
if( MSVC )
elseif( UNIX OR MINGW )
if(NOT CMAKE_BUILD_TYPE)
Expand All @@ -44,7 +44,7 @@ elseif( UNIX OR MINGW )
set(OPT_DBG "-g")
else()
set(OPT_LV "O3")
set(OPT_DBG "-DNDEBUG") # disable assert
set(OPT_DBG "-DNDEBUG") # disable assert
endif()

set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OPT_DBG} -${OPT_LV} -fomit-frame-pointer -Wall -Wno-unused-function -Wno-unused-but-set-variable -Wno-unused-variable -Wno-attributes -Werror -Wno-strict-overflow -Wno-unknown-pragmas -Wno-stringop-overflow -std=c99")
Expand Down Expand Up @@ -75,3 +75,94 @@ if(NOT TARGET uninstall)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif()

########################################
# add CPack to project
########################################

if( MSVC )
set(CPACK_GENERATOR "NSIS")
elseif( UNIX )
set(CPACK_GENERATOR "DEB")
endif()

# Package name
if(("${SET_PROF}" STREQUAL "BASE"))
set(PACKAGE_PROFILE_NAME "base")
endif()

if(("${SET_PROF}" STREQUAL "MAIN"))
set(PACKAGE_PROFILE_NAME "main")
endif()

string(TOLOWER "${PROJECT_NAME}" PACKAGE_NAME)
string(CONCAT PACKAGE_NAME ${PACKAGE_NAME} "-${PACKAGE_PROFILE_NAME}")
set(CPACK_PACKAGE_NAME ${PACKAGE_NAME})

# Package License & Readme file
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md")

# Package checksum
set(CPACK_PACKAGE_CHECKSUM MD5)

# Short description of the project
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
"eXtra-fast Essential Video Encoder, MPEG-5 EVC (Essential Video Coding), ${PACKAGE_PROFILE_NAME} profile")

# Project homepage
set(CPACK_PACKAGE_VENDOR "MPEG-5")
set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/mpeg5/xeve/releases")
set(CMAKE_PROJECT_HOMEPAGE_URL "https://github.com/mpeg5/xeve")

# Installation directory on the target system
string(TOLOWER "${PROJECT_NAME}" PROJECT_NAME_LOWER)
set(PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME_LOWER} ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${PACKAGE_INSTALL_DIRECTORY}")

if( UNIX )
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "MPEG-Five") #required​
set(CPACK_PACKAGE_CONTACT "[email protected]") #required

set(CPACK_DEB_COMPONENT_INSTALL ON)

# If enabled (ON) multiple packages are generated.
# By default a single package containing files of all components is generated.
set(CPACK_DEB_COMPONENT_INSTALL YES)

# This may be set to DEB-DEFAULT to allow CPackDeb to generate package file name by itself in deb format:
# <PackageName>_<VersionNumber>-<DebianRevisionNumber>_<DebianArchitecture>.deb
set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)

set(CPACK_DEBIAN_RUNTIMEGROUP_PACKAGE_NAME "${CPACK_PACKAGE_NAME}")
set(CPACK_DEBIAN_DEVELOPMENTGROUP_PACKAGE_NAME "${CPACK_PACKAGE_NAME}-dev")
set(CPACK_DEBIAN_DEVELOPMENTGROUP_PACKAGE_DEPENDS ${CPACK_PACKAGE_NAME})
endif()

# Dependencies
set(CPACK_COMPONENTS_ALL Runtime Libraries Development)
set(CPACK_COMPONENT_DEVELOPMENT_DEPENDS Libraries)
set(CPACK_COMPONENT_RUNTIME_DEPENDS Libraries)

include(CPack)

if( MSVC )
cpack_add_install_type(Full DISPLAY_NAME "All")
cpack_add_install_type(Developer DISPLAY_NAME "Developer files")
endif()

cpack_add_component_group(DevelopmentGroup
DISPLAY_NAME "Development"
EXPANDED
DESCRIPTION
"All of the tools you'll ever need to develop libxeve dependent software")

cpack_add_component_group(RuntimeGroup
DISPLAY_NAME "Runtime"
EXPANDED
DESCRIPTION
"Shared library and xeve_app reference application")

cpack_add_component(Runtime DISPLAY_NAME "Application" DESCRIPTION "Reference application that makes use of libxeve" GROUP RuntimeGroup INSTALL_TYPES Full Runtime)
cpack_add_component(Libraries DISPLAY_NAME "Shared Libraries" DESCRIPTION "Shared libraries used to run xeve_app" GROUP RuntimeGroup INSTALL_TYPES Full Runtime Developer)
cpack_add_component(Development DISPLAY_NAME "C++ Headers and static libraries used to build programs with libxeve" DESCRIPTION "C/C++ header files for use with libxeve" GROUP DevelopmentGroup INSTALL_TYPES Full Developer)
107 changes: 91 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# eXtra-fast Essential Video Encoder (XEVE)
[![Build](https://github.com/mpeg5/xeve/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/mpeg5/xeve/actions/workflows/build.yml)
# eXtra-fast Essential Video Encoder (XEVE)
[![Build](https://github.com/mpeg5/xeve/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/mpeg5/xeve/actions/workflows/build.yml)

The **eXtra-fast Essential Video Encoder** (XEVE) is an opensource and fast MPEG-5 EVC encoder.
The **eXtra-fast Essential Video Encoder** (XEVE) is an opensource and fast MPEG-5 EVC encoder.

**MPEG-5 Essential Video Coding** (EVC) is a video compression standard of ISO/IEC Moving Picture Experts Grop (MPEG). The main goal of the EVC is to provide a significantly improved compression capability over existing video coding standards with timely publication of terms.
**MPEG-5 Essential Video Coding** (EVC) is a video compression standard of ISO/IEC Moving Picture Experts Grop (MPEG). The main goal of the EVC is to provide a significantly improved compression capability over existing video coding standards with timely publication of terms.
The EVC defines two profiles, including "**Baseline Profile**" and "**Main Profile**". The "Baseline profile" contains only technologies that are older than 20 years or otherwise freely available for use in the standard. In addition, the "Main profile" adds a small number of additional tools, each of which can be either cleanly disabled or switched to the corresponding baseline tool on an individual basis.

## Quality comparison
Expand All @@ -25,7 +25,7 @@ MPEG-5 EVC Main Profile can show 2-times better coding gain over HEVC/H.265 code
- Build Requirements
- CMake 3.12 or later (download from [https://cmake.org/](https://cmake.org/))
- GCC 5.4.0 or later

- Build Instructions for **Baseline Profile**
```
$mkdir build
Expand All @@ -49,7 +49,7 @@ MPEG-5 EVC Main Profile can show 2-times better coding gain over HEVC/H.265 code
- Output Location
- Executable application (xeve_app) can be found under build/bin/.
- Library files (libxeve.so and libxexe.a) can be found under build/lib/.
- Application and libraries built with Main Profile can also support Baseline Profile operation.
- Application and libraries built with Main Profile can also support Baseline Profile operation.


### Windows (64-bit)
Expand All @@ -66,7 +66,7 @@ MPEG-5 EVC Main Profile can show 2-times better coding gain over HEVC/H.265 code
$make
$sudo make install
```
- Microsoft Visual Studio
- Microsoft Visual Studio
```
$mkdir build
$cd build
Expand All @@ -84,7 +84,7 @@ MPEG-5 EVC Main Profile can show 2-times better coding gain over HEVC/H.265 code
$make
$sudo make install
```
- Microsoft Visual Studio
- Microsoft Visual Studio
```
$mkdir build
$cd build
Expand All @@ -93,12 +93,87 @@ MPEG-5 EVC Main Profile can show 2-times better coding gain over HEVC/H.265 code
```
You can change '-G' option with proper version of Visual Studio.
- Application and libraries built with Main Profile can also support Baseline Profile operation.
## How to generate installer
### Linux (64-bit)
- Generation of **DEB packages** instructions
- Follow build instruction and build the project
- Generate **DEB packages**
```
$make package
```
or
```
cpack -G "DEB"
```
- Output
- Base DEB package for **Baseline Profile**:
- package: xeve-base-dev_1.0.0_amd64.deb
- checksum file: xeve-base-dev_1.0.0_amd64.deb.md5
- Developer DEB package for **Baseline Profile**::
- package: xeve-base_1.0.0_amd64.deb
- checksum file: xeve-base_1.0.0_amd64.deb.md5 generated.
- Base DEB package for **Main Profile**:
- package: xeve-main-dev_1.0.0_amd64.deb
- checksum file: xeve-main-dev_1.0.0_amd64.deb.md5
- Developer DEB package for **Main Profile**:
- package: xeve-main_1.0.0_amd64.deb
- checksum file: xeve-base_1.0.0_amd64.deb.md5 generated.
- Generation of **RPM packages**
- Follow build instruction and build the project
- Generate **RPM packages**
```
cpack -G "RPM" ..
```
- Generation of **ZIP archives**
- Follow build instruction and build the project
- Generate **ZIP archive**
```
cpack -G "ZIP" ..
```
### Windows (64-bit)
- Requirements
- NSIS 3.08 or later (download from [https://nsis.sourceforge.io/Download](https://nsis.sourceforge.io/Download))
- Generation of **NSIS windows installer** instructions
- Follow build instruction and build the project
- Generate **NSIS Windows installer**
- Command Prompt for Visual Studio
- Go to the build directory and issue the following command
```
msbuild /P:Configuration=Release PACKAGE.vcxproj
```
- Visual Studio IDE
- Open up the generated solution (XEVE.sln)
- Change build type from Debug to Release
- Go to the Solution Explorer, then select and mouse right click on the PACKAGE project located in CMakePredefinedTargets folder
- Choose Build item, when a pop down menu appears
> As a result CPack processing message should appear and NSIS installer as well as as checksum file are generated into build directory.
- MinGW-64
- Go to the build directory and issue the following command
```
$make package
```
- Output:
- Baseline Profile:
- xeve-base-1.0.0-win64.exe
- xeve-base-1.0.0-win64.exe.md5
- Main Profile:
- xeve-main-1.0.0-win64.exe
- xeve-main-1.0.0-win64.exe.md5
## How to use
Full help message will be presented if xeve application is executed with '**--help**' option.
```
Syntax:
xeve_app -i 'input-file' [ options ]
Syntax:
xeve_app -i 'input-file' [ options ]

Options:
--help
Expand Down Expand Up @@ -129,17 +204,17 @@ Options:
-m, --threads [INTEGER] (optional) [1]
: force to use a specific number of threads
-d, --input-depth [INTEGER] (optional) [8]
: input bit depth (8, 10)
: input bit depth (8, 10)
--codec-bit-depth [INTEGER] (optional) [10]
: codec internal bit depth (10, 12)
: codec internal bit depth (10, 12)
--input-csp [INTEGER] (optional) [1]
: input color space (chroma format)
- 0: YUV400
- 1: YUV420
--profile [STRING] (optional) [baseline]
: profile setting flag (main, baseline)
--level-idc [INTEGER] (optional) [0]
: level setting
: level setting
--preset [STRING] (optional) [medium]
: Encoder PRESET [fast, medium, slow, placebo]
--tune [STRING] (optional) [None]
Expand Down Expand Up @@ -184,10 +259,10 @@ XEVE_IMGB image; /* input picture */
while (!end_of_sequence)
{
end_of_seqeunce = read_image(&image); /* read new image */
xeve_push(id, &image); /* input new image to encoder */
ret = xeve_encode(id, &bitb, &stat); /* actual encode image to bitstream */
if (ret == XEVE_OK && stat.write > 0)
{
write_bitstream(bitb.addr, stat.write); /* write encoded bitstream */
Expand Down
22 changes: 11 additions & 11 deletions src_base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ include(GenerateExportHeader)
include_directories("${CMAKE_BINARY_DIR}")


if("${ARM}" STREQUAL "TRUE")
if("${ARM}" STREQUAL "TRUE")
add_library( ${LIB_NAME_BASE} STATIC ${LIB_API_SRC} ${ETM_INC} ${LIB_BASE_SRC} ${LIB_BASE_INC} ${LIB_NEON_INC} ${LIB_NEON_SRC})
add_library( ${LIB_NAME_BASE}_dynamic SHARED ${LIB_API_SRC} ${ETM_INC} ${LIB_BASE_SRC} ${LIB_BASE_INC} ${LIB_NEON_INC} ${LIB_NEON_SRC})
else()
Expand All @@ -40,7 +40,7 @@ set_target_properties(${LIB_NAME_BASE}_dynamic PROPERTIES VERSION ${PROJECT_VERS
#endif()

# Generate export macros for libraries
generate_export_header(${LIB_NAME_BASE}_dynamic
generate_export_header(${LIB_NAME_BASE}_dynamic
BASE_NAME XEVE
EXPORT_FILE_NAME ${CMAKE_BINARY_DIR}/xeve_exports.h)

Expand All @@ -56,7 +56,7 @@ source_group("base\\avx\\source" FILES ${LIB_AVX_SRC})
source_group("base\\neon\\header" FILES ${LIB_NEON_INC})
source_group("base\\neon\\source" FILES ${LIB_NEON_SRC})

if("${ARM}" STREQUAL "TRUE")
if("${ARM}" STREQUAL "TRUE")
include_directories( ${LIB_NAME_BASE} PUBLIC . .. ../inc ./neon)
else()
include_directories( ${LIB_NAME_BASE} PUBLIC . .. ../inc ./sse ./avx)
Expand All @@ -71,7 +71,7 @@ set( NEON ${LIB_NEON_SRC})

set_target_properties(${LIB_NAME_BASE}_dynamic PROPERTIES OUTPUT_NAME ${LIB_NAME_BASE})

if( MSVC )
if( MSVC )
target_compile_definitions( ${LIB_NAME_BASE} PUBLIC ANY _CRT_SECURE_NO_WARNINGS )
set_target_properties(${LIB_NAME_BASE}_dynamic PROPERTIES FOLDER lib
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
Expand All @@ -82,7 +82,7 @@ elseif( UNIX OR MINGW )
endif()
set_target_properties(${LIB_NAME_BASE}_dynamic PROPERTIES FOLDER lib
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
target_compile_definitions( ${LIB_NAME_BASE} PUBLIC ANY LINUX )
target_compile_definitions( ${LIB_NAME_BASE} PUBLIC ANY LINUX )
target_link_libraries(${LIB_NAME_BASE} m)
endif()

Expand Down Expand Up @@ -115,14 +115,14 @@ install(TARGETS ${LIB_NAME_BASE}
#
install(TARGETS ${LIB_NAME_BASE}_dynamic
RUNTIME COMPONENT Libraries DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY
COMPONENT Libraries DESTINATION ${CMAKE_INSTALL_LIBDIR}
NAMELINK_COMPONENT Development DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY
COMPONENT Libraries DESTINATION ${CMAKE_INSTALL_LIBDIR}
NAMELINK_COMPONENT Development DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE COMPONENT Development DESTINATION ${CMAKE_INSTALL_LIBDIR}/${LIB_NAME_BASE}/import
)

install( FILES
${PROJECT_BINARY_DIR}/xeve_exports.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${LIB_NAME_BASE}
${PROJECT_BINARY_DIR}/xeve_exports.h COMPONENT Development DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${LIB_NAME_BASE}
)

if( NOT MSVC )
Expand All @@ -132,6 +132,6 @@ if( NOT MSVC )
IMMEDIATE @ONLY)

install( FILES
"${CMAKE_BINARY_DIR}/${LIB_NAME_BASE}.pc" DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
"${CMAKE_BINARY_DIR}/${LIB_NAME_BASE}.pc" COMPONENT Development DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
endif()
endif()
Loading

0 comments on commit 4b17da9

Please sign in to comment.