1.99.97
This commit is contained in:
parent
28b208ae6f
commit
038e650809
1
Makefile
1
Makefile
@ -7,6 +7,7 @@ PACK_DIR:=$(BUILD_DIR)/pack/myx-cmake-$(V)
|
||||
all: update_version deb pack
|
||||
|
||||
update_version:
|
||||
sed -i "s/VERSION/$V/" $(TOP_DIR)/README.md
|
||||
sed -i "s/CMake.*REQUIRED/CMake $V REQUIRED/" $(TOP_DIR)/README.md $(TOP_DIR)/myx_setup.cmake
|
||||
sed -i "s/VERSION \".*\"/VERSION \"$V\"/" $(TOP_DIR)/MyxCMake/MyxCMakeConfigVersion.cmake
|
||||
sed -i "s/VERSION .* LANG/VERSION $V LANG/" $(TOP_DIR)/debian/CMakeLists.txt
|
||||
|
@ -6,8 +6,11 @@ list(INSERT CMAKE_MODULE_PATH 0 "${PROJECT_SOURCE_DIR}/cmake/find")
|
||||
|
||||
get_filename_component(MYX_CMAKE_SOURCE_DIR "${CMAKE_CURRENT_LIST_FILE}" DIRECTORY)
|
||||
|
||||
set(MYX_CMAKE_BACKPORTS_DIR "${MYX_CMAKE_SOURCE_DIR}/backports" CACHE PATH "")
|
||||
set(MYX_CMAKE_LIB_DIR "${MYX_CMAKE_SOURCE_DIR}/lib" CACHE PATH "")
|
||||
#set(MYX_CMAKE_BACKPORTS_DIR "${MYX_CMAKE_SOURCE_DIR}/backports" CACHE PATH "")
|
||||
#set(MYX_CMAKE_LIB_DIR "${MYX_CMAKE_SOURCE_DIR}/lib" CACHE PATH "")
|
||||
|
||||
set(MYX_CMAKE_BACKPORTS_DIR "${MYX_CMAKE_SOURCE_DIR}/backports")
|
||||
set(MYX_CMAKE_LIB_DIR "${MYX_CMAKE_SOURCE_DIR}/lib")
|
||||
|
||||
include(${MYX_CMAKE_BACKPORTS_DIR}/IncludeGuard.cmake)
|
||||
include(${MYX_CMAKE_BACKPORTS_DIR}/TopLevelProject.cmake)
|
||||
|
@ -1,4 +1,4 @@
|
||||
set(MYX_CMAKE_PACKAGE_VERSION "1.99.94")
|
||||
set(MYX_CMAKE_PACKAGE_VERSION "1.99.97")
|
||||
if(MYX_CMAKE_PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else()
|
||||
|
@ -22,11 +22,18 @@ include_guard(GLOBAL)
|
||||
include(CMakePackageConfigHelpers)
|
||||
include(GenerateExportHeader)
|
||||
|
||||
if(${CMAKE_VERSION} VERSION_LESS "3.17.0")
|
||||
set(MYX_CMAKE_LIB_DIR_BACKPORT "${CMAKE_CURRENT_LIST_DIR}")
|
||||
endif()
|
||||
|
||||
function(myx_add_library NAME TYPE)
|
||||
if(${CMAKE_VERSION} VERSION_LESS "3.17.0")
|
||||
set(CMAKE_CURRENT_FUNCTION_LIST_DIR ${MYX_CMAKE_LIB_DIR_BACKPORT})
|
||||
endif()
|
||||
|
||||
set(options)
|
||||
set(oneValueArgs OUTPUT_NAME EXPORT_FILE_NAME EXPORT_BASE_NAME)
|
||||
set(multiValueArgs)
|
||||
|
||||
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
if(NOT ARG_OUTPUT_NAME)
|
||||
@ -136,7 +143,7 @@ function(myx_add_library NAME TYPE)
|
||||
)
|
||||
|
||||
configure_package_config_file(
|
||||
${MYX_CMAKE_LIB_DIR}/library-config.cmake.in
|
||||
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/library-config.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${NAME}Config.cmake
|
||||
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${NAME}
|
||||
NO_SET_AND_CHECK_MACRO
|
||||
|
@ -71,12 +71,14 @@ function(myx_uncrustify target)
|
||||
add_custom_target(myx-uncrustify-append-comments)
|
||||
endif()
|
||||
|
||||
get_target_property(__sources ${target} SOURCES)
|
||||
list(FILTER __sources EXCLUDE REGEX "qrc_.*\\.cpp$")
|
||||
list(FILTER __sources EXCLUDE REGEX "moc_.*\\.cpp$")
|
||||
list(FILTER __sources EXCLUDE REGEX "ui_.*\\.h$")
|
||||
list(FILTER __sources EXCLUDE REGEX ".*\\.qm$")
|
||||
|
||||
# Динамически сгенерированные файлы исключаются
|
||||
get_target_property(s ${target} SOURCES)
|
||||
foreach(iter ${s})
|
||||
string(FIND ${iter} ${CMAKE_BINARY_DIR} pos)
|
||||
if(pos EQUAL -1)
|
||||
list(APPEND src ${iter})
|
||||
endif()
|
||||
endforeach()
|
||||
add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/uncrustify-${target}.cfg
|
||||
COMMAND ${UNCRUSTIFY_EXE} --update-config-with-doc
|
||||
-c ${ARG_CONFIG}
|
||||
@ -85,12 +87,12 @@ function(myx_uncrustify target)
|
||||
# cmake-format: off
|
||||
add_custom_target(${target}-uncrustify-check
|
||||
DEPENDS ${PROJECT_BINARY_DIR}/uncrustify-${target}.cfg
|
||||
COMMAND ${UNCRUSTIFY_EXE} ${UNCRUSTIFY_OPTS} --check ${__sources})
|
||||
COMMAND ${UNCRUSTIFY_EXE} ${UNCRUSTIFY_OPTS} --check ${src})
|
||||
|
||||
list(APPEND UNCRUSTIFY_OPTS --replace --no-backup)
|
||||
add_custom_target(${target}-uncrustify
|
||||
DEPENDS ${PROJECT_BINARY_DIR}/uncrustify-${target}.cfg
|
||||
COMMAND ${UNCRUSTIFY_EXE} ${UNCRUSTIFY_OPTS} --mtime ${__sources})
|
||||
COMMAND ${UNCRUSTIFY_EXE} ${UNCRUSTIFY_OPTS} --mtime ${src})
|
||||
|
||||
add_custom_target(${target}-uncrustify-append-comments
|
||||
DEPENDS ${PROJECT_BINARY_DIR}/uncrustify-${target}.cfg
|
||||
@ -99,7 +101,7 @@ function(myx_uncrustify target)
|
||||
--set cmt_insert_file_footer=${PROJECT_BINARY_DIR}/uncrustify-filefooter.txt
|
||||
--set cmt_insert_file_header=${PROJECT_BINARY_DIR}/uncrustify-fileheader.txt
|
||||
--set cmt_insert_func_header=${PROJECT_BINARY_DIR}/uncrustify-funcheader.txt
|
||||
--set cmt_insert_before_ctor_dtor=true --mtime ${__sources})
|
||||
--set cmt_insert_before_ctor_dtor=true --mtime ${src})
|
||||
# cmake-format: on
|
||||
|
||||
add_dependencies(myx-uncrustify ${target}-uncrustify)
|
||||
|
@ -1,6 +1,14 @@
|
||||
include_guard(GLOBAL)
|
||||
|
||||
if(${CMAKE_VERSION} VERSION_LESS "3.17.0")
|
||||
set(MYX_CMAKE_LIB_DOC_DIR_BACKPORT "${CMAKE_CURRENT_LIST_DIR}")
|
||||
endif()
|
||||
|
||||
function(myx_doc_doxygen NAME)
|
||||
if(${CMAKE_VERSION} VERSION_LESS "3.17.0")
|
||||
set(CMAKE_CURRENT_FUNCTION_LIST_DIR ${MYX_CMAKE_LIB_DOC_DIR_BACKPORT})
|
||||
endif()
|
||||
|
||||
find_package(Doxygen)
|
||||
if(DOXYGEN_FOUND)
|
||||
set(DOXYGEN_FOUND ON CACHE STRING "Doxygen documentation generator enabled" FORCE)
|
||||
@ -39,7 +47,7 @@ function(myx_doc_doxygen NAME)
|
||||
set(ARG_LANGUAGE "Russian")
|
||||
endif()
|
||||
if(NOT ARG_DOXYFILE_TEMPLATE OR NOT EXISTS "${ARG_DOXYFILE_TEMPLATE}")
|
||||
set(ARG_DOXYFILE_TEMPLATE "${MYX_CMAKE_LIB_DIR}/doc/Doxyfile.in")
|
||||
set(ARG_DOXYFILE_TEMPLATE "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/Doxyfile.in")
|
||||
endif()
|
||||
if(NOT DOXYGEN_PROJECT_NAME)
|
||||
set(DOXYGEN_PROJECT_NAME ${PROJECT_NAME})
|
||||
|
@ -1,3 +1,4 @@
|
||||
// -*- C++ -*-
|
||||
#pragma once
|
||||
|
||||
#if defined (@PREFIX@GIT_REV)
|
||||
|
@ -16,11 +16,18 @@ myx_generate_git_info_header
|
||||
|
||||
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 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}")
|
||||
@ -35,9 +42,9 @@ function(myx_generate_git_info_header target base_filename)
|
||||
if(NOT TARGET ${target}-git-info-header)
|
||||
add_custom_target(${target}-git-info-header ALL
|
||||
${CMAKE_COMMAND} -DGIT_INFO_FILE=${filename} -DPREFIX=${PREFIX}
|
||||
-P ${MYX_CMAKE_LIB_DIR}/generators/GitInfo.cmake
|
||||
-P ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/GitInfo.cmake
|
||||
BYPRODUCTS ${filename}
|
||||
WORKING_DIRECTORY ${MYX_CMAKE_LIB_DIR}/generators)
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_FUNCTION_LIST_DIR})
|
||||
endif()
|
||||
# cmake-format: on
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
// -*- C++ -*-
|
||||
#pragma once
|
||||
|
||||
#define PROJECT_VERSION_STR "@PROJECT_VERSION@"
|
||||
|
@ -14,13 +14,21 @@ myx_generate_private_config_header
|
||||
|
||||
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 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("${MYX_CMAKE_LIB_DIR}/generators/PrivateConfig.hpp.in" ${filename})
|
||||
configure_file("${CMAKE_CURRENT_FUNCTION_LIST_DIR}/PrivateConfig.hpp.in" ${filename})
|
||||
|
||||
set_property(TARGET ${target} APPEND PROPERTY PRIVATE_HEADER_FILES ${filename})
|
||||
target_sources(${target} PRIVATE ${filename})
|
||||
|
39
README.md
39
README.md
@ -1,9 +1,10 @@
|
||||
# Библиотека дополнительных фукций для CMake
|
||||
# Библиотека дополнительных функций для CMake
|
||||
|
||||
## Установка
|
||||
|
||||
В корневом каталоге проекта создать каталог `cmake/myx` и распаковать
|
||||
в него архив проекта, который можно скачать [здесь](../../../releases).
|
||||
В корневом каталоге проекта создать каталог `cmake` и
|
||||
распаковать в него архив myx-cmake-local-1.99.97.tar.xz,
|
||||
который можно скачать [здесь](../../../releases).
|
||||
|
||||
## Использование
|
||||
|
||||
@ -14,35 +15,3 @@
|
||||
# Рекомендуемый способ подключения MyxCMake
|
||||
include(cmake/myx_setup.cmake)
|
||||
```
|
||||
|
||||
Создать файл `cmake/myx_setup.cmake`:
|
||||
|
||||
```cmake
|
||||
#[=======================================================================[.rst:
|
||||
Подключение дополнительных функций для CMake
|
||||
|
||||
По умолчанию предполагается использование версии MyxCMake,
|
||||
файлы которой находятся в каталоге `cmake/myx` текущего проекта.
|
||||
|
||||
Для удобства разботки библиотеки MyxCMake можно указать путь
|
||||
к её репозиторию с помощью переменной проекта CMake `MYX_CMAKE_DIR`
|
||||
или переменной окружения `MYX_CMAKE_DIR`.
|
||||
|
||||
Если определена переменная `MYX_CMAKE_USE_SYSTEM`, то выполняется
|
||||
поиск версии в каталогах перечисленных в переменной `CMAKE_MODULES_DIR`.
|
||||
#]=======================================================================]
|
||||
|
||||
if(MYX_CMAKE_DIR)
|
||||
set(ENV{MYX_CMAKE_DIR} ${MYX_CMAKE_DIR})
|
||||
endif()
|
||||
if(DEFINED ENV{MYX_CMAKE_DIR})
|
||||
find_package(MyxCMake 1.99.94 REQUIRED)
|
||||
else()
|
||||
if(MYX_CMAKE_USE_SYSTEM)
|
||||
find_package(MyxCMake 1.99.94 REQUIRED)
|
||||
else()
|
||||
include(${PROJECT_SOURCE_DIR}/cmake/myx/MyxCMakeConfig.cmake)
|
||||
endif()
|
||||
endif()
|
||||
```
|
||||
|
||||
|
2
debian/CMakeLists.txt
vendored
2
debian/CMakeLists.txt
vendored
@ -1,5 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.6 FATAL_ERROR)
|
||||
project(myx-cmake VERSION 1.99.94 LANGUAGES)
|
||||
project(myx-cmake VERSION 1.99.97 LANGUAGES)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
file(WRITE ${CMAKE_SOURCE_DIR}/MyxCMake/MyxCMakeConfigVersion.cmake
|
||||
|
2
debian/changelog
vendored
2
debian/changelog
vendored
@ -1,4 +1,4 @@
|
||||
myx-cmake (1.99.94) unstable; urgency=medium
|
||||
myx-cmake (1.99.97) unstable; urgency=medium
|
||||
|
||||
* New version.
|
||||
|
||||
|
@ -10,17 +10,21 @@
|
||||
|
||||
Если определена переменная `MYX_CMAKE_USE_SYSTEM`, то выполняется
|
||||
поиск версии в каталогах перечисленных в переменной `CMAKE_MODULES_DIR`.
|
||||
|
||||
Кроме того выполняется попытка поиска (MyxxCMake)[../../../../myxx] --
|
||||
расширения для библиотеки, позволяющиего в режиме разработки программного
|
||||
проекта использовать дополнительные инструменты для его сопровождения.
|
||||
#]=======================================================================]
|
||||
|
||||
if(MYX_CMAKE_DIR)
|
||||
set(ENV{MYX_CMAKE_DIR} ${MYX_CMAKE_DIR})
|
||||
endif()
|
||||
if(DEFINED ENV{MYX_CMAKE_DIR})
|
||||
find_package(MyxCMake 1.99.94 REQUIRED CONFIG PATHS $ENV{MYX_CMAKE_DIR} NO_DEFAULT_PATH)
|
||||
find_package(MyxCMake 1.99.97 REQUIRED CONFIG PATHS $ENV{MYX_CMAKE_DIR} NO_DEFAULT_PATH)
|
||||
myx_message_notice("=== MyxCMake directory: ${MyxCMake_CONFIG} ===")
|
||||
else()
|
||||
if(MYX_CMAKE_USE_SYSTEM)
|
||||
find_package(MyxCMake 1.99.94 REQUIRED)
|
||||
find_package(MyxCMake 1.99.97 REQUIRED)
|
||||
myx_message_notice("=== MyxCMake directory: ${MyxCMake_CONFIG} ===")
|
||||
else()
|
||||
include(${PROJECT_SOURCE_DIR}/cmake/myx/MyxCMakeConfig.cmake)
|
||||
@ -28,3 +32,5 @@ else()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_package(MyxxCMake CONFIG PATHS "$ENV{XDG_DATA_DIR}/cmake" QUIET)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user