2022-05-06 09:49:46 +00:00
|
|
|
include_guard(GLOBAL)
|
|
|
|
|
|
|
|
|
2021-12-08 11:32:04 +00:00
|
|
|
# Общие настройки для пакета: организация, автор, версия
|
|
|
|
set(CPACK_PACKAGE_VENDOR ${MYX_CMAKE_ORGANIZATION_NAME_LOWER} CACHE STRING "")
|
|
|
|
set(CPACK_PACKAGE_NAME ${MYX_CMAKE_PROJECT_NAME_LOWER} CACHE STRING "")
|
|
|
|
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION} CACHE STRING "")
|
|
|
|
|
|
|
|
# Параметры для архива исходных текстов
|
|
|
|
if(NOT CPACK_SOURCE_GENERATOR)
|
|
|
|
set(CPACK_SOURCE_GENERATOR "TGZ")
|
|
|
|
endif()
|
|
|
|
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${MYX_CMAKE_PROJECT_NAME_LOWER}-${CPACK_PACKAGE_VERSION}")
|
|
|
|
|
|
|
|
# Типы генераторов для бинарных архивов
|
|
|
|
if(NOT CPACK_GENERATOR)
|
|
|
|
set(CPACK_GENERATOR "TGZ" "DEB")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Параметры для архива собранного проекта
|
|
|
|
set(CPACK_TARGET_ARCH ${CMAKE_SYSTEM_PROCESSOR})
|
|
|
|
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
|
|
|
set(CPACK_TARGET_ARCH "amd64")
|
|
|
|
endif()
|
|
|
|
set(CPACK_PACKAGE_FILE_NAME "${MYX_CMAKE_PROJECT_NAME_LOWER}_${CPACK_TARGET_ARCH}_${CPACK_PACKAGE_VERSION}")
|
|
|
|
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${MYX_CMAKE_PROJECT_NAME_LOWER}-${CPACK_PACKAGE_VERSION}")
|
|
|
|
|
|
|
|
# Список масок для исключения из архива исходных текстов
|
|
|
|
set(CPACK_SOURCE_IGNORE_FILES
|
2022-01-25 17:49:02 +00:00
|
|
|
"${CPACK_SOURCE_IGNORE_FILES}"
|
|
|
|
"${CMAKE_BINARY_DIR}"
|
|
|
|
"^${CMAKE_SOURCE_DIR}/.?build.?/"
|
|
|
|
"^${CMAKE_SOURCE_DIR}/.?output.?/"
|
|
|
|
"^${CMAKE_SOURCE_DIR}/files/var"
|
|
|
|
"^${CMAKE_SOURCE_DIR}/files/log"
|
|
|
|
"CMakeLists.txt.user.*"
|
|
|
|
".*.autosave"
|
|
|
|
".*.status"
|
|
|
|
"~$"
|
|
|
|
"\\\\.swp$")
|
2021-12-08 11:32:04 +00:00
|
|
|
|
|
|
|
option(MYX_CMAKE_COMPACT_SOURCE_PACKAGE "Make compact source package" ON)
|
|
|
|
if(MYX_CMAKE_COMPACT_SOURCE_PACKAGE)
|
|
|
|
# Список масок для исключения из архива исходных текстов для более компактного архива
|
|
|
|
set(CPACK_SOURCE_IGNORE_FILES
|
2022-01-25 17:49:02 +00:00
|
|
|
${CPACK_SOURCE_IGNORE_FILES}
|
2021-12-12 20:11:20 +00:00
|
|
|
"\\\\.git"
|
|
|
|
"/\\\\.git/"
|
|
|
|
"/\\\\.gitlab-ci/"
|
|
|
|
"\\\\.clang-tidy$"
|
|
|
|
"\\\\.cmake-format$"
|
|
|
|
"\\\\.gitignore$"
|
|
|
|
"\\\\.gitattributes$"
|
|
|
|
"\\\\.gitmodules$"
|
|
|
|
"\\\\.gitlab-ci.yml$")
|
2021-12-08 11:32:04 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
set(CPACK_PROJECT_CONFIG_FILE ${CMAKE_CURRENT_LIST_DIR}/MyxCMakeCPackProject.cmake)
|
|
|
|
|
|
|
|
option(MYX_CMAKE_CPACK_DEFAULT_SCHEME "Use packaging default scheme" ON)
|
|
|
|
|
|
|
|
# Правила для сборки обычных архивов
|
|
|
|
if(MYX_CMAKE_CPACK_DEFAULT_SCHEME)
|
|
|
|
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
|
|
|
|
set(CPACK_COMPONENTS_GROUPING IGNORE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Правила для сборки пакетов для Debian
|
2021-12-09 11:41:26 +00:00
|
|
|
include(MyxCMakeCPackDeb)
|
2021-12-08 11:32:04 +00:00
|
|
|
|
|
|
|
# Подключение модуля, выполняющего сборку архивов и пакетов
|
|
|
|
include(CPack)
|