From d709a6d555fd3620b4cb09aa2518bd2872f5e50d Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Sat, 18 Apr 2020 15:03:41 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D0=B7=D0=BD=D0=B0=D1=87=D0=B5=D0=BD=D0=B8=D1=8F?= =?UTF-8?q?=20=D0=BF=D0=BE=20=D1=83=D0=BC=D0=BE=D0=BB=D1=87=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D1=8E=20=D0=B4=D0=BB=D1=8F=20=D1=81=D0=BE=D0=B7=D0=B4?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=B0=D1=80=D1=85=D0=B8=D0=B2=D0=BE?= =?UTF-8?q?=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMLibCPack.cmake | 38 +++++++++++++++++++++++++++++++++++- CMLibCPackDeb.cmake | 12 ++++++++++++ CMLibRequiredVariables.cmake | 15 -------------- 3 files changed, 49 insertions(+), 16 deletions(-) diff --git a/CMLibCPack.cmake b/CMLibCPack.cmake index 767219d..5862b35 100644 --- a/CMLibCPack.cmake +++ b/CMLibCPack.cmake @@ -4,9 +4,16 @@ set(CPACK_PACKAGE_NAME ${CMLIB_PROJECT_NAME_LOWER}) set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) # Параметры для архива исходных текстов -set(CPACK_SOURCE_GENERATOR TXZ) +if(NOT CPACK_SOURCE_GENERATOR) + set(CPACK_SOURCE_GENERATOR "TXZ") +endif() set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMLIB_PROJECT_NAME_LOWER}-${CPACK_PACKAGE_VERSION}") +# Типы генераторов для бинарных архивов +if(NOT CPACK_GENERATOR) + set(CPACK_GENERATOR "TXZ" "DEB") +endif() + # Параметры для архива собранного проекта set(CPACK_TARGET_ARCH ${CMAKE_SYSTEM_PROCESSOR}) if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") @@ -15,6 +22,35 @@ endif() set(CPACK_PACKAGE_FILE_NAME "${CMLIB_PROJECT_NAME_LOWER}_${CPACK_TARGET_ARCH}_${CPACK_PACKAGE_VERSION}") set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMLIB_PROJECT_NAME_LOWER}-${CPACK_PACKAGE_VERSION}") +# Список масок для исключения из архива исходных текстов +set(CPACK_SOURCE_IGNORE_FILES + "${CPACK_SOURCE_IGNORE_FILES}" + "${CMAKE_BINARY_DIR}" + "^${CMAKE_SOURCE_DIR}/.?build.?/" + "^${CMAKE_SOURCE_DIR}/.?output.?/" + "^${CMAKE_SOURCE_DIR}/files/lib" + "^${CMAKE_SOURCE_DIR}/files/log" + "CMakeLists.txt.user.*" + ".*.autosave" + "~$" + "\\\\.swp$") + +option(CMLIB_COMPACT_SOURCE_PACKAGE "Make compact source package" ON) +if(CMLIB_COMPACT_SOURCE_PACKAGE) + # Список масок для исключения из архива исходных текстов для более компактного архива + set(CPACK_SOURCE_IGNORE_FILES + "${CPACK_SOURCE_IGNORE_FILES}" + "/\\\\.git/" + "/\\\\.gitlab-ci/" + "\\\\.clang-tidy$" + "\\\\.cmake-format$" + "\\\\.gitignore$" + "\\\\.gitattributes$" + "\\\\.gitmodules$" + "\\\\.gitlab-ci.yml$") +endif() + + set(CPACK_PROJECT_CONFIG_FILE ${CMAKE_CURRENT_LIST_DIR}/CMLibCPackProject.cmake) # Правила для сборки пакетов для Debian diff --git a/CMLibCPackDeb.cmake b/CMLibCPackDeb.cmake index 9683b23..8d5b33c 100644 --- a/CMLibCPackDeb.cmake +++ b/CMLibCPackDeb.cmake @@ -3,6 +3,18 @@ if(NOT DEBIAN_PACKAGE_TYPE) set(DEBIAN_PACKAGE_TYPE "unstable") endif() +if(NOT CPACK_DEBIAN_PACKAGE_SECTION) + set(CPACK_DEBIAN_PACKAGE_SECTION "misc") +endif() + +if(NOT CPACK_DEBIAN_PACKAGE_PRIORITY) + set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional") +endif() + +#if(NOT CPACK_SOURCE_IGNORE_FILES) +# message(FATAL_ERROR "Required variable CPACK_SOURCE_IGNORE_FILES is not defined") +#endif() + # По умолчанию пакет для Debian делится на компоненты if(NOT CPACK_DEB_COMPONENT_INSTALL) set(CPACK_DEB_COMPONENT_INSTALL ON) diff --git a/CMLibRequiredVariables.cmake b/CMLibRequiredVariables.cmake index f938974..6980fb3 100644 --- a/CMLibRequiredVariables.cmake +++ b/CMLibRequiredVariables.cmake @@ -10,10 +10,6 @@ endif() set(CPACK_PACKAGE_VENDOR ${ORGANIZATION_NAME}) -if(NOT CPACK_GENERATOR) - message(FATAL_ERROR "Required variable CPACK_GENERATOR is not defined") -endif() - if(NOT CPACK_PACKAGE_CONTACT) message(FATAL_ERROR "Required variable CPACK_PACKAGE_CONTACT is not defined") endif() @@ -22,14 +18,3 @@ if(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY) message(FATAL_ERROR "Required variable CPACK_PACKAGE_DESCRIPTION_SUMMARY is not defined") endif() -if(NOT CPACK_DEBIAN_PACKAGE_SECTION) - message(FATAL_ERROR "Required variable CPACK_DEBIAN_PACKAGE_SECTION is not defined") -endif() - -if(NOT CPACK_DEBIAN_PACKAGE_PRIORITY) - message(FATAL_ERROR "Required variable CPACK_DEBIAN_PACKAGE_PRIORITY is not defined") -endif() - -if(NOT CPACK_SOURCE_IGNORE_FILES) - message(FATAL_ERROR "Required variable CPACK_SOURCE_IGNORE_FILES is not defined") -endif()