update
This commit is contained in:
parent
e3adedcf86
commit
08b5271e5a
@ -21,5 +21,5 @@ myx_target_setup(${PROJECT_NAME}
|
|||||||
${PROJECT_SOURCE_DIR}/src/${PROJECT_NAME}/init.cpp
|
${PROJECT_SOURCE_DIR}/src/${PROJECT_NAME}/init.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
# Форматирование кода с помощью uncrustify
|
# Форматирование исходных текстов с помощью uncrustify
|
||||||
myx_uncrustify(${PROJECT_NAME})
|
myx_uncrustify(${PROJECT_NAME})
|
||||||
|
@ -6,19 +6,28 @@ list(INSERT CMAKE_MODULE_PATH 0 "${PROJECT_SOURCE_DIR}/cmake/find")
|
|||||||
|
|
||||||
get_filename_component(MYX_CMAKE_SOURCE_DIR "${CMAKE_CURRENT_LIST_FILE}" DIRECTORY)
|
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")
|
set(MYX_CMAKE_BACKPORTS_DIR "${MYX_CMAKE_SOURCE_DIR}/backports")
|
||||||
set(MYX_CMAKE_LIB_DIR "${MYX_CMAKE_SOURCE_DIR}/lib")
|
set(MYX_CMAKE_LIB_DIR "${MYX_CMAKE_SOURCE_DIR}/lib")
|
||||||
|
|
||||||
include(${MYX_CMAKE_LIB_DIR}/macro/FindPackages.cmake)
|
|
||||||
include(${MYX_CMAKE_LIB_DIR}/macro/InstallRelative.cmake)
|
|
||||||
|
|
||||||
include(${MYX_CMAKE_BACKPORTS_DIR}/IncludeGuard.cmake)
|
include(${MYX_CMAKE_BACKPORTS_DIR}/IncludeGuard.cmake)
|
||||||
include(${MYX_CMAKE_BACKPORTS_DIR}/TopLevelProject.cmake)
|
include(${MYX_CMAKE_BACKPORTS_DIR}/TopLevelProject.cmake)
|
||||||
if(${CMAKE_VERSION} VERSION_LESS "3.11.0")
|
if(${CMAKE_VERSION} VERSION_LESS "3.11.0")
|
||||||
include(${MYX_CMAKE_BACKPORTS_DIR}/FetchContent.cmake)
|
include(${MYX_CMAKE_BACKPORTS_DIR}/FetchContent.cmake)
|
||||||
|
else()
|
||||||
|
include(FetchContent)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(${MYX_CMAKE_LIB_DIR}/Includes.cmake)
|
include(GNUInstallDirs)
|
||||||
|
include(CMakeDependentOption)
|
||||||
|
|
||||||
|
include(${MYX_CMAKE_LIB_DIR}/macro/CreateSymlink.cmake)
|
||||||
|
include(${MYX_CMAKE_LIB_DIR}/macro/FindPackages.cmake)
|
||||||
|
include(${MYX_CMAKE_LIB_DIR}/macro/InstallRelative.cmake)
|
||||||
|
|
||||||
|
include(${MYX_CMAKE_LIB_DIR}/PopulateCMakeBinaryDir.cmake)
|
||||||
include(${MYX_CMAKE_LIB_DIR}/CurrentDate.cmake)
|
include(${MYX_CMAKE_LIB_DIR}/CurrentDate.cmake)
|
||||||
include(${MYX_CMAKE_LIB_DIR}/ColoredMessages.cmake)
|
include(${MYX_CMAKE_LIB_DIR}/ColoredMessages.cmake)
|
||||||
include(${MYX_CMAKE_LIB_DIR}/NinjaGeneratorWarning.cmake)
|
include(${MYX_CMAKE_LIB_DIR}/NinjaGeneratorWarning.cmake)
|
||||||
@ -27,14 +36,16 @@ include(${MYX_CMAKE_LIB_DIR}/SemanticProjectVersion.cmake)
|
|||||||
include(${MYX_CMAKE_LIB_DIR}/NinjaGeneratorWrapper.cmake)
|
include(${MYX_CMAKE_LIB_DIR}/NinjaGeneratorWrapper.cmake)
|
||||||
include(${MYX_CMAKE_LIB_DIR}/FetchContentAdd.cmake)
|
include(${MYX_CMAKE_LIB_DIR}/FetchContentAdd.cmake)
|
||||||
|
|
||||||
|
include(${MYX_CMAKE_LIB_DIR}/AddExecutable.cmake)
|
||||||
include(${MYX_CMAKE_LIB_DIR}/AddLibrary.cmake)
|
include(${MYX_CMAKE_LIB_DIR}/AddLibrary.cmake)
|
||||||
include(${MYX_CMAKE_LIB_DIR}/TargetSetup.cmake)
|
include(${MYX_CMAKE_LIB_DIR}/TargetSetup.cmake)
|
||||||
include(${MYX_CMAKE_LIB_DIR}/Qt5TargetSetup.cmake)
|
include(${MYX_CMAKE_LIB_DIR}/Qt5TargetSetup.cmake)
|
||||||
|
|
||||||
include(${MYX_CMAKE_LIB_DIR}/Uncrustify.cmake)
|
include(${MYX_CMAKE_LIB_DIR}/uncrustify/Uncrustify.cmake)
|
||||||
|
include(${MYX_CMAKE_LIB_DIR}/doc/Doxygen.cmake)
|
||||||
|
|
||||||
include(${MYX_CMAKE_LIB_DIR}/generators/GitInfoHeader.cmake)
|
|
||||||
include(${MYX_CMAKE_LIB_DIR}/generators/PrivateConfigHeader.cmake)
|
include(${MYX_CMAKE_LIB_DIR}/generators/PrivateConfigHeader.cmake)
|
||||||
|
include(${MYX_CMAKE_LIB_DIR}/generators/GitInfoHeader.cmake)
|
||||||
|
|
||||||
unset(MYX_CMAKE_SOURCE_DIR)
|
unset(MYX_CMAKE_SOURCE_DIR)
|
||||||
unset(MYX_CMAKE_BACKPORTS_DIR)
|
unset(MYX_CMAKE_BACKPORTS_DIR)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
set(MYX_CMAKE_PACKAGE_VERSION "1.99.77")
|
set(MYX_CMAKE_PACKAGE_VERSION "1.99.99")
|
||||||
if(MYX_CMAKE_PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
if(MYX_CMAKE_PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
||||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||||
else()
|
else()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
include_guard(GLOBAL)
|
include_guard(GLOBAL)
|
||||||
|
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.21)
|
if(${CMAKE_VERSION} VERSION_LESS 3.21)
|
||||||
get_property(nt DIRECTORY PROPERTY PARENT_DIRECTORY)
|
get_property(nt DIRECTORY PROPERTY PARENT_DIRECTORY)
|
||||||
if(NOT nt)
|
if(NOT nt)
|
||||||
set(PROJECT_IS_TOP_LEVEL true)
|
set(PROJECT_IS_TOP_LEVEL true)
|
||||||
|
22
cmake/myx/lib/AddExecutable.cmake
Normal file
22
cmake/myx/lib/AddExecutable.cmake
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#[=======================================================================[.rst:
|
||||||
|
myx_add_executable
|
||||||
|
------------------
|
||||||
|
|
||||||
|
Вспомогательная функция для создания исполняемого файла::
|
||||||
|
|
||||||
|
myx_add_executable(NAME)
|
||||||
|
|
||||||
|
Используется для совместимости с версиями CMake раньше 3.11,
|
||||||
|
в которых было необходимо указать хотя бы один файл с исходными текстами.
|
||||||
|
|
||||||
|
#]=======================================================================]
|
||||||
|
|
||||||
|
include_guard(GLOBAL)
|
||||||
|
|
||||||
|
function(myx_add_executable NAME)
|
||||||
|
if(${CMAKE_VERSION} VERSION_LESS "3.11.0")
|
||||||
|
add_executable(${NAME} ${ARGN} "")
|
||||||
|
else()
|
||||||
|
add_executable(${NAME} ${ARGN})
|
||||||
|
endif()
|
||||||
|
endfunction()
|
@ -19,20 +19,21 @@ myx_add_library
|
|||||||
|
|
||||||
include_guard(GLOBAL)
|
include_guard(GLOBAL)
|
||||||
|
|
||||||
# Переменная `CMAKE_CURRENT_FUNCTION_LIST_DIR` позволяет определить
|
|
||||||
# каталог файла.
|
|
||||||
if(${CMAKE_VERSION} VERSION_LESS "3.17.0")
|
|
||||||
set(CMAKE_CURRENT_FUNCTION_LIST_DIR ${CMAKE_CURRENT_LIST_DIR})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include(CMakePackageConfigHelpers)
|
include(CMakePackageConfigHelpers)
|
||||||
include(GenerateExportHeader)
|
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)
|
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(options)
|
||||||
set(oneValueArgs OUTPUT_NAME EXPORT_FILE_NAME EXPORT_BASE_NAME)
|
set(oneValueArgs OUTPUT_NAME EXPORT_FILE_NAME EXPORT_BASE_NAME)
|
||||||
set(multiValueArgs)
|
set(multiValueArgs)
|
||||||
|
|
||||||
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
|
|
||||||
if(NOT ARG_OUTPUT_NAME)
|
if(NOT ARG_OUTPUT_NAME)
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
include_guard(GLOBAL)
|
|
||||||
|
|
||||||
include(FetchContent)
|
|
||||||
include(GNUInstallDirs)
|
|
||||||
include(CMakeDependentOption)
|
|
15
cmake/myx/lib/PopulateCMakeBinaryDir.cmake
Normal file
15
cmake/myx/lib/PopulateCMakeBinaryDir.cmake
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
include_guard(GLOBAL)
|
||||||
|
|
||||||
|
# Создание в каталоге ${CMAKE_BINARY_DIR} стандартных каталогов bin,include,lib,
|
||||||
|
# а также символических ссылок на каталоги в ${CMAKE_SOURCE_DIR}/files
|
||||||
|
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||||
|
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/include)
|
||||||
|
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||||
|
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
|
||||||
|
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/include)
|
||||||
|
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
|
||||||
|
|
||||||
|
create_symlink("${CMAKE_SOURCE_DIR}/files/etc" "${CMAKE_BINARY_DIR}/etc")
|
||||||
|
create_symlink("${CMAKE_SOURCE_DIR}/files/log" "${CMAKE_BINARY_DIR}/log")
|
||||||
|
create_symlink("${CMAKE_SOURCE_DIR}/files/share" "${CMAKE_BINARY_DIR}/share")
|
||||||
|
create_symlink("${CMAKE_SOURCE_DIR}/files/var" "${CMAKE_BINARY_DIR}/var")
|
@ -36,7 +36,7 @@ function(myx_target_setup NAME)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ARG_PCH)
|
if(ARG_PCH)
|
||||||
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.16 AND PROJECT_IS_TOP_LEVEL OR MYX_USE_LOCAL_DIRECTORIES)
|
if((${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.16) AND (PROJECT_IS_TOP_LEVEL OR MYX_USE_LOCAL_DIRECTORIES))
|
||||||
target_precompile_headers(${NAME} PRIVATE ${ARG_PCH})
|
target_precompile_headers(${NAME} PRIVATE ${ARG_PCH})
|
||||||
else()
|
else()
|
||||||
target_compile_options(${NAME} PRIVATE -include ${ARG_PCH})
|
target_compile_options(${NAME} PRIVATE -include ${ARG_PCH})
|
||||||
@ -44,10 +44,6 @@ function(myx_target_setup NAME)
|
|||||||
set_property(TARGET ${NAME} APPEND PROPERTY PRIVATE_HEADER_FILES "${ARG_PCH}")
|
set_property(TARGET ${NAME} APPEND PROPERTY PRIVATE_HEADER_FILES "${ARG_PCH}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT IS_DIRECTORY "${PROJECT_BINARY_DIR}/include")
|
|
||||||
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/include")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT target_type STREQUAL "INTERFACE_LIBRARY")
|
if(NOT target_type STREQUAL "INTERFACE_LIBRARY")
|
||||||
target_include_directories(${PROJECT_NAME} PRIVATE
|
target_include_directories(${PROJECT_NAME} PRIVATE
|
||||||
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>)
|
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>)
|
||||||
@ -77,7 +73,9 @@ function(myx_target_setup NAME)
|
|||||||
target_sources(${NAME} PUBLIC $<BUILD_INTERFACE:${ARG_INTERFACE_HEADERS}>)
|
target_sources(${NAME} PUBLIC $<BUILD_INTERFACE:${ARG_INTERFACE_HEADERS}>)
|
||||||
target_sources(${NAME} PUBLIC ${ARG_PUBLIC_HEADERS})
|
target_sources(${NAME} PUBLIC ${ARG_PUBLIC_HEADERS})
|
||||||
target_sources(${NAME} PRIVATE ${ARG_CPP} ${ARG_PCH} ${ARG_PRIVATE_HEADERS})
|
target_sources(${NAME} PRIVATE ${ARG_CPP} ${ARG_PCH} ${ARG_PRIVATE_HEADERS})
|
||||||
target_link_libraries(${NAME} PRIVATE ${ARG_LINK_LIBRARIES})
|
if(NOT target_type STREQUAL "OBJECT_LIBRARY")
|
||||||
|
target_link_libraries(${NAME} PRIVATE ${ARG_LINK_LIBRARIES})
|
||||||
|
endif()
|
||||||
target_compile_definitions(${NAME} PRIVATE ${ARG_COMPILE_DEFINITIONS})
|
target_compile_definitions(${NAME} PRIVATE ${ARG_COMPILE_DEFINITIONS})
|
||||||
|
|
||||||
# Установка публичных заголовочных файлов
|
# Установка публичных заголовочных файлов
|
||||||
|
31
cmake/myx/lib/doc/Doxyfile.in
Normal file
31
cmake/myx/lib/doc/Doxyfile.in
Normal 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
|
73
cmake/myx/lib/doc/Doxygen.cmake
Normal file
73
cmake/myx/lib/doc/Doxygen.cmake
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
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)
|
||||||
|
set(DOXYGEN_EXECUTABLE "${DOXYGEN_EXECUTABLE}" CACHE STRING "Path to Doxygen executable")
|
||||||
|
else()
|
||||||
|
set(DOXYGEN_FOUND OFF CACHE STRING "Doxygen documentation generator disabled" FORCE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(target "myx-doc-doxygen-${NAME}")
|
||||||
|
if(NOT DOXYGEN_FOUND)
|
||||||
|
add_custom_target(${target} VERBATIM COMMENT "Doxygen is not found. Skipping target ${target} build")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(TARGET ${target})
|
||||||
|
myx_message_warning("Target ${target} already defined")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(options)
|
||||||
|
set(oneValueArgs HTML LATEX XML LANGUAGE DOXYFILE_TEMPLATE)
|
||||||
|
set(multiValueArgs)
|
||||||
|
|
||||||
|
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
|
|
||||||
|
if(NOT ARG_HTML)
|
||||||
|
set(ARG_HTML NO)
|
||||||
|
endif()
|
||||||
|
if(NOT ARG_LATEX)
|
||||||
|
set(ARG_LATEX NO)
|
||||||
|
endif()
|
||||||
|
if(NOT ARG_XML)
|
||||||
|
set(ARG_XML YES)
|
||||||
|
endif()
|
||||||
|
if(NOT ARG_LANGUAGE)
|
||||||
|
set(ARG_LANGUAGE "Russian")
|
||||||
|
endif()
|
||||||
|
if(NOT ARG_DOXYFILE_TEMPLATE OR NOT EXISTS "${ARG_DOXYFILE_TEMPLATE}")
|
||||||
|
set(ARG_DOXYFILE_TEMPLATE "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/Doxyfile.in")
|
||||||
|
endif()
|
||||||
|
if(NOT DOXYGEN_PROJECT_NAME)
|
||||||
|
set(DOXYGEN_PROJECT_NAME ${PROJECT_NAME})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(work_dir ${PROJECT_BINARY_DIR}/doc/doxygen)
|
||||||
|
configure_file(${ARG_DOXYFILE_TEMPLATE} ${work_dir}/Doxyfile @ONLY)
|
||||||
|
|
||||||
|
add_custom_target(${target}
|
||||||
|
VERBATIM
|
||||||
|
WORKING_DIRECTORY ${work_dir}
|
||||||
|
COMMAND ${DOXYGEN_EXECUTABLE} ${work_dir}/Doxyfile
|
||||||
|
COMMENT "Generating API documentation with Doxygen")
|
||||||
|
if(ARG_HTML)
|
||||||
|
install(DIRECTORY ${CMAKE_BINARY_DIR}/doc/doxygen/html/
|
||||||
|
COMPONENT doc OPTIONAL
|
||||||
|
DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/doxygen)
|
||||||
|
endif()
|
||||||
|
if(NOT TARGET myx-doc-doxygen)
|
||||||
|
add_custom_target(myx-doc-doxygen)
|
||||||
|
endif()
|
||||||
|
add_dependencies(myx-doc-doxygen ${target})
|
||||||
|
endfunction()
|
32
cmake/myx/lib/generators/GitInfo.cmake
Normal file
32
cmake/myx/lib/generators/GitInfo.cmake
Normal 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)
|
||||||
|
|
||||||
|
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)
|
26
cmake/myx/lib/generators/GitInfo.hpp.in
Normal file
26
cmake/myx/lib/generators/GitInfo.hpp.in
Normal 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
|
@ -16,88 +16,35 @@ myx_generate_git_info_header
|
|||||||
|
|
||||||
include_guard(GLOBAL)
|
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)
|
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(options)
|
||||||
set(oneValueArgs PREFIX)
|
set(oneValueArgs PREFIX)
|
||||||
set(multiValueArgs)
|
set(multiValueArgs)
|
||||||
|
|
||||||
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
|
|
||||||
if(ARG_PREFIX)
|
|
||||||
string(APPEND ARG_PREFIX "_")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(filename "${PROJECT_BINARY_DIR}/include/${base_filename}")
|
set(filename "${PROJECT_BINARY_DIR}/include/${base_filename}")
|
||||||
|
|
||||||
set(git_info_hpp_in
|
set(PREFIX "")
|
||||||
"#pragma once
|
if(ARG_PREFIX)
|
||||||
|
string(APPEND ARG_PREFIX "_")
|
||||||
#if defined (@ARG_PREFIX@GIT_REV)
|
string(REPLACE "-" "_" PREFIX ${ARG_PREFIX})
|
||||||
#error \"Duplicate definition of macros @ARG_PREFIX@GIT_REV\"
|
|
||||||
#else
|
|
||||||
#define @ARG_PREFIX@GIT_REV \"@GIT_REV@\"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined (@ARG_PREFIX@GIT_DIFF)
|
|
||||||
#error \"Duplicate definition of macros @ARG_PREFIX@GIT_DIFF\"
|
|
||||||
#else
|
|
||||||
#define @ARG_PREFIX@GIT_DIFF \"@GIT_DIFF@\"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined (@ARG_PREFIX@GIT_BRANCH)
|
|
||||||
#error \"Duplicate definition of macros @ARG_PREFIX@GIT_BRANCH\"
|
|
||||||
#else
|
|
||||||
#define @ARG_PREFIX@GIT_BRANCH \"@GIT_BRANCH@\"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined (@ARG_PREFIX@GIT_TAG)
|
|
||||||
#error \"Duplicate definition of macros @ARG_PREFIX@GIT_TAG\"
|
|
||||||
#else
|
|
||||||
#define @ARG_PREFIX@GIT_TAG \"@GIT_TAG@\"
|
|
||||||
#endif
|
|
||||||
")
|
|
||||||
|
|
||||||
set(git_info_hpp_in_path ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/myx_git_info_p.hpp.in)
|
|
||||||
file(WRITE ${git_info_hpp_in_path} ${git_info_hpp_in})
|
|
||||||
|
|
||||||
set(git_info_cmake_in
|
|
||||||
"set(ARG_PREFIX ${ARG_PREFIX})
|
|
||||||
set(GIT_REV \"N/A\")
|
|
||||||
set(GIT_DIFF \"\")
|
|
||||||
set(GIT_TAG \"N/A\")
|
|
||||||
set(GIT_BRANCH \"N/A\")
|
|
||||||
|
|
||||||
find_package(Git)
|
|
||||||
|
|
||||||
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()
|
||||||
endif()
|
|
||||||
|
|
||||||
configure_file(${git_info_hpp_in_path} \"\${GIT_INFO_FILE}\")
|
|
||||||
")
|
|
||||||
set(git_info_cmake_in_path "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${target}-git-info.cmake.in")
|
|
||||||
file(WRITE ${git_info_cmake_in_path} ${git_info_cmake_in})
|
|
||||||
|
|
||||||
# cmake-format: off
|
# cmake-format: off
|
||||||
if(NOT TARGET ${target}-git-info-header)
|
if(NOT TARGET ${target}-git-info-header)
|
||||||
add_custom_target(${target}-git-info-header ALL
|
add_custom_target(${target}-git-info-header ALL
|
||||||
${CMAKE_COMMAND} -DGIT_INFO_FILE=${filename} -P ${git_info_cmake_in_path}
|
${CMAKE_COMMAND} -DGIT_INFO_FILE=${filename} -DPREFIX=${PREFIX}
|
||||||
|
-P ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/GitInfo.cmake
|
||||||
BYPRODUCTS ${filename}
|
BYPRODUCTS ${filename}
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
WORKING_DIRECTORY ${CMAKE_CURRENT_FUNCTION_LIST_DIR})
|
||||||
endif()
|
endif()
|
||||||
# cmake-format: on
|
# cmake-format: on
|
||||||
|
|
||||||
|
12
cmake/myx/lib/generators/PrivateConfig.hpp.in
Normal file
12
cmake/myx/lib/generators/PrivateConfig.hpp.in
Normal 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@"
|
@ -14,31 +14,21 @@ myx_generate_private_config_header
|
|||||||
|
|
||||||
include_guard(GLOBAL)
|
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)
|
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})
|
set(BUILD_DATE ${MYX_TODAY})
|
||||||
myx_project_version_int()
|
myx_project_version_int()
|
||||||
get_property(PROJECT_VERSION_INT GLOBAL PROPERTY PROJECT_VERSION_INT)
|
get_property(PROJECT_VERSION_INT GLOBAL PROPERTY PROJECT_VERSION_INT)
|
||||||
|
|
||||||
set(filename "${PROJECT_BINARY_DIR}/include/${base_filename}")
|
set(filename "${PROJECT_BINARY_DIR}/include/${base_filename}")
|
||||||
|
configure_file("${CMAKE_CURRENT_FUNCTION_LIST_DIR}/PrivateConfig.hpp.in" ${filename})
|
||||||
set(private_config_hpp_in
|
|
||||||
"#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@\"
|
|
||||||
")
|
|
||||||
|
|
||||||
set(private_config_hpp_in_path "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${target}_config_p.hpp.in")
|
|
||||||
file(WRITE ${private_config_hpp_in_path} ${private_config_hpp_in})
|
|
||||||
|
|
||||||
configure_file(${private_config_hpp_in_path} ${filename})
|
|
||||||
|
|
||||||
set_property(TARGET ${target} APPEND PROPERTY PRIVATE_HEADER_FILES ${filename})
|
set_property(TARGET ${target} APPEND PROPERTY PRIVATE_HEADER_FILES ${filename})
|
||||||
target_sources(${target} PRIVATE ${filename})
|
target_sources(${target} PRIVATE ${filename})
|
||||||
|
11
cmake/myx/lib/macro/CreateSymlink.cmake
Normal file
11
cmake/myx/lib/macro/CreateSymlink.cmake
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
include_guard(GLOBAL)
|
||||||
|
|
||||||
|
macro(create_symlink original linkname)
|
||||||
|
if(NOT EXISTS ${linkname})
|
||||||
|
if(${CMAKE_VERSION} VERSION_LESS "3.14.0")
|
||||||
|
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${original} ${linkname})
|
||||||
|
else()
|
||||||
|
file(CREATE_LINK ${original} ${linkname} SYMBOLIC)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endmacro(create_symlink original linkname)
|
@ -1,47 +1,19 @@
|
|||||||
include_guard(GLOBAL)
|
include_guard(GLOBAL)
|
||||||
|
|
||||||
|
if(${CMAKE_VERSION} VERSION_LESS "3.17.0")
|
||||||
|
set(MYX_CMAKE_LIB_UNCRUSTIFY_DIR_BACKPORT "${CMAKE_CURRENT_LIST_DIR}")
|
||||||
|
endif()
|
||||||
|
|
||||||
find_program(UNCRUSTIFY_EXE NAMES uncrustify)
|
find_program(UNCRUSTIFY_EXE NAMES uncrustify)
|
||||||
|
|
||||||
if(UNCRUSTIFY_EXE)
|
|
||||||
if(NOT EXISTS ${PROJECT_BINARY_DIR}/uncrustify-classheader.txt)
|
|
||||||
file(GENERATE OUTPUT ${PROJECT_BINARY_DIR}/uncrustify-classheader.txt CONTENT
|
|
||||||
"/**
|
|
||||||
* @class $(fclass)
|
|
||||||
* @brief TODO
|
|
||||||
* @details TODO
|
|
||||||
*/")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT EXISTS ${PROJECT_BINARY_DIR}/uncrustify-filefooter.txt)
|
|
||||||
file(GENERATE OUTPUT ${PROJECT_BINARY_DIR}/uncrustify-filefooter.txt CONTENT
|
|
||||||
"// EOF $(filename)")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT EXISTS ${PROJECT_BINARY_DIR}/uncrustify-fileheader.txt)
|
|
||||||
file(GENERATE OUTPUT ${PROJECT_BINARY_DIR}/uncrustify-fileheader.txt CONTENT
|
|
||||||
"/**
|
|
||||||
* @file $(filename)
|
|
||||||
* @brief TODO
|
|
||||||
* @details TODO
|
|
||||||
*/")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT EXISTS ${PROJECT_BINARY_DIR}/uncrustify-funcheader.txt)
|
|
||||||
file(GENERATE OUTPUT ${PROJECT_BINARY_DIR}/uncrustify-funcheader.txt CONTENT
|
|
||||||
"/**
|
|
||||||
* @fn $(fclass)::$(function)
|
|
||||||
* $(javaparam)
|
|
||||||
* @details TODO
|
|
||||||
*/")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
function(myx_uncrustify target)
|
function(myx_uncrustify target)
|
||||||
|
if(${CMAKE_VERSION} VERSION_LESS "3.17.0")
|
||||||
|
set(CMAKE_CURRENT_FUNCTION_LIST_DIR ${MYX_CMAKE_LIB_UNCRUSTIFY_DIR_BACKPORT})
|
||||||
|
endif()
|
||||||
|
|
||||||
set(options)
|
set(options)
|
||||||
set(oneValueArgs CONFIG)
|
set(oneValueArgs CONFIG)
|
||||||
set(multiValueArgs)
|
set(multiValueArgs)
|
||||||
|
|
||||||
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
|
|
||||||
if(NOT ARG_CONFIG)
|
if(NOT ARG_CONFIG)
|
||||||
@ -52,15 +24,17 @@ function(myx_uncrustify target)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT EXISTS ${ARG_CONFIG})
|
if(NOT EXISTS ${ARG_CONFIG})
|
||||||
myx_message_notify("MyxCMake: uncrustify config is not found")
|
myx_message_notice("MyxCMake: uncrustify config is not found")
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT UNCRUSTIFY_EXE)
|
if(NOT UNCRUSTIFY_EXE)
|
||||||
myx_message_notify("MyxCMake: uncrustify executable is not found")
|
myx_message_notice("MyxCMake: uncrustify executable is not found")
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(NOT TARGET myx-uncrustify)
|
if(NOT TARGET myx-uncrustify)
|
||||||
add_custom_target(myx-uncrustify)
|
add_custom_target(myx-uncrustify)
|
||||||
endif()
|
endif()
|
||||||
@ -71,12 +45,14 @@ function(myx_uncrustify target)
|
|||||||
add_custom_target(myx-uncrustify-append-comments)
|
add_custom_target(myx-uncrustify-append-comments)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
get_target_property(__sources ${target} SOURCES)
|
# Динамически сгенерированные файлы исключаются
|
||||||
list(FILTER __sources EXCLUDE REGEX "qrc_.*\\.cpp$")
|
get_target_property(s ${target} SOURCES)
|
||||||
list(FILTER __sources EXCLUDE REGEX "moc_.*\\.cpp$")
|
foreach(iter ${s})
|
||||||
list(FILTER __sources EXCLUDE REGEX "ui_.*\\.h$")
|
string(FIND ${iter} ${CMAKE_BINARY_DIR} pos)
|
||||||
list(FILTER __sources EXCLUDE REGEX ".*\\.qm$")
|
if(pos EQUAL -1)
|
||||||
|
list(APPEND src ${iter})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/uncrustify-${target}.cfg
|
add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/uncrustify-${target}.cfg
|
||||||
COMMAND ${UNCRUSTIFY_EXE} --update-config-with-doc
|
COMMAND ${UNCRUSTIFY_EXE} --update-config-with-doc
|
||||||
-c ${ARG_CONFIG}
|
-c ${ARG_CONFIG}
|
||||||
@ -85,21 +61,21 @@ function(myx_uncrustify target)
|
|||||||
# cmake-format: off
|
# cmake-format: off
|
||||||
add_custom_target(${target}-uncrustify-check
|
add_custom_target(${target}-uncrustify-check
|
||||||
DEPENDS ${PROJECT_BINARY_DIR}/uncrustify-${target}.cfg
|
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)
|
list(APPEND UNCRUSTIFY_OPTS --replace --no-backup)
|
||||||
add_custom_target(${target}-uncrustify
|
add_custom_target(${target}-uncrustify
|
||||||
DEPENDS ${PROJECT_BINARY_DIR}/uncrustify-${target}.cfg
|
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
|
add_custom_target(${target}-uncrustify-append-comments
|
||||||
DEPENDS ${PROJECT_BINARY_DIR}/uncrustify-${target}.cfg
|
DEPENDS ${PROJECT_BINARY_DIR}/uncrustify-${target}.cfg
|
||||||
COMMAND ${UNCRUSTIFY_EXE} ${UNCRUSTIFY_OPTS}
|
COMMAND ${UNCRUSTIFY_EXE} ${UNCRUSTIFY_OPTS}
|
||||||
--set cmt_insert_class_header=${PROJECT_BINARY_DIR}/uncrustify-classheader.txt
|
--set cmt_insert_class_header=${CMAKE_CURRENT_FUNCTION_LIST_DIR}/classheader.txt
|
||||||
--set cmt_insert_file_footer=${PROJECT_BINARY_DIR}/uncrustify-filefooter.txt
|
--set cmt_insert_file_footer=${CMAKE_CURRENT_FUNCTION_LIST_DIR}/filefooter.txt
|
||||||
--set cmt_insert_file_header=${PROJECT_BINARY_DIR}/uncrustify-fileheader.txt
|
--set cmt_insert_file_header=${CMAKE_CURRENT_FUNCTION_LIST_DIR}/fileheader.txt
|
||||||
--set cmt_insert_func_header=${PROJECT_BINARY_DIR}/uncrustify-funcheader.txt
|
--set cmt_insert_func_header=${CMAKE_CURRENT_FUNCTION_LIST_DIR}/funcheader.txt
|
||||||
--set cmt_insert_before_ctor_dtor=true --mtime ${__sources})
|
--set cmt_insert_before_ctor_dtor=true --mtime ${src})
|
||||||
# cmake-format: on
|
# cmake-format: on
|
||||||
|
|
||||||
add_dependencies(myx-uncrustify ${target}-uncrustify)
|
add_dependencies(myx-uncrustify ${target}-uncrustify)
|
5
cmake/myx/lib/uncrustify/classheader.txt
Normal file
5
cmake/myx/lib/uncrustify/classheader.txt
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
/**
|
||||||
|
* @class $(fclass)
|
||||||
|
* @brief TODO
|
||||||
|
* @details TODO
|
||||||
|
*/
|
1
cmake/myx/lib/uncrustify/filefooter.txt
Normal file
1
cmake/myx/lib/uncrustify/filefooter.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
// EOF $(filename)
|
6
cmake/myx/lib/uncrustify/fileheader.txt
Normal file
6
cmake/myx/lib/uncrustify/fileheader.txt
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
/**
|
||||||
|
* @file $(filename)
|
||||||
|
* @brief TODO
|
||||||
|
* @details TODO
|
||||||
|
*/
|
5
cmake/myx/lib/uncrustify/funcheader.txt
Normal file
5
cmake/myx/lib/uncrustify/funcheader.txt
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
/**
|
||||||
|
* @fn $(fclass)::$(function)
|
||||||
|
* $(javaparam)
|
||||||
|
* @details TODO
|
||||||
|
*/
|
@ -10,17 +10,21 @@
|
|||||||
|
|
||||||
Если определена переменная `MYX_CMAKE_USE_SYSTEM`, то выполняется
|
Если определена переменная `MYX_CMAKE_USE_SYSTEM`, то выполняется
|
||||||
поиск версии в каталогах перечисленных в переменной `CMAKE_MODULES_DIR`.
|
поиск версии в каталогах перечисленных в переменной `CMAKE_MODULES_DIR`.
|
||||||
|
|
||||||
|
Кроме того выполняется попытка поиска (MyxxCMake)[../../../../myxx] --
|
||||||
|
расширения для библиотеки, позволяющиего в режиме разработки программного
|
||||||
|
проекта использовать дополнительные инструменты для его сопровождения.
|
||||||
#]=======================================================================]
|
#]=======================================================================]
|
||||||
|
|
||||||
if(MYX_CMAKE_DIR)
|
if(MYX_CMAKE_DIR)
|
||||||
set(ENV{MYX_CMAKE_DIR} ${MYX_CMAKE_DIR})
|
set(ENV{MYX_CMAKE_DIR} ${MYX_CMAKE_DIR})
|
||||||
endif()
|
endif()
|
||||||
if(DEFINED ENV{MYX_CMAKE_DIR})
|
if(DEFINED ENV{MYX_CMAKE_DIR})
|
||||||
find_package(MyxCMake 1.99.77 CONFIG PATHS $ENV{MYX_CMAKE_DIR} NO_DEFAULT_PATH REQUIRED)
|
find_package(MyxCMake 1.99.99 REQUIRED CONFIG PATHS $ENV{MYX_CMAKE_DIR} NO_DEFAULT_PATH)
|
||||||
myx_message_notice("=== MyxCMake directory: ${MyxCMake_CONFIG} ===")
|
myx_message_notice("=== MyxCMake directory: ${MyxCMake_CONFIG} ===")
|
||||||
else()
|
else()
|
||||||
if(MYX_CMAKE_USE_SYSTEM)
|
if(MYX_CMAKE_USE_SYSTEM)
|
||||||
find_package(MyxCMake 1.99.77 REQUIRED)
|
find_package(MyxCMake 1.99.99 REQUIRED)
|
||||||
myx_message_notice("=== MyxCMake directory: ${MyxCMake_CONFIG} ===")
|
myx_message_notice("=== MyxCMake directory: ${MyxCMake_CONFIG} ===")
|
||||||
else()
|
else()
|
||||||
include(${PROJECT_SOURCE_DIR}/cmake/myx/MyxCMakeConfig.cmake)
|
include(${PROJECT_SOURCE_DIR}/cmake/myx/MyxCMakeConfig.cmake)
|
||||||
@ -28,3 +32,5 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
find_package(MyxxCMake CONFIG PATHS "$ENV{XDG_DATA_DIR}/cmake" QUIET)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user