Начало

This commit is contained in:
Andrei Astafev 2023-10-13 13:32:12 +03:00
commit 14d88feae9
36 changed files with 6666 additions and 0 deletions

259
.gitignore vendored Normal file
View File

@ -0,0 +1,259 @@
files/etc/config.yaml
# Каталог для результатов сборки проекта
_build
build
# Каталог для тестирования установки
_output
# Каталог для скачивания необходимых файлов
_downloads
# Debian
debian/changelog
debian/compat
debian/control
debian/files
debian/rules
# Файлы настроек, редактируемые во время отладки,
# за исключением шаблонных файлов
files/etc/*.conf
!files/etc/*.example.conf
# Каталоги, в которые разрешена запись данных во время работы программы
files/var/*
files/lib/*
files/log/*
!.gitkeep
!.gitignore
*_export.hpp
###
### Общие настройки для C, C++, Fortran, Qt, CMake, Ninja, LaTeX и редакторов
###
###
### Временные файлы текстовых редакторов
###
*.bak
*.gho
*.tmp
*.dotdropbak
###
### LyX
###
*.lyx~
*.lyx#
###
### Vim
###
# Swap
[._]*.s[a-v][a-z]
!*.svg # comment out if you don't need vector files
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]
# Project
.vimprj
# Temporary
.netrwhist
*~
# Auto-generated tag files
tags
# Persistent undo
[._]*.un~
###
### C++
###
# Prerequisites
*.d
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.so.*
*.dylib
*.dll
# Fortran module files
*.mod
*.smod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
###
### CMake
###
PreLoad.cmake
CMakeLists.txt.user*
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps
### CMake Patch ###
# External projects
*-prefix/
###
### Ninja
###
.ninja_deps
.ninja_log
###
### GCC coverage testing tool files
###
*.gcno
*.gcda
*.gcov
###
### Qt
###
object_script.*.Release
object_script.*.Debug
*_plugin_import.cpp
/.qmake.cache
/.qmake.stash
*.pro.user
*.pro.user.*
*.qbs.user
*.qbs.user.*
*.moc
moc_*.cpp
moc_*.h
qrc_*.cpp
ui_*.h
*.qmlc
*.jsc
Makefile*
*build-*
*.qm
*.prl
# Qt unit tests
target_wrapper.*
# QtCreator
*.autosave
# QtCreator Qml
*.qmlproject.user
*.qmlproject.user.*
# QtCreator local machine specific files for imported projects
*creator.user*
*_qmlcache.qrc
### KDevelop4 ###
*.kdev4
.kdev4/
### vscode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
### Eclipse ###
.metadata
.settings/
.recommenders/
# TeXlipse
.texlipse
# PyDev specific (Python IDE for Eclipse)
*.pydevproject
# CDT-specific (C/C++ Development Tooling)
.cproject
# CDT- autotools
.autotools
###
### Latex
###
*.acn
*.acr
*.alg
*.aux
*.bbl
*.blg
*.dvi
*.fdb_latexmk
*.fls
*.glg
*.glo
*.gls
*.idx
*.ilg
*.ind
*.ist
*.lof
*.log
*.lot
*.maf
*.mtc
*.mtc0
*.nav
*.nlo
*.out
*.pdfsync
*.ps
*.snm
*.synctex.gz
*.toc
*.vrb
*.xdv
*.xdy
*.tdo

20
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,20 @@
include:
- project: 'f1x1t/gitlab-ci'
ref: master
file: 'scheduled.yml'
smolensk15-nightly:
extends: .scheduled-smolensk15
orel212-nightly:
extends: .scheduled-orel212
focal-nightly:
extends: .scheduled-focal
jammy-nightly:
extends: .scheduled-jammy
elbrus-nightly:
extends: .scheduled-elbrus

44
CMakeLists.txt Normal file
View File

@ -0,0 +1,44 @@
# Минимальная версия CMake, требуемая для сборки проекта
cmake_minimum_required(VERSION 3.6 FATAL_ERROR)
# Предпочтительно следовать стандартам принятым в указанном диапазоне версий
cmake_policy(VERSION 3.6..3.7)
# Название и версия проекта и используемые языки программирования
project(myx-example-app-deb
VERSION 0.4.0
LANGUAGES C CXX
DESCRIPTION "Debian packaging example")
# Имя и почта автора (требуются для создания пакетов)
set(${PROJECT_NAME}_AUTHOR_NAME "Andrey Astafyev")
set(${PROJECT_NAME}_AUTHOR_EMAIL "dev@246060.ru")
# Рекомендуемый способ подключения MyxCMake
include(cmake/myx_setup.cmake)
# Правила загрузки требуемых файлов
include(myx_download_content.cmake)
# Цель для создания исполняемого файла
myx_add_executable(${PROJECT_NAME})
# Настройка свойств цели
myx_target_setup(${PROJECT_NAME}
CPP
${PROJECT_SOURCE_DIR}/src/${PROJECT_NAME}/main.cpp
LINK_LIBRARIES
myx-example-interface-library
myx-example-object-library
)
# Автоматически генерируемый файл с информацией о репозитории
myx_generate_git_info_header(${PROJECT_NAME} "git_info_p.hpp")
# Автоматически генерируемый приватный заголовочный файл
myx_generate_private_config_header(${PROJECT_NAME} "config_p.hpp")
# Форматирование исходных текстов с помощью uncrustify
myx_uncrustify(${PROJECT_NAME})
# Цель для сборки пакета для Debian
include(cmake/package/deb.cmake)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,9 @@
set(MYX_CMAKE_PACKAGE_VERSION "2.4.17")
if(MYX_CMAKE_PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()

View File

@ -0,0 +1,28 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION ${CMAKE_VERSION})
# We name the project and the target for the ExternalProject_Add() call
# to something that will highlight to the user what we are working on if
# something goes wrong and an error message is produced.
project(${contentName}-populate NONE)
@__FETCHCONTENT_CACHED_INFO@
include(ExternalProject)
ExternalProject_Add(${contentName}-populate
${ARG_EXTRA}
SOURCE_DIR "${ARG_SOURCE_DIR}"
BINARY_DIR "${ARG_BINARY_DIR}"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
USES_TERMINAL_DOWNLOAD YES
USES_TERMINAL_UPDATE YES
USES_TERMINAL_PATCH YES
)
@__FETCHCONTENT_COPY_FILE@

View File

@ -0,0 +1,95 @@
#[=======================================================================[.rst:
myx_download_content
-----------------------
Функция для загрузки дополнительных репозиториев::
myx_download_content(NAME
[ DOWNLOAD_DIR dir ] |
[ GIT_REPOSITORY url ] |
[ GIT_TAG tag ] |
[ AUTOFETCH ] | [ AUTOPULL ] )
Обязательный параметр: `NAME` - имя целевого каталога.
Параметр `DOWNLOAD_DIR` содержит имя каталога, в который будет загружаться
содержимое (по умолчанию `_downloads`).
Параметр `GIT_REPOSITORY` содержит адрес внешнего проекта, который нужно
загрузить с помощью git.
Параметр `GIT_TAG` содержит используемые метку, идентификатор коммита или
ветку в загружаемом репозитории.
Если указана опция `AUTOFETCH`, то на этапе конфигурирования для загруженного
репозитория будут скачиваться изменения.
Если указана опция `AUTOPULL`, то на этапе конфигурирования из загруженного
репозитория будет изменяться рабочий каталог.
#]=======================================================================]
find_package(Git QUIET)
option(ENABLE_DOWNLOAD_CONTENT "Enable download content" ON)
if(CMAKE_SCRIPT_MODE_FILE)
include(${CMAKE_CURRENT_LIST_DIR}/ProjectIsTopLevel.cmake)
endif()
function(myx_download_content NAME)
set(options AUTOFETCH AUTOPULL)
set(oneValueArgs)
set(multiValueArgs DOWNLOAD_DIR GIT_REPOSITORY GIT_TAG)
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(NOT CMAKE_SCRIPT_MODE_FILE)
if(TARGET myx-download-${NAME})
return()
else()
add_custom_target(myx-download-${NAME})
endif()
if(NOT TARGET myx-download-content)
add_custom_target(myx-download-content)
endif()
endif()
if(NOT PROJECT_IS_TOP_LEVEL)
return()
endif()
if(NOT ARG_DOWNLOAD_DIR)
set(ARG_DOWNLOAD_DIR "_downloads")
endif()
if(CMAKE_SCRIPT_MODE_FILE)
set(PROJECT_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR})
endif()
set(ARG_DOWNLOAD_DIR ${PROJECT_SOURCE_DIR}/${ARG_DOWNLOAD_DIR})
if(NOT IS_DIRECTORY ${ARG_DOWNLOAD_DIR})
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${ARG_DOWNLOAD_DIR})
endif()
set(WORK_DIR "${ARG_DOWNLOAD_DIR}/${NAME}")
if(ENABLE_DOWNLOAD_CONTENT AND GIT_EXECUTABLE AND ARG_GIT_REPOSITORY)
if(NOT IS_DIRECTORY ${WORK_DIR})
execute_process(COMMAND ${GIT_EXECUTABLE} clone ${ARG_GIT_REPOSITORY} ${NAME}
WORKING_DIRECTORY ${ARG_DOWNLOAD_DIR})
else()
if(ARG_AUTOFETCH)
execute_process(COMMAND ${GIT_EXECUTABLE} fetch
WORKING_DIRECTORY ${WORK_DIR})
endif()
endif()
if(ARG_GIT_TAG)
execute_process(COMMAND ${GIT_EXECUTABLE} checkout ${ARG_GIT_TAG}
WORKING_DIRECTORY ${WORK_DIR})
else()
if(ARG_AUTOPULL)
execute_process(COMMAND ${GIT_EXECUTABLE} pull
WORKING_DIRECTORY ${WORK_DIR})
endif()
endif()
endif()
if(NOT CMAKE_SCRIPT_MODE_FILE AND EXISTS "${WORK_DIR}/CMakeLists.txt")
add_subdirectory(${WORK_DIR} EXCLUDE_FROM_ALL)
endif()
endfunction()

View File

@ -0,0 +1,15 @@
include_guard(GLOBAL)
# Установка переменной, определяющей находится ли текущий
# проект на верхнем уровне.
# (Файл перемещён из каталога backports в lib для myx_download_content)
#
if(${CMAKE_VERSION} VERSION_LESS 3.21)
get_property(__parent_directory DIRECTORY PROPERTY PARENT_DIRECTORY)
if(NOT __parent_directory)
set(PROJECT_IS_TOP_LEVEL TRUE)
else()
set(PROJECT_IS_TOP_LEVEL FALSE)
endif()
unset(__parent_directory)
endif()

View File

@ -0,0 +1,31 @@
PROJECT_NAME = @DOXYGEN_PROJECT_TITLE@
OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIRECTORY@
OUTPUT_LANGUAGE = @ARG_LANGUAGE@
STRIP_FROM_PATH = @PROJECT_SOURCE_DIR@
STRIP_FROM_INC_PATH = @PROJECT_SOURCE_DIR@
EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
EXTRACT_STATIC = YES
EXTRACT_LOCAL_METHODS = YES
INPUT = "@PROJECT_SOURCE_DIR@/doc/doxygen" "@PROJECT_SOURCE_DIR@/include" "@PROJECT_SOURCE_DIR@/src"
RECURSIVE = YES
CLANG_ASSISTED_PARSING = YES
CLANG_DATABASE_PATH = @CMAKE_BINARY_DIR@
GENERATE_HTML = @ARG_HTML@
GENERATE_TREEVIEW = YES
GENERATE_LATEX = @ARG_LATEX@
LATEX_CMD_NAME = xelatex
COMPACT_LATEX = YES
GENERATE_XML = @ARG_XML@
UML_LOOK = YES
TEMPLATE_RELATIONS = YES
CALL_GRAPH = YES
CALLER_GRAPH = YES
INTERACTIVE_SVG = YES

View File

@ -0,0 +1,32 @@
cmake_policy(PUSH)
cmake_policy(SET CMP0053 NEW) # IN_LIST operator
set(ARG_PREFIX "${PREFIX}")
set(GIT_REV "N/A")
set(GIT_DIFF "")
set(GIT_TAG "N/A")
set(GIT_BRANCH "N/A")
find_package(Git QUIET)
if(GIT_EXECUTABLE)
execute_process(COMMAND ${GIT_EXECUTABLE} log --pretty=format:'%h' -n 1 OUTPUT_VARIABLE GIT_REV ERROR_QUIET)
# Check whether we got any revision (which isn't always the case,
# e.g. when someone downloaded a zip file from Github instead of a checkout)
if(NOT "${GIT_REV}" STREQUAL "")
execute_process(COMMAND bash -c "${GIT_EXECUTABLE} diff --quiet --exit-code || echo +" OUTPUT_VARIABLE GIT_DIFF)
execute_process(COMMAND ${GIT_EXECUTABLE} describe --exact-match --tags OUTPUT_VARIABLE GIT_TAG ERROR_QUIET)
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD OUTPUT_VARIABLE GIT_BRANCH)
string(STRIP "${GIT_REV}" GIT_REV)
string(SUBSTRING "${GIT_REV}" 1 7 GIT_REV)
string(STRIP "${GIT_DIFF}" GIT_DIFF)
string(STRIP "${GIT_TAG}" GIT_TAG)
string(STRIP "${GIT_BRANCH}" GIT_BRANCH)
endif()
endif()
configure_file("GitInfo.hpp.in" "${GIT_INFO_FILE}")
cmake_policy(POP)

View File

@ -0,0 +1,26 @@
// -*- C++ -*-
#pragma once
#if defined (@PREFIX@GIT_REV)
#error "Duplicate definition of macros @PREFIX@GIT_REV"
#else
#define @PREFIX@GIT_REV "@GIT_REV@"
#endif
#if defined (@PREFIX@GIT_DIFF)
#error "Duplicate definition of macros @PREFIX@GIT_DIFF"
#else
#define @PREFIX@GIT_DIFF "@GIT_DIFF@"
#endif
#if defined (@PREFIX@GIT_BRANCH)
#error "Duplicate definition of macros @PREFIX@GIT_BRANCH"
#else
#define @PREFIX@GIT_BRANCH "@GIT_BRANCH@"
#endif
#if defined (@PREFIX@GIT_TAG)
#error "Duplicate definition of macros @PREFIX@GIT_TAG"
#else
#define @PREFIX@GIT_TAG "@GIT_TAG@"
#endif

View File

@ -0,0 +1,56 @@
#[=======================================================================[.rst:
myx_generate_git_info_header
----------------------------------
Вспомогательная функция для автоматической генерации заголовочного
файла, содержащего информацию о текущем состоянии репозитория git::
myx_generate_git_info_header(TARGET_NAME BASE_FILENAME
[ PREFIX prefix ] )
Обязательные параметры: `TARGET_NAME` - имя цели, с которой связан
заголовочный файл, и `BASE_FILENAME` - имя генерируемого заголовочного
файла. Дополнительный аргумент `PREFIX` добавляет префикс к генерируемым
именам переменных.
#]=======================================================================]
include_guard(GLOBAL)
if(${CMAKE_VERSION} VERSION_LESS "3.17.0")
set(MYX_CMAKE_LIB_GENERATORS_DIR_BACKPORT "${CMAKE_CURRENT_LIST_DIR}")
endif()
function(myx_generate_git_info_header TARGET_NAME BASE_FILENAME)
if(${CMAKE_VERSION} VERSION_LESS "3.17.0")
set(CMAKE_CURRENT_FUNCTION_LIST_DIR ${MYX_CMAKE_LIB_GENERATORS_DIR_BACKPORT})
endif()
set(options)
set(oneValueArgs PREFIX)
set(multiValueArgs)
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
set(__filename "${PROJECT_BINARY_DIR}/include/${BASE_FILENAME}")
file(APPEND ${__filename} "")
set(__prefix "")
if(ARG_PREFIX)
string(APPEND ARG_PREFIX "_")
string(REPLACE "-" "_" __prefix ${ARG_PREFIX})
endif()
# cmake-format: off
if(NOT TARGET ${TARGET_NAME}-git-info-header)
add_custom_target(${TARGET_NAME}-git-info-header ALL
${CMAKE_COMMAND} -DGIT_INFO_FILE=${__filename} -DPREFIX=${__prefix}
-P ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/GitInfo.cmake
BYPRODUCTS ${__filename}
WORKING_DIRECTORY ${CMAKE_CURRENT_FUNCTION_LIST_DIR})
endif()
# cmake-format: on
set_property(TARGET ${TARGET_NAME} APPEND PROPERTY PRIVATE_HEADER_FILES ${__filename})
target_sources(${TARGET_NAME} PRIVATE ${__filename})
add_dependencies(${TARGET_NAME} ${TARGET_NAME}-git-info-header)
endfunction()

View File

@ -0,0 +1,12 @@
// -*- C++ -*-
#pragma once
#define PROJECT_VERSION_STR "@PROJECT_VERSION@"
#define PROJECT_VERSION_INT @PROJECT_VERSION_INT@
#cmakedefine PROJECT_NAME "@PROJECT_NAME@"
#cmakedefine AUTHOR_NAME "@AUTHOR_NAME@"
#cmakedefine AUTHOR_EMAIL "@AUTHOR_EMAIL@"
#cmakedefine DESCRIPTION "@PROJECT_DESCRIPTION@"
#cmakedefine BUILD_TYPE "@CMAKE_BUILD_TYPE@"
#cmakedefine BUILD_DATE "@MYX_TODAY@"

View File

@ -0,0 +1,35 @@
#[=======================================================================[.rst:
myx_generate_private_config_header
----------------------------------
Вспомогательная функция для автоматической генерации заголовочного
файла, содержащего информацию о проекте::
myx_generate_private_config_header(TARGET_NAME BASE_FILENAME)
Обязательные параметры: `TARGET_NAME` - имя цели, с которой связан
заголовочный файл, и `BASE_FILENAME` - имя генерируемого заголовочного файла.
#]=======================================================================]
include_guard(GLOBAL)
if(${CMAKE_VERSION} VERSION_LESS "3.17.0")
set(MYX_CMAKE_LIB_GENERATORS_DIR_BACKPORT "${CMAKE_CURRENT_LIST_DIR}")
endif()
function(myx_generate_private_config_header TARGET_NAME BASE_FILENAME)
if(${CMAKE_VERSION} VERSION_LESS "3.17.0")
set(CMAKE_CURRENT_FUNCTION_LIST_DIR ${MYX_CMAKE_LIB_GENERATORS_DIR_BACKPORT})
endif()
set(BUILD_DATE ${MYX_TODAY})
myx_project_version_int()
get_property(PROJECT_VERSION_INT GLOBAL PROPERTY PROJECT_VERSION_INT)
set(__filename "${PROJECT_BINARY_DIR}/include/${BASE_FILENAME}")
configure_file("${CMAKE_CURRENT_FUNCTION_LIST_DIR}/PrivateConfig.hpp.in" ${__filename})
set_property(TARGET ${TARGET_NAME} APPEND PROPERTY PRIVATE_HEADER_FILES ${__filename})
target_sources(${TARGET_NAME} PRIVATE ${__filename})
endfunction()

View File

@ -0,0 +1,5 @@
@PACKAGE_INIT@
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
check_required_components("@PROJECT_NAME@")

View File

@ -0,0 +1,5 @@
/**
* @class $(fclass)
* @brief TODO
* @details TODO
*/

View File

@ -0,0 +1 @@
// EOF $(filename)

View File

@ -0,0 +1,6 @@
// -*- C++ -*-
/**
* @file $(filename)
* @brief TODO
* @details TODO
*/

View File

@ -0,0 +1,5 @@
/**
* @fn $(fclass)::$(function)
* $(javaparam)
* @details TODO
*/

View File

@ -0,0 +1,31 @@
if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt")
endif(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
foreach(file ${files})
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
exec_program(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
if(NOT "${rm_retval}" STREQUAL 0)
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
endif(NOT "${rm_retval}" STREQUAL 0)
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
endforeach(file)
# Удаление пустых каталогов
foreach(_file ${files})
set(_res 0)
while(_res EQUAL 0)
get_filename_component(_file ${_file} DIRECTORY)
execute_process(COMMAND rmdir ${_file} RESULT_VARIABLE _res OUTPUT_QUIET ERROR_QUIET)
endwhile()
endforeach()

43
cmake/myx_setup.cmake Normal file
View File

@ -0,0 +1,43 @@
#[=======================================================================[.rst:
Подключение дополнительных функций для CMake
По умолчанию предполагается использование версии MyxCMake,
файлы которой находятся в каталоге `cmake/myx` текущего проекта.
Для удобства разработки библиотеки MyxCMake можно указать путь
к её репозиторию с помощью переменной проекта CMake `MYX_CMAKE_DIR`
или переменной окружения `MYX_CMAKE_DIR`.
Если определена переменная `MYX_CMAKE_USE_SYSTEM`, то выполняется
поиск версии в каталогах перечисленных в переменной `CMAKE_MODULES_DIR`.
Кроме того выполняется попытка поиска (MyxxCMake)[../../../../myxx] --
расширения для библиотеки, позволяющего в режиме разработки программного
проекта использовать дополнительные инструменты для его сопровождения.
#]=======================================================================]
if(ENV{MYX_CMAKE_DIR})
set(MYX_CMAKE_DIR $ENV{MYX_CMAKE_DIR})
endif()
if(MYX_CMAKE_DIR)
find_package(MyxCMake 2.4.17 REQUIRED CONFIG PATHS ${MYX_CMAKE_DIR} NO_DEFAULT_PATH)
myx_message_notice("== MyxCMake directory: ${MyxCMake_CONFIG} ==")
else()
if(MYX_CMAKE_USE_SYSTEM)
find_package(MyxCMake 2.4.17 REQUIRED)
myx_message_notice("== MyxCMake directory: ${MyxCMake_CONFIG} ==")
else()
include(${PROJECT_SOURCE_DIR}/cmake/myx/MyxCMakeConfig.cmake)
myx_message_notice("== MyxCMake directory: ${PROJECT_SOURCE_DIR}/cmake/myx ==")
endif()
endif()
if(ENV{MYXX_CMAKE_DIR})
set(MYXX_CMAKE_DIR $ENV{MYXX_CMAKE_DIR})
endif()
if(MYXX_CMAKE_DIR)
find_package(MyxxCMake CONFIG PATHS ${MYXX_CMAKE_DIR} NO_DEFAULT_PATH)
else()
find_package(MyxxCMake CONFIG PATHS "$ENV{XDG_DATA_DIR}/cmake" QUIET)
endif()

45
cmake/package/deb.cmake Normal file
View File

@ -0,0 +1,45 @@
find_program(LSB_RELEASE_EXEC lsb_release)
find_program(DPKG_BUILDPACKAGE dpkg-buildpackage)
if (LSB_RELEASE_EXEC AND DPKG_BUILDPACKAGE)
execute_process(COMMAND env LC_ALL=C date "+%a, %-d %b %Y %H:%M:%S %z"
OUTPUT_VARIABLE DEBIAN_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND /bin/sh "-c" "${LSB_RELEASE_EXEC} -cs"
OUTPUT_VARIABLE DEBIAN_CODENAME OUTPUT_STRIP_TRAILING_WHITESPACE)
set(DEBIAN_RUNTIME_DEPENDS_PLACEHOLDER
"\${shlibs:Depends},\${misc:Depends},\${misc:Pre-Depends}")
if(NOT CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "/usr")
endif()
if(NOT ENABLE_MODEL)
set(ENABLE_MODEL ON)
endif()
configure_file(${CMAKE_SOURCE_DIR}/debian/control.in
${CMAKE_SOURCE_DIR}/debian/control)
configure_file(${CMAKE_SOURCE_DIR}/debian/changelog.in
${CMAKE_SOURCE_DIR}/debian/changelog)
configure_file(${CMAKE_SOURCE_DIR}/debian/rules.in
${CMAKE_SOURCE_DIR}/debian/rules @ONLY)
file(WRITE ${CMAKE_SOURCE_DIR}/debian/compat "10")
if(NOT TARGET deb)
add_custom_target(deb
COMMENT "Build deb package"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMAND ${DPKG_BUILDPACKAGE} -F -uc -us -ui)
endif()
if(NOT TARGET deb-bin)
add_custom_target(deb-bin
COMMENT "Build deb package (only binary)"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMAND ${DPKG_BUILDPACKAGE} -b -uc -us -ui)
endif()
if(NOT TARGET deb-src)
add_custom_target(deb-src
COMMENT "Build deb package (only source)"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMAND ${DPKG_BUILDPACKAGE} -S -uc -us -ui)
endif()
endif()

6
debian/changelog.in vendored Normal file
View File

@ -0,0 +1,6 @@
${PROJECT_NAME} (${PROJECT_VERSION}) ${DEBIAN_CODENAME}; urgency=low
* Version ${PROJECT_VERSION}
-- ${${PROJECT_NAME}_AUTHOR_NAME} <${${PROJECT_NAME}_AUTHOR_EMAIL}> ${DEBIAN_DATE}

16
debian/control.in vendored Normal file
View File

@ -0,0 +1,16 @@
Source: ${PROJECT_NAME}
Section: misc
Priority: optional
Maintainer: ${${PROJECT_NAME}_AUTHOR_NAME} <${${PROJECT_NAME}_AUTHOR_EMAIL}>
Build-Depends: debhelper (>= 9), cmake,
${DEBIAN_BUILD_DEPENDS_PACKAGES},
Standards-Version: 4.6.1
Package: ${PROJECT_NAME}
Architecture: any
Depends: ${DEBIAN_RUNTIME_DEPENDS_PLACEHOLDER},
${DEBIAN_RUNTIME_DEPENDS_PACKAGES},
Description: ${CMAKE_PROJECT_DESCRIPTION}
${CMAKE_PROJECT_DESCRIPTION}
.
This is a build for ${CMAKE_LIBRARY_ARCHITECTURE}

22
debian/rules.in vendored Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/make -f
CMAKE_OPTS:= \
-DENABLE_MODEL=@ENABLE_MODEL@ \
-DCMAKE_INSTALL_PREFIX=@CMAKE_INSTALL_PREFIX@ \
-DCMAKE_INSTALL_SYSCONFDIR=etc \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_INSTALL_DATAROOTDIR=share \
-DCMAKE_BUILD_TYPE=Release
%:
dh $@ --buildsystem=cmake -builddirectory=build --parallel
override_dh_auto_configure:
dh_auto_configure -- $(CMAKE_OPTS)
override_dh_auto_test:
true
override_dh_strip:
dh_strip --no-automatic-dbgsym

1
debian/source/format vendored Normal file
View File

@ -0,0 +1 @@
3.0 (native)

6
debian/source/options vendored Normal file
View File

@ -0,0 +1,6 @@
tar-ignore = ".git"
tar-ignore = "build"
compression = "xz"
compression-level = 9
extend-diff-ignore = "(^l10n\/.*ts)$"

0
files/etc/.gitkeep Normal file
View File

0
files/log/.gitkeep Normal file
View File

0
files/share/.gitkeep Normal file
View File

0
files/var/.gitkeep Normal file
View File

View File

@ -0,0 +1,2 @@
add_subdirectory(../myx-example-interface-library ${CMAKE_BINARY_DIR}/myx-example-interface-library EXCLUDE_FROM_ALL)
add_subdirectory(../myx-example-object-library ${CMAKE_BINARY_DIR}/myx-example-object-library EXCLUDE_FROM_ALL)

View File

@ -0,0 +1,14 @@
# Подключение файла с функцией для загрузки содержимого
# командой cmake в режиме запуска скриптов. Пример команды:
#
# cmake -P myx_download_content.cmake
#
if(CMAKE_SCRIPT_MODE_FILE)
include("cmake/myx/lib/DownloadContent.cmake")
endif()
myx_download_content(myx-example-interface-library
GIT_REPOSITORY git@gitlab.2:myx/examples/myx-example-interface-library)
myx_download_content(myx-example-object-library
GIT_REPOSITORY git@gitlab.2:myx/examples/myx-example-object-library)

View File

@ -0,0 +1,15 @@
# Название основной цели и имени программы в текущем каталоге
project(myx-cmake-example-app-ext)
# Список файлов исходных текстов
set(CPP ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp)
# Функция для создания цели, результатом которой будет сборка приложения
add_executable(${PROJECT_NAME} ${CPP})
myx_cmake_common_target_properties(${PROJECT_NAME})
# Зависимость от библиотеки из внешнего проекта
add_dependencies(${PROJECT_NAME} extlib)
# Компоновка с библиотекой из внешнего проекта
target_link_libraries(${PROJECT_NAME} myx-cmake-example-library)

View File

@ -0,0 +1,18 @@
#include "config_p.hpp"
#include "git_info_p.hpp"
#include <myx-example-interface-library/sum.hpp>
#include <myx-example-object-library/init.hpp>
#include <iostream>
int main( int argc, char* argv[] )
{
auto s = sum( PROJECT_VERSION_INT % 3, PROJECT_VERSION_INT % 5 );
auto i = init( argc );
std::cout << "Value: " << ( s + i ) << std::endl;
std::cout << "Git branch: " << GIT_BRANCH << std::endl;
return ( 0 );
}

3641
uncrustify.cfg Normal file

File diff suppressed because it is too large Load Diff