From d5583c9a6c4cd94fced49c850e681d5d77f98b96 Mon Sep 17 00:00:00 2001 From: Kirill Kirilenko Date: Wed, 7 Apr 2021 22:28:41 +0300 Subject: [PATCH] Add option to build DEB package. --- CMakeLists.txt | 1 + libwebrtc/CMakeLists.txt | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 58b65e9..a0d4eae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,7 @@ project(libwebrtc) option(GN_EXTRA_ARGS "Extra 'gn gen' arguments to pass when configuring WebRTC" "") option(NINJA_ARGS "Ninja arguments to pass when compiling WebRTC" "") +option(BUILD_DEB_PACKAGE "Build .deb package" OFF) # Allow the use of IN_LIST operand cmake_policy(SET CMP0057 NEW) diff --git a/libwebrtc/CMakeLists.txt b/libwebrtc/CMakeLists.txt index af85036..b466633 100644 --- a/libwebrtc/CMakeLists.txt +++ b/libwebrtc/CMakeLists.txt @@ -1,3 +1,7 @@ +if (BUILD_DEB_PACKAGE) + set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH INTERNAL FORCE) +endif () + # Prepare CMake exports configure_file(LibWebRTCConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/LibWebRTCConfig.cmake @ONLY) configure_file(LibWebRTCConfigVersion.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/LibWebRTCConfigVersion.cmake @ONLY) @@ -81,3 +85,18 @@ else () install(FILES LibWebRTCTargets-release.cmake DESTINATION "lib/cmake/LibWebRTC") endif () endif () + +if (BUILD_DEB_PACKAGE) + set(CPACK_GENERATOR "DEB") + set(CPACK_PACKAGE_NAME "libwebrtc-dev") + set(CPACK_PACKAGE_VENDOR "Kirill Kirilenko") + set(CPACK_PACKAGE_CONTACT "Kirill Kirilenko ") + set(CPACK_PACKAGE_VERSION_MAJOR ${WEBRTC_VERSION}) + set(CPACK_PACKAGE_VERSION_MINOR "") + set(CPACK_PACKAGE_VERSION_PATCH "") + set(CPACK_PACKAGE_DESCRIPTION "WebRTC static library and header files") + set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/UltraCoderRU/libwebrtc") + set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${WEBRTC_VERSION}") + set(CPACK_DEBIAN_PACKAGE_DEPENDS "") + include(CPack) +endif ()