Compare commits
73 Commits
79492c8464
...
0.6.0
Author | SHA1 | Date | |
---|---|---|---|
42b12b9f59 | |||
675363f678 | |||
03e537d121 | |||
8b388abe31 | |||
8d133ac1f3 | |||
a4df53b96a | |||
8fdb22820c | |||
cca00d195e | |||
70314325c7 | |||
f8c9009e88 | |||
9d00a9bfef | |||
e1badf6f69 | |||
06f7013273 | |||
366902c0a3 | |||
26e50c5a03 | |||
c0ee1985f8 | |||
48c480af2e | |||
f163819116 | |||
2a12f0250f | |||
26e60bf5fd | |||
3eb1e2c22e | |||
ece04ba69b | |||
7e50160742 | |||
c2ac523d86 | |||
a401afbe99 | |||
530055de9d | |||
c82b5f29f1 | |||
178412c505 | |||
5e4a5155ca | |||
5068be6679 | |||
c535ce80bd | |||
58573cebfc | |||
6a06aa5898 | |||
be911b4fd9 | |||
e540892c2c | |||
d6b5201ac3 | |||
6985a2cfbf | |||
6a11f9b43d | |||
b8b5320b2a | |||
7927d5cba8 | |||
d321b9aed2 | |||
396e2f38f9 | |||
5d7824ebdd | |||
e735e6e9d5 | |||
5b6ed5b79b | |||
42db4201e7 | |||
9401cb4c3f | |||
9c22c16d9b | |||
ea38edfdc4 | |||
de837bf115 | |||
353d92da23 | |||
733692f06b | |||
a152033184 | |||
05ef192ebd | |||
fa8fdfac66 | |||
eabd2c4b31 | |||
ee00e43d25 | |||
cdfe022922 | |||
cc5568c6a9 | |||
4851c81b15 | |||
e81a491606 | |||
f156a614aa | |||
20d372a25c | |||
4b92732a3b | |||
dcafdee746 | |||
475afb8070 | |||
9f6551c259 | |||
a747777174 | |||
d7b6411ad3 | |||
032fdee52b | |||
357c19771f | |||
acd8d2b255 | |||
b69aa4819d |
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
build
|
||||
*.deb
|
||||
MyxCMake/MyxCMakeConfigVersion.cmake
|
||||
|
||||
|
39
.gitlab-ci.yml
Normal file
39
.gitlab-ci.yml
Normal file
@ -0,0 +1,39 @@
|
||||
include:
|
||||
- project: 'f1x1t/gitlab-ci'
|
||||
ref: master
|
||||
file: 'scheduled.yml'
|
||||
|
||||
elbrus-nightly:
|
||||
script:
|
||||
- ./build_deb.sh
|
||||
extends: .scheduled-elbrus
|
||||
|
||||
smolensk15-nightly:
|
||||
script:
|
||||
- ./build_deb.sh
|
||||
extends: .scheduled-smolensk15
|
||||
|
||||
smolensk17-nightly:
|
||||
script:
|
||||
- ./build_deb.sh
|
||||
extends: .scheduled-smolensk15
|
||||
|
||||
orel212-nightly:
|
||||
script:
|
||||
- ./build_deb.sh
|
||||
extends: .scheduled-orel212
|
||||
|
||||
bionic-nightly:
|
||||
script:
|
||||
- ./build_deb.sh
|
||||
extends: .scheduled-bionic
|
||||
|
||||
focal-nightly:
|
||||
script:
|
||||
- ./build_deb.sh
|
||||
extends: .scheduled-focal
|
||||
|
||||
jammy-nightly:
|
||||
script:
|
||||
- ./build_deb.sh
|
||||
extends: .scheduled-jammy
|
@ -1,5 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(myx-cmake VERSION 0.2.0 LANGUAGES)
|
||||
project(myx-cmake VERSION 0.6.0 LANGUAGES)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
file(WRITE ${CMAKE_SOURCE_DIR}/MyxCMake/MyxCMakeConfigVersion.cmake
|
||||
|
@ -5,7 +5,7 @@ get_filename_component(MYX_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" DIRECTORY)
|
||||
|
||||
set(MYX_CMAKE_FUNCTIONS_DIR "${MYX_CMAKE_DIR}/functions")
|
||||
if(NOT IS_DIRECTORY "${MYX_CMAKE_FUNCTIONS_DIR}")
|
||||
message(STATUS "MyxCMake: Functions directory is not found.")
|
||||
myx_cmake_message_warning("MyxCMake: Functions directory is not found.")
|
||||
else()
|
||||
if(NOT ${MYX_CMAKE_FUNCTIONS_DIR} IN_LIST CMAKE_MODULE_PATH)
|
||||
list(INSERT CMAKE_MODULE_PATH 0 "${MYX_CMAKE_FUNCTIONS_DIR}")
|
||||
@ -14,7 +14,7 @@ endif()
|
||||
|
||||
set(MYX_CMAKE_THIRDPARTY_DIR "${MYX_CMAKE_DIR}/thirdparty")
|
||||
if(NOT IS_DIRECTORY "${MYX_CMAKE_THIRDPARTY_DIR}")
|
||||
message(STATUS "MyxCMake: Thirdparty submodule is not found.")
|
||||
myx_cmake_message_warning("MyxCMake: Thirdparty submodule is not found.")
|
||||
else()
|
||||
if(NOT ${MYX_CMAKE_THIRDPARTY_DIR} IN_LIST CMAKE_MODULE_PATH)
|
||||
list(INSERT CMAKE_MODULE_PATH 0 "${MYX_CMAKE_THIRDPARTY_DIR}")
|
||||
@ -23,7 +23,7 @@ endif()
|
||||
|
||||
set(MYX_CMAKE_SANITIZERS_DIR "${MYX_CMAKE_DIR}/sanitizers")
|
||||
if(NOT IS_DIRECTORY "${MYX_CMAKE_SANITIZERS_DIR}")
|
||||
message(STATUS "MyxCMake: Sanitizers submodule is not found.")
|
||||
myx_cmake_message_warning(STATUS "MyxCMake: Sanitizers submodule is not found.")
|
||||
else()
|
||||
if(NOT ${MYX_CMAKE_SANITIZERS_DIR} IN_LIST CMAKE_MODULE_PATH)
|
||||
list(INSERT CMAKE_MODULE_PATH 0 "${MYX_CMAKE_SANITIZERS_DIR}")
|
||||
@ -33,7 +33,7 @@ endif()
|
||||
|
||||
set(MYX_CMAKE_FIND_DIR "${MYX_CMAKE_DIR}/find")
|
||||
if(NOT IS_DIRECTORY "${MYX_CMAKE_FIND_DIR}")
|
||||
message(STATUS "MyxCMake: Custom find submodules are not found.")
|
||||
myx_cmake_message_warning("MyxCMake: Custom find submodules are not found.")
|
||||
else()
|
||||
if(NOT ${MYX_CMAKE_FIND_DIR} IN_LIST CMAKE_MODULE_PATH)
|
||||
list(INSERT CMAKE_MODULE_PATH 0 "${MYX_CMAKE_FIND_DIR}")
|
||||
@ -42,7 +42,7 @@ endif()
|
||||
|
||||
set(MYX_CMAKE_MODULES_DIR "${MYX_CMAKE_DIR}/modules")
|
||||
if(NOT IS_DIRECTORY "${MYX_CMAKE_MODULES_DIR}")
|
||||
message(FATAL_ERROR "MyxCMake: Requried modules directory is not found.")
|
||||
myx_cmake_message_error("MyxCMake: Requried modules directory is not found.")
|
||||
else()
|
||||
if(NOT ${MYX_CMAKE_MODULES_DIR} IN_LIST CMAKE_MODULE_PATH)
|
||||
list(INSERT CMAKE_MODULE_PATH 0 "${MYX_CMAKE_MODULES_DIR}")
|
||||
|
@ -22,7 +22,7 @@ list(APPEND _ext_project_args
|
||||
cgal-widget
|
||||
SOURCE_DIR ${CMAKE_SOURCE_DIR}/thirdparty/cgal-widget
|
||||
INSTALL_DIR ${CMAKE_BINARY_DIR}
|
||||
CMAKE_ARGS ${CMLIB_EXT_PROJ_DEFAULT_ARGS}
|
||||
CMAKE_ARGS ${MYX_CMAKE_EXTERNAL_PROJECT_ARGS}
|
||||
<SOURCE_DIR>)
|
||||
if(CgalWidgetThirdparty_FIND_COMPONENTS STREQUAL "headers")
|
||||
list(APPEND _ext_project_args
|
||||
|
@ -16,7 +16,7 @@ list(APPEND _ext_project_args
|
||||
fc-protocol
|
||||
SOURCE_DIR ${CMAKE_SOURCE_DIR}/thirdparty/fc-protocol
|
||||
INSTALL_DIR ${CMAKE_BINARY_DIR}
|
||||
CMAKE_ARGS ${CMLIB_EXT_PROJ_DEFAULT_ARGS}
|
||||
CMAKE_ARGS ${MYX_CMAKE_EXTERNAL_PROJECT_ARGS}
|
||||
<SOURCE_DIR>)
|
||||
if(FcProtocolThirdparty_FIND_COMPONENTS STREQUAL "headers")
|
||||
list(APPEND _ext_project_args
|
||||
|
@ -23,7 +23,7 @@ list(APPEND _ext_project_args
|
||||
DEPENDS libpreprocmath libionobase myxlib
|
||||
SOURCE_DIR ${CMAKE_SOURCE_DIR}/thirdparty/libfsp
|
||||
INSTALL_DIR ${CMAKE_BINARY_DIR}
|
||||
CMAKE_ARGS ${CMLIB_EXT_PROJ_DEFAULT_ARGS}
|
||||
CMAKE_ARGS ${MYX_CMAKE_EXTERNAL_PROJECT_ARGS}
|
||||
-DPREPROCMATH_PREFIX=${CMAKE_BINARY_DIR}
|
||||
-DIONOBASE_PREFIX=${CMAKE_BINARY_DIR}
|
||||
-DMYXLIB_PREFIX=${CMAKE_BINARY_DIR}
|
||||
|
@ -22,7 +22,7 @@ list(APPEND _ext_project_args
|
||||
libimitator
|
||||
SOURCE_DIR ${CMAKE_SOURCE_DIR}/thirdparty/libimitator
|
||||
INSTALL_DIR ${CMAKE_BINARY_DIR}
|
||||
CMAKE_ARGS ${CMLIB_EXT_PROJ_DEFAULT_ARGS}
|
||||
CMAKE_ARGS ${MYX_CMAKE_EXTERNAL_PROJECT_ARGS}
|
||||
-DPREPROCMATH_PREFIX=${CMAKE_BINARY_DIR}
|
||||
-DMYXLIB_PREFIX=${CMAKE_BINARY_DIR}
|
||||
<SOURCE_DIR>)
|
||||
|
@ -22,7 +22,7 @@ list(APPEND _ext_project_args
|
||||
libionobase
|
||||
SOURCE_DIR ${CMAKE_SOURCE_DIR}/thirdparty/libionobase
|
||||
INSTALL_DIR ${CMAKE_BINARY_DIR}
|
||||
CMAKE_ARGS ${CMLIB_EXT_PROJ_DEFAULT_ARGS}
|
||||
CMAKE_ARGS ${MYX_CMAKE_EXTERNAL_PROJECT_ARGS}
|
||||
<SOURCE_DIR>)
|
||||
if(IonobaseThirdparty_FIND_COMPONENTS STREQUAL "headers")
|
||||
list(APPEND _ext_project_args
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Подключение внешних проектов
|
||||
include(ExternalProject)
|
||||
|
||||
if(MPFR_FOUND)
|
||||
if(MPFR_FOUND AND IS_DIRECTORY ${CMAKE_SOURCE_DIR}/thirdparty/mpreal)
|
||||
ExternalProject_Add(
|
||||
mpfrcpp
|
||||
SOURCE_DIR ${CMAKE_SOURCE_DIR}/thirdparty/mpreal
|
||||
@ -9,7 +9,8 @@ if(MPFR_FOUND)
|
||||
CONFIGURE_COMMAND true
|
||||
BUILD_COMMAND true
|
||||
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy <SOURCE_DIR>/mpreal.h <INSTALL_DIR>)
|
||||
|
||||
set(MPFRCPP_PREFIX ${CMAKE_BINARY_DIR} CACHE FILEPATH "" FORCE)
|
||||
set(MPFRCPP_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR} CACHE PATH "" FORCE)
|
||||
endif()
|
||||
|
||||
set(MPFRCPP_PREFIX ${CMAKE_BINARY_DIR} CACHE FILEPATH "" FORCE)
|
||||
set(MPFRCPP_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR} CACHE PATH "" FORCE)
|
||||
|
@ -22,7 +22,7 @@ list(APPEND _ext_project_args
|
||||
myx-notifications
|
||||
SOURCE_DIR ${CMAKE_SOURCE_DIR}/thirdparty/myx-notifications
|
||||
INSTALL_DIR ${CMAKE_BINARY_DIR}
|
||||
CMAKE_ARGS ${CMLIB_EXT_PROJ_DEFAULT_ARGS}
|
||||
CMAKE_ARGS ${MYX_CMAKE_EXTERNAL_PROJECT_ARGS}
|
||||
<SOURCE_DIR>)
|
||||
if(MyxNotificationsThirdparty_FIND_COMPONENTS STREQUAL "headers")
|
||||
list(APPEND _ext_project_args
|
||||
|
@ -22,7 +22,7 @@ list(APPEND _ext_project_args
|
||||
myx-qping
|
||||
SOURCE_DIR ${CMAKE_SOURCE_DIR}/thirdparty/myx-qping
|
||||
INSTALL_DIR ${CMAKE_BINARY_DIR}
|
||||
CMAKE_ARGS ${CMLIB_EXT_PROJ_DEFAULT_ARGS}
|
||||
CMAKE_ARGS ${MYX_CMAKE_EXTERNAL_PROJECT_ARGS}
|
||||
<SOURCE_DIR>)
|
||||
if(MyxQPingThirdparty_FIND_COMPONENTS STREQUAL "headers")
|
||||
list(APPEND _ext_project_args
|
||||
|
@ -22,7 +22,7 @@ list(APPEND _ext_project_args
|
||||
myx-redis
|
||||
SOURCE_DIR ${CMAKE_SOURCE_DIR}/thirdparty/myx-redis
|
||||
INSTALL_DIR ${CMAKE_BINARY_DIR}
|
||||
CMAKE_ARGS ${CMLIB_EXT_PROJ_DEFAULT_ARGS}
|
||||
CMAKE_ARGS ${MYX_CMAKE_EXTERNAL_PROJECT_ARGS}
|
||||
<SOURCE_DIR>)
|
||||
if(MyxRedisThirdparty_FIND_COMPONENTS STREQUAL "headers")
|
||||
list(APPEND _ext_project_args
|
||||
|
@ -29,7 +29,7 @@ list(APPEND _ext_project_args
|
||||
myxlib
|
||||
SOURCE_DIR ${CMAKE_SOURCE_DIR}/thirdparty/myxlib
|
||||
INSTALL_DIR ${CMAKE_BINARY_DIR}
|
||||
CMAKE_ARGS ${CMLIB_EXT_PROJ_DEFAULT_ARGS}
|
||||
CMAKE_ARGS ${MYX_CMAKE_EXTERNAL_PROJECT_ARGS}
|
||||
<SOURCE_DIR>)
|
||||
if(MyxlibThirdparty_FIND_COMPONENTS STREQUAL "headers")
|
||||
list(APPEND _ext_project_args
|
||||
|
@ -23,7 +23,7 @@ list(APPEND _ext_project_args
|
||||
DEPENDS libpreprocmath
|
||||
SOURCE_DIR ${CMAKE_SOURCE_DIR}/thirdparty/libpreproc
|
||||
INSTALL_DIR ${CMAKE_BINARY_DIR}
|
||||
CMAKE_ARGS ${CMLIB_EXT_PROJ_DEFAULT_ARGS}
|
||||
CMAKE_ARGS ${MYX_CMAKE_EXTERNAL_PROJECT_ARGS}
|
||||
-DPREPROCMATH_PREFIX=${CMAKE_BINARY_DIR}
|
||||
<SOURCE_DIR>)
|
||||
if(PreprocThirdparty_FIND_COMPONENTS STREQUAL "headers")
|
||||
|
@ -22,7 +22,7 @@ list(APPEND _ext_project_args
|
||||
libpreprocmath
|
||||
SOURCE_DIR ${CMAKE_SOURCE_DIR}/thirdparty/libpreprocmath
|
||||
INSTALL_DIR ${CMAKE_BINARY_DIR}
|
||||
CMAKE_ARGS ${CMLIB_EXT_PROJ_DEFAULT_ARGS}
|
||||
CMAKE_ARGS ${MYX_CMAKE_EXTERNAL_PROJECT_ARGS}
|
||||
<SOURCE_DIR>)
|
||||
if(PreprocmathThirdparty_FIND_COMPONENTS STREQUAL "headers")
|
||||
list(APPEND _ext_project_args
|
||||
|
@ -23,7 +23,7 @@ list(APPEND _ext_project_args
|
||||
DEPENDS libpreprocmath
|
||||
SOURCE_DIR ${CMAKE_SOURCE_DIR}/thirdparty/libsignalview
|
||||
INSTALL_DIR ${CMAKE_BINARY_DIR}
|
||||
CMAKE_ARGS ${CMLIB_EXT_PROJ_DEFAULT_ARGS}
|
||||
CMAKE_ARGS ${MYX_CMAKE_EXTERNAL_PROJECT_ARGS}
|
||||
-DPREPROCMATH_PREFIX=${CMAKE_BINARY_DIR}
|
||||
<SOURCE_DIR>)
|
||||
if(SignalViewThirdparty_FIND_COMPONENTS STREQUAL "headers")
|
||||
|
@ -6,7 +6,7 @@ list(APPEND _ext_project_args
|
||||
veer-protocols
|
||||
SOURCE_DIR ${CMAKE_SOURCE_DIR}/thirdparty/veer-protocols
|
||||
INSTALL_DIR ${CMAKE_BINARY_DIR}
|
||||
CMAKE_ARGS ${CMLIB_EXT_PROJ_DEFAULT_ARGS}
|
||||
CMAKE_ARGS ${MYX_CMAKE_EXTERNAL_PROJECT_ARGS}
|
||||
<SOURCE_DIR>)
|
||||
if(VeerProtocolsThirdparty_FIND_COMPONENTS STREQUAL "headers")
|
||||
list(APPEND _ext_project_args
|
||||
|
94
MyxCMake/functions/MyxCMakeDocBreathe.cmake
Normal file
94
MyxCMake/functions/MyxCMakeDocBreathe.cmake
Normal file
@ -0,0 +1,94 @@
|
||||
function(myx_cmake_doc_breathe)
|
||||
set(BREATHE_FOUND AUTO CACHE STRING "Enable Breathe documentation generator")
|
||||
set_property(CACHE BREATHE_FOUND PROPERTY STRINGS ON OFF AUTO)
|
||||
|
||||
find_package(Doxygen)
|
||||
find_package(Perl)
|
||||
set(Python_ADDITIONAL_VERSIONS 3.11;3.10;3.9;3.8;3.7;3.6;3.5;3.4;3.3;3.2)
|
||||
find_package(PythonInterp)
|
||||
if(PYTHONINTERP_FOUND)
|
||||
find_package(Sphinx)
|
||||
include(FindPythonModule)
|
||||
find_python_module(breathe)
|
||||
find_python_module(recommonmark)
|
||||
if(DOXYGEN_FOUND
|
||||
AND PERL_FOUND
|
||||
AND PYTHONINTERP_FOUND
|
||||
AND SPHINX_EXECUTABLE
|
||||
AND breathe
|
||||
AND recommonmark)
|
||||
set(BREATHE_FOUND ON CACHE STRING "Breathe documentation generator enabled" FORCE)
|
||||
else()
|
||||
set(BREATHE_FOUND OFF CACHE STRING "Breathe documentation generator disabled" FORCE)
|
||||
endif()
|
||||
else()
|
||||
set(BREATHE_FOUND OFF CACHE STRING "Breathe documentation generator disabled" FORCE)
|
||||
endif()
|
||||
|
||||
set(_target "myx-cmake-doc-breathe-${CMAKE_PROJECT_NAME}")
|
||||
if(NOT BREATHE_FOUND)
|
||||
message(STATUS "MyxCMake:")
|
||||
add_custom_target(${_target} VERBATIM COMMENT " Breathe is not found. Skipping target ${_target} build")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT TARGET ${_target})
|
||||
set(options)
|
||||
set(oneValueArgs COMMENT)
|
||||
set(multiValueArgs)
|
||||
cmake_parse_arguments(_arg "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
set(BREATHE_DIR ${CMAKE_BINARY_DIR}/doc/breathe)
|
||||
set(BREATHE_CONF_DIR ${BREATHE_DIR}/conf)
|
||||
set(BREATHE_DOXYGEN_DIR ${BREATHE_DIR}/doxygen)
|
||||
set(GENERATE_XML YES)
|
||||
set(GENERATE_HTML NO)
|
||||
set(GENERATE_LATEX NO)
|
||||
set(CONF_FILE ${MYX_CMAKE_FUNCTIONS_DIR}/doc/breathe-conf.py.in)
|
||||
set(DOXY_FILE ${MYX_CMAKE_FUNCTIONS_DIR}/doc/Doxyfile.in)
|
||||
|
||||
configure_file(${CONF_FILE} ${BREATHE_CONF_DIR}/conf.py @ONLY)
|
||||
configure_file(${DOXY_FILE} ${BREATHE_DOXYGEN_DIR}/Doxyfile @ONLY)
|
||||
|
||||
add_custom_target(${_target}
|
||||
VERBATIM
|
||||
DEPENDS ${DOXY_FILE}
|
||||
DEPENDS ${CONF_FILE}
|
||||
COMMAND "${CMAKE_COMMAND}" -E make_directory ${BREATHE_CONF_DIR}
|
||||
COMMAND ${SPHINX_EXECUTABLE} -q -b html -c ${BREATHE_CONF_DIR}
|
||||
-d ${BREATHE_DIR}/cache ${BREATHE_DOXYGEN_DIR} ${BREATHE_DIR}/html
|
||||
COMMENT "Building ${CMAKE_PROJECT_NAME} documentation with Breathe")
|
||||
|
||||
set(INDEX_MD_FILE ${CMAKE_HOME_DIRECTORY}/doc/breathe/index.md.in)
|
||||
if(EXISTS ${INDEX_MD_FILE})
|
||||
configure_file(${INDEX_MD_FILE} ${BREATHE_DOXYGEN_DIR}/index.md @ONLY)
|
||||
file(GLOB MD_FILES ${CMAKE_HOME_DIRECTORY}/doc/breathe/*.md)
|
||||
if(MD_FILES)
|
||||
add_custom_command(TARGET ${_target} PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${MD_FILES} ${BREATHE_DOXYGEN_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(INDEX_RST_FILE ${CMAKE_HOME_DIRECTORY}/doc/breathe/index.rst.in)
|
||||
if(EXISTS ${INDEX_RST_FILE})
|
||||
configure_file(${INDEX_RST_FILE} ${BREATHE_DOXYGEN_DIR}/index.rst @ONLY)
|
||||
file(GLOB RST_FILES ${CMAKE_SOURCE_DIR}/doc/breathe/*.rst)
|
||||
if(RST_FILES)
|
||||
add_custom_command(TARGET ${target} PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${RST_FILES} ${BREATHE_DOXYGEN_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT TARGET myx-cmake-doc-breathe)
|
||||
add_custom_target(myx-cmake-doc-breathe)
|
||||
endif()
|
||||
add_dependencies(myx-cmake-doc-breathe ${_target})
|
||||
|
||||
install(DIRECTORY ${CMAKE_BINARY_DIR}/doc/breathe/html
|
||||
COMPONENT doc OPTIONAL
|
||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/breathe)
|
||||
else()
|
||||
message(STATUS "MyxCMake:")
|
||||
add_custom_target(${target} VERBATIM COMMENT " Breathe is not found. Skipping target ${target} build")
|
||||
endif()
|
||||
endfunction()
|
59
MyxCMake/functions/MyxCMakeDocDoxygen.cmake
Normal file
59
MyxCMake/functions/MyxCMakeDocDoxygen.cmake
Normal file
@ -0,0 +1,59 @@
|
||||
function(myx_cmake_doc_doxygen)
|
||||
set(DOXYGEN_FOUND AUTO CACHE STRING "Enable Doxygen documentation generator")
|
||||
set_property(CACHE DOXYGEN_FOUND PROPERTY STRINGS ON OFF AUTO)
|
||||
|
||||
find_package(Doxygen)
|
||||
if(DOXYGEN_FOUND)
|
||||
set(DOXYGEN_FOUND ON CACHE STRING "Doxygen documentation generator enabled" FORCE)
|
||||
else()
|
||||
set(DOXYGEN_FOUND OFF CACHE STRING "Doxygen documentation generator disabled" FORCE)
|
||||
endif()
|
||||
|
||||
set(_target "myx-cmake-doc-doxygen-${CMAKE_PROJECT_NAME}")
|
||||
if(NOT DOXYGEN_FOUND)
|
||||
message(STATUS "MyxCMake:")
|
||||
add_custom_target(${_target} VERBATIM COMMENT " Doxygen is not found. Skipping target ${_target} build")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT TARGET ${_target})
|
||||
set(options)
|
||||
set(oneValueArgs SQLITE LATEX HTML)
|
||||
set(multiValueArgs)
|
||||
cmake_parse_arguments(_arg "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
set(GENERATE_XML YES)
|
||||
set(GENERATE_HTML NO)
|
||||
set(GENERATE_LATEX NO)
|
||||
if(_arg_HTML)
|
||||
set(GENERATE_HTML YES)
|
||||
endif()
|
||||
if(_arg_LATEX)
|
||||
set(GENERATE_LATEX YES)
|
||||
endif()
|
||||
if(_arg_SQLITE)
|
||||
set(GENERATE_SQLITE YES)
|
||||
endif()
|
||||
|
||||
set(work_dir ${CMAKE_BINARY_DIR}/doc/doxygen)
|
||||
configure_file(${MYX_CMAKE_FUNCTIONS_DIR}/doc/Doxyfile.in ${work_dir}/Doxyfile @ONLY)
|
||||
|
||||
add_custom_target(${_target}
|
||||
VERBATIM
|
||||
WORKING_DIRECTORY ${work_dir}
|
||||
COMMAND "${CMAKE_COMMAND}" -E remove -f "${work_dir}/doxygen_sqlite3.db"
|
||||
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-cmake-doc-doxygen)
|
||||
add_custom_target(myx-cmake-doc-doxygen)
|
||||
endif()
|
||||
add_dependencies(myx-cmake-doc-doxygen ${_target})
|
||||
else()
|
||||
message(STATUS "MyxCMake: target ${_target} is already defined.")
|
||||
endif()
|
||||
endfunction()
|
@ -1,7 +1,7 @@
|
||||
function(myx_cmake_generate_git_info_header)
|
||||
set(output_file ${CMAKE_BINARY_DIR}/include/myx_cmake_git_info.hpp)
|
||||
set(output_file ${CMAKE_BINARY_DIR}/include/myx_cmake_git_info_p.hpp)
|
||||
if(MYX_CMAKE_GENERATED_HEADERS_PATH)
|
||||
set(output_file ${MYX_CMAKE_GENERATED_HEADERS_PATH}/myx_cmake_git_info.hpp)
|
||||
set(output_file ${MYX_CMAKE_GENERATED_HEADERS_PATH}/myx_cmake_git_info_p.hpp)
|
||||
elseif(ARGV0)
|
||||
set(output_file ${ARGV0})
|
||||
endif()
|
||||
|
@ -2,9 +2,9 @@ function(myx_cmake_generate_private_config_header)
|
||||
include(MyxCMakeLargeFiles)
|
||||
myx_cmake_test_large_files(HAVE_LARGEFILES)
|
||||
|
||||
set(output_file ${CMAKE_BINARY_DIR}/include/myx_cmake_private_config.hpp)
|
||||
set(output_file ${CMAKE_BINARY_DIR}/include/myx_cmake_private_config_p.hpp)
|
||||
if(MYX_CMAKE_GENERATED_HEADERS_PATH)
|
||||
set(output_file ${MYX_CMAKE_GENERATED_HEADERS_PATH}/myx_cmake_private_config.hpp)
|
||||
set(output_file ${MYX_CMAKE_GENERATED_HEADERS_PATH}/myx_cmake_private_config_p.hpp)
|
||||
elseif(ARGV0)
|
||||
set(output_file ${ARGV0})
|
||||
endif()
|
||||
|
@ -1,11 +1,13 @@
|
||||
find_package(Quadmath)
|
||||
if(QUADMATH_FOUND)
|
||||
add_definitions(-DHAVE_QUADMATH=1)
|
||||
else()
|
||||
find_package(MPFR)
|
||||
if(MPFR_FOUND)
|
||||
find_package(MPFRCppThirdparty)
|
||||
function(myx_cmake_enable_high_precision_math)
|
||||
find_package(Quadmath)
|
||||
if(QUADMATH_FOUND)
|
||||
add_definitions(-DHAVE_QUADMATH=1)
|
||||
else()
|
||||
message(FATAL_ERROR "Nor Quadmath, nor MPFR found.")
|
||||
find_package(MPFR)
|
||||
if(MPFR_FOUND)
|
||||
find_package(MPFRCppThirdparty)
|
||||
else()
|
||||
myx_cmake_message_error("MyxCMake: Nor Quadmath, nor MPFR found.")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
383
MyxCMake/functions/doc/Doxyfile.in
Normal file
383
MyxCMake/functions/doc/Doxyfile.in
Normal file
@ -0,0 +1,383 @@
|
||||
# Doxyfile 1.8.16
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
DOXYFILE_ENCODING = UTF-8
|
||||
PROJECT_NAME = "@DOXYGEN_PROJECT_TITLE@"
|
||||
PROJECT_NUMBER =
|
||||
PROJECT_BRIEF =
|
||||
PROJECT_LOGO =
|
||||
OUTPUT_DIRECTORY = "@OUTPUT_DIRECTORY@"
|
||||
CREATE_SUBDIRS = NO
|
||||
ALLOW_UNICODE_NAMES = NO
|
||||
OUTPUT_LANGUAGE = Russian
|
||||
OUTPUT_TEXT_DIRECTION = None
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
ABBREVIATE_BRIEF = "The $name class" \
|
||||
"The $name widget" \
|
||||
"The $name file" \
|
||||
is \
|
||||
provides \
|
||||
specifies \
|
||||
contains \
|
||||
represents \
|
||||
a \
|
||||
an \
|
||||
the
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
FULL_PATH_NAMES = YES
|
||||
STRIP_FROM_PATH = "@CMAKE_HOME_DIRECTORY@/src"
|
||||
STRIP_FROM_INC_PATH = "@CMAKE_HOME_DIRECTORY@/src"
|
||||
SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = NO
|
||||
JAVADOC_BANNER = NO
|
||||
QT_AUTOBRIEF = NO
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
INHERIT_DOCS = YES
|
||||
SEPARATE_MEMBER_PAGES = NO
|
||||
TAB_SIZE = 4
|
||||
ALIASES =
|
||||
TCL_SUBST =
|
||||
OPTIMIZE_OUTPUT_FOR_C = NO
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
OPTIMIZE_FOR_FORTRAN = NO
|
||||
OPTIMIZE_OUTPUT_VHDL = NO
|
||||
OPTIMIZE_OUTPUT_SLICE = NO
|
||||
EXTENSION_MAPPING =
|
||||
MARKDOWN_SUPPORT = YES
|
||||
TOC_INCLUDE_HEADINGS = 5
|
||||
AUTOLINK_SUPPORT = YES
|
||||
BUILTIN_STL_SUPPORT = NO
|
||||
CPP_CLI_SUPPORT = NO
|
||||
SIP_SUPPORT = NO
|
||||
IDL_PROPERTY_SUPPORT = YES
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
GROUP_NESTED_COMPOUNDS = NO
|
||||
SUBGROUPING = YES
|
||||
INLINE_GROUPED_CLASSES = NO
|
||||
INLINE_SIMPLE_STRUCTS = NO
|
||||
TYPEDEF_HIDES_STRUCT = NO
|
||||
LOOKUP_CACHE_SIZE = 0
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
EXTRACT_ALL = YES
|
||||
EXTRACT_PRIVATE = YES
|
||||
EXTRACT_PRIV_VIRTUAL = NO
|
||||
EXTRACT_PACKAGE = NO
|
||||
EXTRACT_STATIC = YES
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
EXTRACT_LOCAL_METHODS = YES
|
||||
EXTRACT_ANON_NSPACES = NO
|
||||
HIDE_UNDOC_MEMBERS = NO
|
||||
HIDE_UNDOC_CLASSES = NO
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
HIDE_IN_BODY_DOCS = NO
|
||||
INTERNAL_DOCS = NO
|
||||
CASE_SENSE_NAMES = NO
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
HIDE_COMPOUND_REFERENCE= NO
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
SHOW_GROUPED_MEMB_INC = NO
|
||||
FORCE_LOCAL_INCLUDES = NO
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = YES
|
||||
SORT_BRIEF_DOCS = NO
|
||||
SORT_MEMBERS_CTORS_1ST = NO
|
||||
SORT_GROUP_NAMES = NO
|
||||
SORT_BY_SCOPE_NAME = NO
|
||||
STRICT_PROTO_MATCHING = NO
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
SHOW_USED_FILES = YES
|
||||
SHOW_FILES = YES
|
||||
SHOW_NAMESPACES = YES
|
||||
FILE_VERSION_FILTER =
|
||||
LAYOUT_FILE =
|
||||
CITE_BIB_FILES =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
QUIET = NO
|
||||
WARNINGS = YES
|
||||
WARN_IF_UNDOCUMENTED = YES
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_NO_PARAMDOC = NO
|
||||
WARN_AS_ERROR = NO
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
WARN_LOGFILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = "@CMAKE_HOME_DIRECTORY@/src" \
|
||||
"@CMAKE_HOME_DIRECTORY@/doc/doxygen"
|
||||
INPUT_ENCODING = UTF-8
|
||||
FILE_PATTERNS = *.c \
|
||||
*.cc \
|
||||
*.cxx \
|
||||
*.cpp \
|
||||
*.c++ \
|
||||
*.java \
|
||||
*.ii \
|
||||
*.ixx \
|
||||
*.ipp \
|
||||
*.i++ \
|
||||
*.inl \
|
||||
*.idl \
|
||||
*.ddl \
|
||||
*.odl \
|
||||
*.h \
|
||||
*.hh \
|
||||
*.hxx \
|
||||
*.hpp \
|
||||
*.h++ \
|
||||
*.cs \
|
||||
*.d \
|
||||
*.php \
|
||||
*.php4 \
|
||||
*.php5 \
|
||||
*.phtml \
|
||||
*.inc \
|
||||
*.m \
|
||||
*.markdown \
|
||||
*.md \
|
||||
*.mm \
|
||||
*.dox \
|
||||
*.py \
|
||||
*.pyw \
|
||||
*.f90 \
|
||||
*.f95 \
|
||||
*.f03 \
|
||||
*.f08 \
|
||||
*.f \
|
||||
*.for \
|
||||
*.tcl \
|
||||
*.vhd \
|
||||
*.vhdl \
|
||||
*.ucf \
|
||||
*.qsf
|
||||
RECURSIVE = YES
|
||||
EXCLUDE =
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS =
|
||||
EXCLUDE_SYMBOLS =
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS = *
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
IMAGE_PATH =
|
||||
INPUT_FILTER =
|
||||
FILTER_PATTERNS =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
FILTER_SOURCE_PATTERNS =
|
||||
USE_MDFILE_AS_MAINPAGE =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to source browsing
|
||||
#---------------------------------------------------------------------------
|
||||
SOURCE_BROWSER = NO
|
||||
INLINE_SOURCES = NO
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
REFERENCED_BY_RELATION = NO
|
||||
REFERENCES_RELATION = NO
|
||||
REFERENCES_LINK_SOURCE = YES
|
||||
SOURCE_TOOLTIPS = YES
|
||||
USE_HTAGS = NO
|
||||
VERBATIM_HEADERS = YES
|
||||
CLANG_ASSISTED_PARSING = NO
|
||||
CLANG_OPTIONS =
|
||||
CLANG_DATABASE_PATH =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
ALPHABETICAL_INDEX = YES
|
||||
COLS_IN_ALPHA_INDEX = 5
|
||||
IGNORE_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_HTML = @GENERATE_HTML@
|
||||
HTML_OUTPUT = html
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
HTML_STYLESHEET =
|
||||
HTML_EXTRA_STYLESHEET =
|
||||
HTML_EXTRA_FILES =
|
||||
HTML_COLORSTYLE_HUE = 220
|
||||
HTML_COLORSTYLE_SAT = 100
|
||||
HTML_COLORSTYLE_GAMMA = 80
|
||||
HTML_TIMESTAMP = NO
|
||||
HTML_DYNAMIC_MENUS = YES
|
||||
HTML_DYNAMIC_SECTIONS = NO
|
||||
HTML_INDEX_NUM_ENTRIES = 100
|
||||
GENERATE_DOCSET = NO
|
||||
DOCSET_FEEDNAME = "Doxygen generated docs"
|
||||
DOCSET_BUNDLE_ID = org.doxygen.Project
|
||||
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
|
||||
DOCSET_PUBLISHER_NAME = Publisher
|
||||
GENERATE_HTMLHELP = NO
|
||||
CHM_FILE =
|
||||
HHC_LOCATION =
|
||||
GENERATE_CHI = NO
|
||||
CHM_INDEX_ENCODING =
|
||||
BINARY_TOC = NO
|
||||
TOC_EXPAND = NO
|
||||
GENERATE_QHP = NO
|
||||
QCH_FILE =
|
||||
QHP_NAMESPACE = org.doxygen.Project
|
||||
QHP_VIRTUAL_FOLDER = doc
|
||||
QHP_CUST_FILTER_NAME =
|
||||
QHP_CUST_FILTER_ATTRS =
|
||||
QHP_SECT_FILTER_ATTRS =
|
||||
QHG_LOCATION =
|
||||
GENERATE_ECLIPSEHELP = NO
|
||||
ECLIPSE_DOC_ID = org.doxygen.Project
|
||||
DISABLE_INDEX = NO
|
||||
GENERATE_TREEVIEW = YES
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
TREEVIEW_WIDTH = 250
|
||||
EXT_LINKS_IN_WINDOW = NO
|
||||
FORMULA_FONTSIZE = 10
|
||||
FORMULA_TRANSPARENT = YES
|
||||
USE_MATHJAX = NO
|
||||
MATHJAX_FORMAT = HTML-CSS
|
||||
MATHJAX_RELPATH = https://cdn.jsdelivr.net/npm/mathjax@2
|
||||
MATHJAX_EXTENSIONS =
|
||||
MATHJAX_CODEFILE =
|
||||
SEARCHENGINE = YES
|
||||
SERVER_BASED_SEARCH = NO
|
||||
EXTERNAL_SEARCH = NO
|
||||
SEARCHENGINE_URL =
|
||||
SEARCHDATA_FILE = searchdata.xml
|
||||
EXTERNAL_SEARCH_ID =
|
||||
EXTRA_SEARCH_MAPPINGS =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the LaTeX output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_LATEX = @GENERATE_LATEX@
|
||||
LATEX_OUTPUT = latex
|
||||
LATEX_CMD_NAME = latex
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
LATEX_MAKEINDEX_CMD = makeindex
|
||||
COMPACT_LATEX = NO
|
||||
PAPER_TYPE = a4
|
||||
EXTRA_PACKAGES =
|
||||
LATEX_HEADER =
|
||||
LATEX_FOOTER =
|
||||
LATEX_EXTRA_STYLESHEET =
|
||||
LATEX_EXTRA_FILES =
|
||||
PDF_HYPERLINKS = YES
|
||||
USE_PDFLATEX = YES
|
||||
LATEX_BATCHMODE = NO
|
||||
LATEX_HIDE_INDICES = NO
|
||||
LATEX_SOURCE_CODE = NO
|
||||
LATEX_BIB_STYLE = plain
|
||||
LATEX_TIMESTAMP = NO
|
||||
LATEX_EMOJI_DIRECTORY =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the RTF output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_RTF = NO
|
||||
RTF_OUTPUT = rtf
|
||||
COMPACT_RTF = NO
|
||||
RTF_HYPERLINKS = NO
|
||||
RTF_STYLESHEET_FILE =
|
||||
RTF_EXTENSIONS_FILE =
|
||||
RTF_SOURCE_CODE = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the man page output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_MAN = NO
|
||||
MAN_OUTPUT = man
|
||||
MAN_EXTENSION = .3
|
||||
MAN_SUBDIR =
|
||||
MAN_LINKS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the XML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_XML = @GENERATE_XML@
|
||||
XML_OUTPUT = xml
|
||||
XML_PROGRAMLISTING = YES
|
||||
XML_NS_MEMB_FILE_SCOPE = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the DOCBOOK output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_DOCBOOK = NO
|
||||
DOCBOOK_OUTPUT = docbook
|
||||
DOCBOOK_PROGRAMLISTING = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options for the AutoGen Definitions output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the Perl module output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_PERLMOD = NO
|
||||
PERLMOD_LATEX = NO
|
||||
PERLMOD_PRETTY = YES
|
||||
PERLMOD_MAKEVAR_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the preprocessor
|
||||
#---------------------------------------------------------------------------
|
||||
ENABLE_PREPROCESSING = YES
|
||||
MACRO_EXPANSION = NO
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH =
|
||||
INCLUDE_FILE_PATTERNS =
|
||||
PREDEFINED =
|
||||
EXPAND_AS_DEFINED =
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES =
|
||||
GENERATE_TAGFILE =
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = YES
|
||||
EXTERNAL_PAGES = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
CLASS_DIAGRAMS = YES
|
||||
DIA_PATH =
|
||||
HIDE_UNDOC_RELATIONS = YES
|
||||
HAVE_DOT = YES
|
||||
DOT_NUM_THREADS = 0
|
||||
DOT_FONTNAME = Helvetica
|
||||
DOT_FONTSIZE = 10
|
||||
DOT_FONTPATH =
|
||||
CLASS_GRAPH = YES
|
||||
COLLABORATION_GRAPH = YES
|
||||
GROUP_GRAPHS = YES
|
||||
UML_LOOK = YES
|
||||
UML_LIMIT_NUM_FIELDS = 10
|
||||
TEMPLATE_RELATIONS = YES
|
||||
INCLUDE_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
CALL_GRAPH = YES
|
||||
CALLER_GRAPH = YES
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
DIRECTORY_GRAPH = YES
|
||||
DOT_IMAGE_FORMAT = png
|
||||
INTERACTIVE_SVG = YES
|
||||
DOT_PATH = @DOXYGEN_DOT_PATH@
|
||||
DOTFILE_DIRS =
|
||||
MSCFILE_DIRS =
|
||||
DIAFILE_DIRS =
|
||||
PLANTUML_JAR_PATH =
|
||||
PLANTUML_CFG_FILE =
|
||||
PLANTUML_INCLUDE_PATH =
|
||||
DOT_GRAPH_MAX_NODES = 50
|
||||
MAX_DOT_GRAPH_DEPTH = 0
|
||||
DOT_TRANSPARENT = NO
|
||||
DOT_MULTI_TARGETS = NO
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
||||
|
185
MyxCMake/functions/doc/breathe-conf.py.in
Normal file
185
MyxCMake/functions/doc/breathe-conf.py.in
Normal file
@ -0,0 +1,185 @@
|
||||
#!@PYTHON_EXECUTABLE@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
# -- General configuration ------------------------------------------------
|
||||
|
||||
# At top on conf.py (with other import statements)
|
||||
import recommonmark
|
||||
from recommonmark.parser import CommonMarkParser
|
||||
from recommonmark.transform import AutoStructify
|
||||
from recommonmark.states import DummyStateMachine
|
||||
# Monkey patch to fix recommonmark 0.4 doc reference issues.
|
||||
orig_run_role = DummyStateMachine.run_role
|
||||
def run_role(self, name, options=None, content=None):
|
||||
if name == 'doc':
|
||||
name = 'any'
|
||||
return orig_run_role(self, name, options, content)
|
||||
DummyStateMachine.run_role = run_role
|
||||
|
||||
source_parsers = {
|
||||
'.md': CommonMarkParser
|
||||
}
|
||||
|
||||
# If your documentation needs a minimal Sphinx version, state it here.
|
||||
#
|
||||
# needs_sphinx = '1.0'
|
||||
|
||||
# Add any Sphinx extension module names here, as strings. They can be
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||
# ones.
|
||||
extensions = [
|
||||
'breathe', 'sphinx.ext.autosectionlabel', 'recommonmark'
|
||||
]
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ['_templates']
|
||||
|
||||
# The suffix(es) of source filenames.
|
||||
# You can specify multiple suffix as a list of string:
|
||||
#
|
||||
source_suffix = ['.rst', '.md']
|
||||
|
||||
# The master toctree document.
|
||||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = '@DOXYGEN_PROJECT_TITLE@'
|
||||
author = '@MYX_CMAKE_AUTHOR_NAME@'
|
||||
copyright = '© @MYX_CMAKE_YEAR@, ' + author
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '@PROJECT_VERSION@'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = ''
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
#
|
||||
# This is also used if you do content translation via gettext catalogs.
|
||||
# Usually you set "language" from the command line for these cases.
|
||||
language = None
|
||||
|
||||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
# This patterns also effect to html_static_path and html_extra_path
|
||||
exclude_patterns = ['_build', '_output', 'Thumbs.db', '.DS_Store']
|
||||
|
||||
# The name of the Pygments (syntax highlighting) style to use.
|
||||
pygments_style = 'sphinx'
|
||||
|
||||
# If true, `todo` and `todoList` produce output, else they produce nothing.
|
||||
todo_include_todos = False
|
||||
|
||||
# -- Options for HTML output ----------------------------------------------
|
||||
|
||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||
# a list of builtin themes.
|
||||
#
|
||||
html_theme = 'sphinx_rtd_theme'
|
||||
|
||||
# Theme options are theme-specific and customize the look and feel of a theme
|
||||
# further. For a list of options available for each theme, see the
|
||||
# documentation.
|
||||
#
|
||||
# html_theme_options = {}
|
||||
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||
html_static_path = []
|
||||
|
||||
# Custom sidebar templates, must be a dictionary that maps document names
|
||||
# to template names.
|
||||
#
|
||||
# This is required for the alabaster theme
|
||||
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
|
||||
html_sidebars = {
|
||||
'**': [
|
||||
'relations.html', # needs 'show_related': True theme option to display
|
||||
'searchbox.html',
|
||||
]
|
||||
}
|
||||
|
||||
# -- Options for HTMLHelp output ------------------------------------------
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = '@CMAKE_PROJECT_NAME@doc'
|
||||
|
||||
# -- Options for LaTeX output ---------------------------------------------
|
||||
|
||||
latex_elements = {
|
||||
# The paper size ('letterpaper' or 'a4paper').
|
||||
#
|
||||
# 'papersize': 'letterpaper',
|
||||
|
||||
# The font size ('10pt', '11pt' or '12pt').
|
||||
#
|
||||
# 'pointsize': '10pt',
|
||||
|
||||
# Additional stuff for the LaTeX preamble.
|
||||
#
|
||||
# 'preamble': '',
|
||||
|
||||
# Latex figure (float) alignment
|
||||
#
|
||||
# 'figure_align': 'htbp',
|
||||
}
|
||||
|
||||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
# (source start file, target name, title,
|
||||
# author, documentclass [howto, manual, or own class]).
|
||||
latex_documents = [
|
||||
(master_doc, '@CMAKE_PROJECT_NAME@.tex', '@CMAKE_PROJECT_NAME@ Documentation',
|
||||
author, 'manual'),
|
||||
]
|
||||
|
||||
# -- Options for manual page output ---------------------------------------
|
||||
|
||||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [(master_doc, '@CMAKE_PROJECT_NAME@', '@CMAKE_PROJECT_NAME@ Documentation', [author], 1)]
|
||||
|
||||
# -- Options for Texinfo output -------------------------------------------
|
||||
|
||||
# Grouping the document tree into Texinfo files. List of tuples
|
||||
# (source start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
(master_doc, '@CMAKE_PROJECT_NAME@', '@CMAKE_PROJECT_NAME@ Documentation', author, '@CMAKE_PROJECT_NAME@',
|
||||
'One line description of project.', 'Miscellaneous'),
|
||||
]
|
||||
|
||||
breathe_projects = {'@CMAKE_PROJECT_NAME@': '@BREATHE_DOXYGEN_DIR@/xml'}
|
||||
|
||||
|
||||
def run_doxygen(folder):
|
||||
"""Run the doxygen make command in the designated folder"""
|
||||
|
||||
try:
|
||||
retcode = subprocess.call("cd {}; doxygen".format(folder), shell=True)
|
||||
if retcode < 0:
|
||||
sys.stderr.write(
|
||||
"doxygen terminated by signal {}".format(-retcode))
|
||||
except OSError as e:
|
||||
sys.stderr.write("doxygen execution failed: {}".format(e))
|
||||
|
||||
|
||||
def setup(app):
|
||||
run_doxygen('@BREATHE_DOXYGEN_DIR@')
|
||||
app.add_config_value('recommonmark_config', {
|
||||
'enable_auto_toc_tree': True,
|
||||
'enable_eval_rst': True,
|
||||
'enable_auto_doc_ref': True,
|
||||
'enable_math': True,
|
||||
'enable_inline_math': True
|
||||
}, True)
|
||||
app.add_transform(AutoStructify)
|
@ -1,23 +1,32 @@
|
||||
# Создание динамической библиотеки из объектной библиотеки
|
||||
function(myx_cmake_add_shared_library target)
|
||||
get_target_property(__target_type ${target} TYPE)
|
||||
if(NOT __target_type STREQUAL OBJECT_LIBRARY)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"MyxCMake: myx_cmake_add_shared_library needs target of type OBJECT_LIBRARY")
|
||||
myx_cmake_canonical_string(${target} _ctarget)
|
||||
option(BUILD_${_ctarget}_SHARED "build shared library ${_ctarget}" ON)
|
||||
if(NOT BUILD_${_ctarget}_SHARED)
|
||||
return()
|
||||
endif()
|
||||
|
||||
add_library(${target}-shared SHARED $<TARGET_OBJECTS:${target}>)
|
||||
set_target_properties(
|
||||
${target}-shared
|
||||
PROPERTIES OUTPUT_NAME ${target}
|
||||
VERSION ${PROJECT_VERSION}
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR}
|
||||
LIBRARY_OUTPUT_DIRECTORY
|
||||
${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
|
||||
install(TARGETS ${target}-shared
|
||||
COMPONENT main
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
get_target_property(__target_type ${target} TYPE)
|
||||
if(NOT __target_type STREQUAL OBJECT_LIBRARY)
|
||||
myx_cmake_message_error("MyxCMake: myx_cmake_add_shared_library needs target of type OBJECT_LIBRARY")
|
||||
endif()
|
||||
|
||||
get_target_property(__output_name ${target} OUTPUT_NAME)
|
||||
if(NOT __output_name)
|
||||
set(__output_name ${target})
|
||||
endif()
|
||||
|
||||
add_library(${target}-shared SHARED $<TARGET_OBJECTS:${target}>)
|
||||
# cmake-format: off
|
||||
set_target_properties(${target}-shared
|
||||
PROPERTIES
|
||||
OUTPUT_NAME ${__output_name}
|
||||
VERSION ${PROJECT_VERSION}
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR}
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
|
||||
install(TARGETS
|
||||
${target}-shared
|
||||
COMPONENT main
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
# cmake-format: on
|
||||
endfunction()
|
||||
|
@ -1,20 +1,30 @@
|
||||
# Создание статической библиотеки из объектной библиотеки
|
||||
function(myx_cmake_add_static_library target)
|
||||
get_target_property(__target_type ${target} TYPE)
|
||||
if(NOT __target_type STREQUAL OBJECT_LIBRARY)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"MyxCMake: myx_cmake_add_static_library needs target of type OBJECT_LIBRARY")
|
||||
myx_cmake_canonical_string(${target} _ctarget)
|
||||
option(BUILD_${_ctarget}_STATIC "build static library ${_ctarget}" ON)
|
||||
if(NOT BUILD_${_ctarget}_STATIC)
|
||||
return()
|
||||
endif()
|
||||
|
||||
get_target_property(__target_type ${target} TYPE)
|
||||
if(NOT __target_type STREQUAL OBJECT_LIBRARY)
|
||||
myx_cmake_message_error("MyxCMake: myx_cmake_add_static_library needs target of type OBJECT_LIBRARY")
|
||||
endif()
|
||||
|
||||
get_target_property(__output_name ${target} OUTPUT_NAME)
|
||||
if(NOT __output_name)
|
||||
set(__output_name ${target})
|
||||
endif()
|
||||
|
||||
add_library(${target}-static STATIC $<TARGET_OBJECTS:${target}>)
|
||||
# cmake-format: off
|
||||
set_target_properties(${target}-static
|
||||
PROPERTIES
|
||||
OUTPUT_NAME ${target}
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
|
||||
install(TARGETS ${target}-static
|
||||
COMPONENT static
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
|
||||
OUTPUT_NAME ${__output_name}
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
|
||||
install(TARGETS
|
||||
${target}-static
|
||||
COMPONENT static
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
# cmake-format: on
|
||||
endfunction()
|
||||
|
@ -2,24 +2,21 @@ cmake_policy(PUSH)
|
||||
cmake_policy(SET CMP0057 NEW) # IN_LIST operator
|
||||
|
||||
option(MYX_CMAKE_ENABLE_WARNING_FLAGS "Enable autodetected warning flags" ON)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS
|
||||
ON
|
||||
CACHE BOOL "Enable generation of compile_commands.json." FORCE)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON
|
||||
CACHE BOOL "Enable generation of compile_commands.json" FORCE)
|
||||
|
||||
# Добавление конфигурации для профилирования
|
||||
if(CMAKE_CONFIGURATION_TYPES)
|
||||
if(NOT "Profile" IN_LIST CMAKE_CONFIGURATION_TYPES)
|
||||
if(NOT Profile IN_LIST CMAKE_CONFIGURATION_TYPES)
|
||||
list(APPEND CMAKE_CONFIGURATION_TYPES Profile)
|
||||
endif()
|
||||
else()
|
||||
set(_allowed_build_types None Debug Release Profile RelWithDebInfo MinSizeRel)
|
||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${_allowed_build_types})
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE
|
||||
Debug
|
||||
CACHE STRING "" FORCE)
|
||||
set(CMAKE_BUILD_TYPE Debug CACHE STRING "" FORCE)
|
||||
elseif(NOT "${CMAKE_BUILD_TYPE}" IN_LIST _allowed_build_types)
|
||||
message(FATAL_ERROR "Invalid build type: ${CMAKE_BUILD_TYPE}")
|
||||
myx_cmake_message_error("Invalid build type: ${CMAKE_BUILD_TYPE}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@ -52,20 +49,15 @@ if(CMAKE_BUILD_TYPE STREQUAL Profile)
|
||||
elseif(CMAKE_CXX_COMPILER_IS_MSVC)
|
||||
message("Set options for profiling with Visual Studio C++")
|
||||
endif()
|
||||
set(CMAKE_VERBOSE_MAKEFILE
|
||||
ON
|
||||
CACHE BOOL "Enable generation of verbose build scripts." FORCE)
|
||||
set(CMAKE_VERBOSE_MAKEFILE ON
|
||||
CACHE BOOL "Enable generation of verbose build scripts." FORCE)
|
||||
elseif(CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
# В режиме отладки подробный вывод сообщений компилятора
|
||||
if(CMAKE_CXX_COMPILER_IS_CLANG OR CMAKE_CXX_COMPILER_IS_GCC)
|
||||
string(REPLACE " ${_gcc_debug_flags}" "" CMAKE_C_FLAGS_DEBUG
|
||||
"${CMAKE_C_FLAGS_DEBUG}")
|
||||
set(CMAKE_C_FLAGS_DEBUG
|
||||
"${CMAKE_C_FLAGS_DEBUG} ${_gcc_debug_flags}"
|
||||
CACHE STRING "" FORCE)
|
||||
string(REPLACE " ${_gcc_debug_flags}" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${_gcc_debug_flags}" CACHE STRING "" FORCE)
|
||||
|
||||
string(REPLACE " ${_gcc_debug_flags}" "" CMAKE_CXX_FLAGS_DEBUG
|
||||
"${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
string(REPLACE " ${_gcc_debug_flags}" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
if(MYX_CMAKE_ENABLE_WARNING_FLAGS)
|
||||
set(CMAKE_CXX_FLAGS_DEBUG
|
||||
"${CMAKE_CXX_FLAGS_DEBUG} ${MYX_CMAKE_DETECTED_CXX_FLAGS_DEBUG} ${_gcc_debug_flags}"
|
||||
@ -76,18 +68,15 @@ elseif(CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
CACHE STRING "" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
set(CMAKE_VERBOSE_MAKEFILE
|
||||
ON
|
||||
CACHE BOOL "Enable generation of verbose build scripts." FORCE)
|
||||
set(CMAKE_VERBOSE_MAKEFILE ON
|
||||
CACHE BOOL "Enable generation of verbose build scripts." FORCE)
|
||||
elseif(CMAKE_BUILD_TYPE STREQUAL Release)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE
|
||||
"${CMAKE_CXX_FLAGS_RELEASE} ${MYX_CMAKE_DETECTED_CXX_FLAGS}"
|
||||
CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${MYX_CMAKE_DETECTED_CXX_FLAGS}"
|
||||
CACHE STRING "" FORCE)
|
||||
elseif(CMAKE_BUILD_TYPE STREQUAL None)
|
||||
# Режим None используется для статического анализа кода
|
||||
set(CMAKE_VERBOSE_MAKEFILE
|
||||
ON
|
||||
CACHE BOOL "Enable generation of verbose build scripts." FORCE)
|
||||
set(CMAKE_VERBOSE_MAKEFILE ON
|
||||
CACHE BOOL "Enable generation of verbose build scripts." FORCE)
|
||||
endif()
|
||||
|
||||
unset(_gcc_debug_flags)
|
||||
|
@ -24,32 +24,32 @@ set(CPACK_SOURCE_PACKAGE_FILE_NAME "${MYX_CMAKE_PROJECT_NAME_LOWER}-${CPACK_PACK
|
||||
|
||||
# Список масок для исключения из архива исходных текстов
|
||||
set(CPACK_SOURCE_IGNORE_FILES
|
||||
"${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$")
|
||||
"${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$")
|
||||
|
||||
option(MYX_CMAKE_COMPACT_SOURCE_PACKAGE "Make compact source package" ON)
|
||||
if(MYX_CMAKE_COMPACT_SOURCE_PACKAGE)
|
||||
# Список масок для исключения из архива исходных текстов для более компактного архива
|
||||
set(CPACK_SOURCE_IGNORE_FILES
|
||||
"${CPACK_SOURCE_IGNORE_FILES}"
|
||||
"\\\\.git"
|
||||
"/\\\\.git/"
|
||||
"/\\\\.gitlab-ci/"
|
||||
"\\\\.clang-tidy$"
|
||||
"\\\\.cmake-format$"
|
||||
"\\\\.gitignore$"
|
||||
"\\\\.gitattributes$"
|
||||
"\\\\.gitmodules$"
|
||||
"\\\\.gitlab-ci.yml$")
|
||||
${CPACK_SOURCE_IGNORE_FILES}
|
||||
"\\\\.git"
|
||||
"/\\\\.git/"
|
||||
"/\\\\.gitlab-ci/"
|
||||
"\\\\.clang-tidy$"
|
||||
"\\\\.cmake-format$"
|
||||
"\\\\.gitignore$"
|
||||
"\\\\.gitattributes$"
|
||||
"\\\\.gitmodules$"
|
||||
"\\\\.gitlab-ci.yml$")
|
||||
endif()
|
||||
|
||||
set(CPACK_PROJECT_CONFIG_FILE ${CMAKE_CURRENT_LIST_DIR}/MyxCMakeCPackProject.cmake)
|
||||
|
@ -29,24 +29,24 @@ if(MYX_CMAKE_CPACK_DEFAULT_SCHEME)
|
||||
# Правило формирования имени пакета и файла для компонента main
|
||||
set(CPACK_DEBIAN_MAIN_PACKAGE_NAME "${MYX_CMAKE_PROJECT_NAME_LOWER}")
|
||||
set(CPACK_DEBIAN_MAIN_FILE_NAME
|
||||
${MYX_CMAKE_PROJECT_NAME_LOWER}_${CPACK_PACKAGE_VERSION}_${CPACK_TARGET_ARCH}.deb)
|
||||
${MYX_CMAKE_PROJECT_NAME_LOWER}_${CPACK_PACKAGE_VERSION}_${CPACK_TARGET_ARCH}.deb)
|
||||
|
||||
# Правило формирования имени пакета и файла для компонента dev
|
||||
set(CPACK_DEBIAN_DEV_PACKAGE_NAME "lib${MYX_CMAKE_PROJECT_NAME_LOWER}-dev")
|
||||
set(CPACK_DEBIAN_DEV_FILE_NAME
|
||||
lib${MYX_CMAKE_PROJECT_NAME_LOWER}-dev_${CPACK_PACKAGE_VERSION}_${CPACK_TARGET_ARCH}.deb)
|
||||
lib${MYX_CMAKE_PROJECT_NAME_LOWER}-dev_${CPACK_PACKAGE_VERSION}_${CPACK_TARGET_ARCH}.deb)
|
||||
|
||||
# Правило формирования имени пакета и файла для компонента static
|
||||
set(CPACK_DEBIAN_STATIC_PACKAGE_NAME "lib${MYX_CMAKE_PROJECT_NAME_LOWER}-static-dev")
|
||||
set(CPACK_DEBIAN_STATIC_FILE_NAME
|
||||
lib${MYX_CMAKE_PROJECT_NAME_LOWER}-static-dev_${CPACK_PACKAGE_VERSION}_${CPACK_TARGET_ARCH}.deb)
|
||||
lib${MYX_CMAKE_PROJECT_NAME_LOWER}-static-dev_${CPACK_PACKAGE_VERSION}_${CPACK_TARGET_ARCH}.deb)
|
||||
|
||||
set(CPACK_DEBIAN_STATIC_PACKAGE_DEPENDS "lib${MYX_CMAKE_PROJECT_NAME_LOWER}-dev")
|
||||
|
||||
# Правило формирования имени пакета и файла для компонента doc
|
||||
set(CPACK_DEBIAN_DOC_PACKAGE_NAME "${MYX_CMAKE_PROJECT_NAME_LOWER}-doc")
|
||||
set(CPACK_DEBIAN_DOC_FILE_NAME
|
||||
${MYX_CMAKE_PROJECT_NAME_LOWER}-doc_${CPACK_PACKAGE_VERSION}_${CPACK_TARGET_ARCH}.deb)
|
||||
${MYX_CMAKE_PROJECT_NAME_LOWER}-doc_${CPACK_PACKAGE_VERSION}_${CPACK_TARGET_ARCH}.deb)
|
||||
|
||||
foreach(component ${CPACK_COMPONENTS_ALL})
|
||||
string(TOLOWER ${component} _cl)
|
||||
@ -55,7 +55,7 @@ if(MYX_CMAKE_CPACK_DEFAULT_SCHEME)
|
||||
if(NOT ${_cl} STREQUAL main AND NOT ${_cl} STREQUAL dev AND NOT ${_cl} STREQUAL static)
|
||||
set(CPACK_DEBIAN_${_cu}_PACKAGE_NAME "${MYX_CMAKE_PROJECT_NAME_LOWER}-${_cl}")
|
||||
set(CPACK_DEBIAN_${_cu}_FILE_NAME
|
||||
"${MYX_CMAKE_PROJECT_NAME_LOWER}-${_cl}_${CPACK_PACKAGE_VERSION}_${CPACK_TARGET_ARCH}.deb")
|
||||
"${MYX_CMAKE_PROJECT_NAME_LOWER}-${_cl}_${CPACK_PACKAGE_VERSION}_${CPACK_TARGET_ARCH}.deb")
|
||||
endif()
|
||||
|
||||
# Если в каталоге ${CMAKE_SOURCE_DIR}/cmake/deb/${_cl} находятся сценарии сопровождающего
|
||||
|
@ -10,13 +10,13 @@ get_filename_component(_binary_realpath "${CMAKE_BINARY_DIR}" REALPATH)
|
||||
get_filename_component(_install_realpath "${CMAKE_INSTALL_PREFIX}" REALPATH)
|
||||
|
||||
if(_install_realpath STREQUAL _binary_realpath)
|
||||
message(FATAL_ERROR "MyxCMake: Cannot install into build directory.")
|
||||
myx_cmake_message_error("MyxCMake: Cannot install into build directory.")
|
||||
endif()
|
||||
|
||||
if(_install_realpath STREQUAL _source_realpath)
|
||||
message(FATAL_ERROR "MyxCMake: Cannot install into source directory.")
|
||||
myx_cmake_message_error("MyxCMake: Cannot install into source directory.")
|
||||
endif()
|
||||
|
||||
if(_source_realpath STREQUAL _binary_realpath)
|
||||
message(FATAL_ERROR "MyxCMake: In-source builds are not allowed.")
|
||||
myx_cmake_message_error("MyxCMake: In-source builds are not allowed.")
|
||||
endif()
|
||||
|
@ -0,0 +1,8 @@
|
||||
set(CLANG_APPLY_REPLACEMENTS_NAMES clang-apply-replacements)
|
||||
foreach(V RANGE 9 15)
|
||||
list(INSERT CLANG_APPLY_REPLACEMENTS_NAMES 0 "clang-apply-replacements-${V}")
|
||||
endforeach()
|
||||
unset(V)
|
||||
|
||||
find_program(CLANG_APPLY_REPLACEMENTS_EXE NAMES ${CLANG_APPLY_REPLACEMENTS_NAMES})
|
||||
unset(CLANG_APPLY_REPLACEMENTS_NAMES)
|
@ -2,32 +2,33 @@ set(CLANG_CHECK_NAMES clang-check)
|
||||
foreach(V RANGE 9 15)
|
||||
list(INSERT CLANG_CHECK_NAMES 0 "clang-check-${V}")
|
||||
endforeach()
|
||||
unset(V)
|
||||
|
||||
find_program(CLANG_CHECK_EXE NAMES ${CLANG_CHECK_NAMES})
|
||||
if(CLANG_CHECK_EXE)
|
||||
option(MYX_CMAKE_CLANG_CHECK_FIX "MyxCMake: perform fixes for Clang Check" OFF)
|
||||
endif()
|
||||
unset(V)
|
||||
unset(CLANG_CHECK_NAMES)
|
||||
|
||||
function(myx_cmake_clang_check_analyze target)
|
||||
set(_args --analyze --extra-arg="-Wno-unknown-warning-option")
|
||||
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$")
|
||||
|
||||
function(myx_cmake_analyze_clang_check target)
|
||||
if(CLANG_CHECK_EXE)
|
||||
if(MYX_CMAKE_CLANG_ANALYZE_FIX)
|
||||
set(_args --analyze --extra-arg=-Wno-unknown-warning-option)
|
||||
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$")
|
||||
|
||||
if(MYX_CMAKE_CLANG_CHECK_FIX)
|
||||
list(APPEND _args "--fixit")
|
||||
endif()
|
||||
if(NOT TARGET myx-cmake-clang-check-analyze)
|
||||
add_custom_target(myx-cmake-clang-check-analyze)
|
||||
if(NOT TARGET myx-cmake-analyze-clang-check)
|
||||
add_custom_target(myx-cmake-analyze-clang-check)
|
||||
endif()
|
||||
add_custom_target(${target}-clang-check-analyze WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
COMMAND ${CLANG_CHECK_EXE} ${_args} -p ${CMAKE_BINARY_DIR} ${__sources})
|
||||
add_dependencies(${target}-clang-check-analyze ${target})
|
||||
add_dependencies(myx-cmake-clang-check-analyze ${target}-clang-check-analyze)
|
||||
add_custom_target(${target}-analyze-clang-check
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
COMMAND ${CLANG_CHECK_EXE} ${_args} -p ${CMAKE_BINARY_DIR} ${__sources})
|
||||
add_dependencies(${target}-analyze-clang-check ${target})
|
||||
add_dependencies(myx-cmake-analyze-clang-check ${target}-analyze-clang-check)
|
||||
else()
|
||||
message(STATUS "MyxCMake: Clang Check analyzer is not found")
|
||||
endif()
|
||||
|
@ -2,32 +2,33 @@ set(CLANG_TIDY_NAMES clang-tidy)
|
||||
foreach(V RANGE 9 15)
|
||||
list(INSERT CLANG_TIDY_NAMES 0 "clang-tidy-${V}")
|
||||
endforeach()
|
||||
unset(V)
|
||||
|
||||
find_program(CLANG_TIDY_EXE NAMES ${CLANG_TIDY_NAMES})
|
||||
if(CLANG_TIDY_EXE)
|
||||
option(MYX_CMAKE_CLANG_TIDY_FIX "MyxCMake: perform fixes for Clang Tidy" OFF)
|
||||
endif()
|
||||
unset(V)
|
||||
unset(CLANG_TIDY_NAMES)
|
||||
|
||||
function(myx_cmake_clang_tidy_analyze target)
|
||||
set(_args -extra-arg="-Wno-unknown-warning-option")
|
||||
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$")
|
||||
|
||||
function(myx_cmake_analyze_clang_tidy target)
|
||||
if(CLANG_TIDY_EXE)
|
||||
set(_args -extra-arg="-Wno-unknown-warning-option")
|
||||
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$")
|
||||
|
||||
if(MYX_CMAKE_CLANG_TIDY_FIX)
|
||||
list(APPEND _args "--fix")
|
||||
list(APPEND _args "-fix-errors")
|
||||
endif()
|
||||
if(NOT TARGET myx-cmake-clang-tidy-analyze)
|
||||
add_custom_target(myx-cmake-clang-tidy-analyze)
|
||||
if(NOT TARGET myx-cmake-analyze-clang-tidy)
|
||||
add_custom_target(myx-cmake-analyze-clang-tidy)
|
||||
endif()
|
||||
add_custom_target(${target}-clang-tidy-analyze WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
COMMAND ${CLANG_TIDY_EXE} ${_args} -p ${CMAKE_BINARY_DIR} ${__sources})
|
||||
add_dependencies(${target}-clang-tidy-analyze ${target})
|
||||
add_dependencies(myx-cmake-clang-tidy-analyze ${target}-clang-tidy-analyze)
|
||||
add_custom_target(${target}-analyze-clang-tidy
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
COMMAND ${CLANG_TIDY_EXE} ${_args} -p ${CMAKE_BINARY_DIR} ${__sources})
|
||||
add_dependencies(${target}-analyze-clang-tidy ${target})
|
||||
add_dependencies(myx-cmake-analyze-clang-tidy ${target}-analyze-clang-tidy)
|
||||
else()
|
||||
message(STATUS "MyxCMake: Clang Tidy analyzer is not found")
|
||||
endif()
|
||||
|
@ -1,56 +1,43 @@
|
||||
find_program(CLAZY_EXE NAMES clazy-standalone)
|
||||
|
||||
set(CLANG_APPLY_REPLACEMENTS_NAMES clang-apply-replacements)
|
||||
foreach(V RANGE 9 15)
|
||||
list(INSERT CLANG_APPLY_REPLACEMENTS 0 "clang-apply-replacements-${V}")
|
||||
endforeach()
|
||||
|
||||
find_program(CLANG_APPLY_REPLACEMENTS_EXE NAMES ${CLANG_APPLY_REPLACEMENTS_NAMES})
|
||||
if(CLANG_TIDY_EXE)
|
||||
option(MYX_CMAKE_CLANG_TIDY_FIX "MyxCMake: perform fixes for Clang Tidy" OFF)
|
||||
endif()
|
||||
unset(V)
|
||||
unset(CLANG_TIDY_NAMES)
|
||||
|
||||
if(CLAZY_EXE AND CLANG_APPLY_REPLACEMENTS_EXE)
|
||||
option(MYX_CMAKE_CLAZY_FIX "MyxCMake: perform fixes for Clazy" OFF)
|
||||
endif()
|
||||
|
||||
function(myx_cmake_clazy_analyze target)
|
||||
set(options)
|
||||
set(oneValueArgs CHECKS)
|
||||
set(multiValueArgs)
|
||||
|
||||
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
if(NOT ARG_CHECKS)
|
||||
set(ARG_CHECKS "level2,container-inside-loop,heap-allocated-small-trivial-type,inefficient-qlist,isempty-vs-count,qt-keywords,unneeded-cast"
|
||||
)
|
||||
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$")
|
||||
set(_args -checks=${ARG_CHECKS} -extra-arg="-Wno-unknown-warning-option"
|
||||
-export-fixes=clazy-fixes-file.yaml)
|
||||
|
||||
function(myx_cmake_analyze_clazy target)
|
||||
if(CLAZY_EXE)
|
||||
if(NOT TARGET myx-cmake-clazy-analyze)
|
||||
add_custom_target(myx-cmake-clazy-analyze)
|
||||
set(options)
|
||||
set(oneValueArgs CHECKS)
|
||||
set(multiValueArgs)
|
||||
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
if(NOT ARG_CHECKS)
|
||||
set(ARG_CHECKS "level2,container-inside-loop,heap-allocated-small-trivial-type,inefficient-qlist,isempty-vs-count,qt-keywords,unneeded-cast")
|
||||
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$")
|
||||
set(_args -checks=${ARG_CHECKS}
|
||||
-extra-arg=-Wno-unknown-warning-option
|
||||
-export-fixes=clazy-fixes-file.yaml)
|
||||
|
||||
if(NOT TARGET myx-cmake-analyze-clazy)
|
||||
add_custom_target(myx-cmake-analyze-clazy)
|
||||
endif()
|
||||
if(MYX_CMAKE_CLAZY_FIX)
|
||||
add_custom_target(
|
||||
${target}-clazy-analyze
|
||||
add_custom_target(${target}-analyze-clazy
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
COMMAND ${CLAZY_EXE} ${_args} -p ${CMAKE_BINARY_DIR} ${__sources}
|
||||
COMMAND ${CLANG_APPLY_REPLACEMENTS_EXE} ${CMAKE_BINARY_DIR})
|
||||
else()
|
||||
add_custom_target(${target}-clazy-analyze WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
COMMAND ${CLAZY_EXE} ${_args} -p ${CMAKE_BINARY_DIR} ${__sources})
|
||||
add_custom_target(${target}-analyze-clazy
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
COMMAND ${CLAZY_EXE} ${_args} -p ${CMAKE_BINARY_DIR} ${__sources})
|
||||
endif()
|
||||
add_dependencies(${target}-clazy-analyze ${target})
|
||||
add_dependencies(myx-cmake-clazy-analyze ${target}-clazy-analyze)
|
||||
add_dependencies(${target}-analyze-clazy ${target})
|
||||
add_dependencies(myx-cmake-analyze-clazy ${target}-analyze-clazy)
|
||||
else()
|
||||
message(STATUS "MyxCMake: Clazy standalone analyzer is not found")
|
||||
endif()
|
||||
|
@ -1,63 +1,50 @@
|
||||
if(CMAKE_EXPORT_COMPILE_COMMANDS)
|
||||
find_program(PVS_STUDIO_ANALYZER_EXE NAMES pvs-studio-analyzer)
|
||||
include(PVS-Studio)
|
||||
find_program(PVS_STUDIO_ANALYZER_EXE pvs-studio-analyzer)
|
||||
find_program(PVS_STUDIO_CONVERTER_EXE plog-converter)
|
||||
else()
|
||||
message(STATUS "MyxCMake: CMAKE_EXPORT_COMPILE_COMMANDS is not set. PVS checks will be disabled.")
|
||||
endif()
|
||||
|
||||
function(myx_cmake_pvs_studio_analyze target)
|
||||
if(PVS_STUDIO_ANALYZER_EXE)
|
||||
if(NOT TARGET myx-cmake-pvs-studio-analyze)
|
||||
add_custom_target(myx-cmake-pvs-studio-analyze)
|
||||
endif()
|
||||
function(myx_cmake_analyze_pvs_studio target)
|
||||
if(PVS_STUDIO_ANALYZER_EXE AND PVS_STUDIO_CONVERTER_EXE)
|
||||
set(options)
|
||||
set(oneValueArgs CHECKS)
|
||||
set(multiValueArgs)
|
||||
if(NOT TARGET myx-cmake-analyze-pvs-studio)
|
||||
set(PVS_STUDIO_HEADER "${CMAKE_BINARY_DIR}/include/myx_cmake_pvs_studio_header_p.hpp")
|
||||
file(WRITE ${PVS_STUDIO_HEADER}
|
||||
"#ifndef MYX_CMAKE_PVS_STUDIO_HEADER_HPP_\n"
|
||||
"#define MYX_CMAKE_PVS_STUDIO_HEADER_HPP_\n"
|
||||
"#pragma once\n"
|
||||
"//-V813_MINSIZE=33\n"
|
||||
"#endif // MYX_CMAKE_PVS_STUDIO_HEADER_HPP_\n")
|
||||
|
||||
set(PVS_STUDIO_CONFIG "${CMAKE_BINARY_DIR}/PVS-Studio-${target}.cfg")
|
||||
set(PVS_STUDIO_CONFIG_COMMAND "${CMAKE_COMMAND}" -E echo "sourcetree-root=${CMAKE_SOURCE_DIR}" > "${PVS_STUDIO_CONFIG}")
|
||||
pvs_studio_add_target(TARGET myx-cmake-analyze-pvs-studio
|
||||
LOG
|
||||
COMPILE_COMMANDS
|
||||
HIDE_HELP
|
||||
OUTPUT FORMAT errorfile
|
||||
ARGS --exclude-path ${CMAKE_CURRENT_BINARY_DIR}/${target}_autogen
|
||||
MODE GA:1,2,3;64:1;OP:1,2;CS:1,2)
|
||||
|
||||
add_custom_command(OUTPUT "${PVS_STUDIO_CONFIG}"
|
||||
COMMAND ${PVS_STUDIO_CONFIG_COMMAND}
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
|
||||
COMMENT "Generating PVS-Studio.cfg")
|
||||
get_target_property(__target_type ${target} TYPE)
|
||||
if(${__target_type} STREQUAL INTERFACE_LIBRARY)
|
||||
set(__target_type INTERFACE)
|
||||
else()
|
||||
set(__target_type PRIVATE)
|
||||
endif()
|
||||
if(MSVC)
|
||||
target_compile_options(${target} BEFORE ${__target_type} /FI ${PVS_STUDIO_HEADER})
|
||||
else() # GCC/Clang
|
||||
target_compile_options(${target} BEFORE ${__target_type} -include ${PVS_STUDIO_HEADER})
|
||||
endif()
|
||||
|
||||
set(PVS_STUDIO_HEADER "${CMAKE_BINARY_DIR}/include/pvs_studio_suppression_${target}.hpp")
|
||||
file(WRITE ${PVS_STUDIO_HEADER}
|
||||
"#ifndef PVS_STUDIO_HPP_\n"
|
||||
"#define PVS_STUDIO_HPP_\n"
|
||||
"#pragma once\n"
|
||||
"//-V813_MINSIZE=33\n"
|
||||
"#endif // PVS_STUDIO_HPP_\n"
|
||||
)
|
||||
|
||||
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$")
|
||||
|
||||
pvs_studio_add_target(
|
||||
TARGET ${target}-pvs-studio-analyze
|
||||
CONFIG ${PVS_STUDIO_CONFIG}
|
||||
DEPENDS ${PVS_STUDIO_CONFIG}
|
||||
LOG "${CMAKE_BINARY_DIR}/PVS-Studio-${target}.log"
|
||||
SOURCES ${__sources}
|
||||
COMPILE_COMMANDS HIDE_HELP
|
||||
OUTPUT FORMAT errorfile
|
||||
ARGS --exclude-path ${CMAKE_CURRENT_BINARY_DIR}/${target}_autogen
|
||||
MODE GA:1,2,3;64:1;OP:1,2;CS:1,2)
|
||||
|
||||
add_dependencies(myx-cmake-pvs-studio-analyze ${target}-pvs-studio-analyze)
|
||||
|
||||
get_target_property(__target_type ${target} TYPE)
|
||||
if(${__target_type} STREQUAL INTERFACE_LIBRARY)
|
||||
set(__target_type INTERFACE)
|
||||
else()
|
||||
set(__target_type PRIVATE)
|
||||
endif()
|
||||
if(MSVC)
|
||||
target_compile_options(${target} BEFORE ${__target_type} /FI ${PVS_STUDIO_HEADER})
|
||||
else() # GCC/Clang
|
||||
target_compile_options(${target} BEFORE ${__target_type} -include ${PVS_STUDIO_HEADER})
|
||||
add_dependencies(myx-cmake-analyze-pvs-studio ${target})
|
||||
get_target_property(__target_source_dir "${target}" SOURCE_DIR)
|
||||
pvs_studio_analyze_target("${target}" "${__target_source_dir}")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "MyxCMake: PVS-Studio analyzer is not found")
|
||||
message(STATUS "MyxCMake: pvs-studio-analyzer not found.")
|
||||
endif()
|
||||
endfunction()
|
||||
|
@ -6,27 +6,37 @@ if(MYX_CMAKE_CODE_COVERAGE)
|
||||
endif()
|
||||
|
||||
function(myx_cmake_code_coverage target)
|
||||
if(CMAKE_CXX_COMPILER_IS_GCC AND MYX_CMAKE_CODE_COVERAGE)
|
||||
target_compile_options(${target} PUBLIC "--coverage")
|
||||
set_property(
|
||||
TARGET ${target}
|
||||
APPEND_STRING
|
||||
PROPERTY LINK_FLAGS " --coverage")
|
||||
if(MYX_CMAKE_CODE_COVERAGE)
|
||||
if(CMAKE_CXX_COMPILER_IS_GCC)
|
||||
target_compile_options(${target} PUBLIC "--coverage")
|
||||
set_property(
|
||||
TARGET ${target}
|
||||
APPEND_STRING
|
||||
PROPERTY LINK_FLAGS " --coverage")
|
||||
endif()
|
||||
if(CMAKE_CXX_COMPILER_IS_CLANG)
|
||||
target_compile_options(${target} PUBLIC "-fprofile-instr-generate -fcoverage-mapping")
|
||||
set_property(
|
||||
TARGET ${target}
|
||||
APPEND_STRING
|
||||
PROPERTY LINK_FLAGS " --coverage")
|
||||
endif()
|
||||
|
||||
if(LCOV_EXE)
|
||||
add_custom_target(
|
||||
${target}-coverage
|
||||
add_custom_target(${target}-coverage
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
COMMAND ${LCOV_EXE} --test-name ${target} --output "${target}.lcov"
|
||||
--capture --directory ${CMAKE_BINARY_DIR})
|
||||
COMMAND ${LCOV_EXE} --test-name ${target} --output "${target}.lcov" --capture
|
||||
--no-external
|
||||
--base-directory ${CMAKE_SOURCE_DIR}
|
||||
--directory ${CMAKE_BINARY_DIR})
|
||||
# --exclude "/usr/\\\*"
|
||||
# --exclude "${CMAKE_BINARY_DIR}/\\\*"
|
||||
add_dependencies(${target}-coverage ${target})
|
||||
|
||||
if(GENHTML_EXE)
|
||||
add_custom_target(
|
||||
${target}-coverage-report
|
||||
add_custom_target(${target}-coverage-report
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
COMMAND ${GENHTML_EXE} --output-directory "${target}-coverage-html"
|
||||
"${target}.lcov")
|
||||
COMMAND ${GENHTML_EXE} --output-directory "${target}-coverage-html" "${target}.lcov")
|
||||
add_dependencies(${target}-coverage-report ${target}-coverage)
|
||||
endif()
|
||||
endif()
|
||||
|
39
MyxCMake/modules/MyxCMakeColoredMessages.cmake
Normal file
39
MyxCMake/modules/MyxCMakeColoredMessages.cmake
Normal file
@ -0,0 +1,39 @@
|
||||
if(DEFINED ENV{TERM} AND UNIX)
|
||||
string(ASCII 27 Esc)
|
||||
set(MyxCMakeColorReset "${Esc}[m")
|
||||
set(MyxCMakeColorBold "${Esc}[1m")
|
||||
set(MyxCMakeColorRed "${Esc}[31m")
|
||||
set(MyxCMakeColorGreen "${Esc}[32m")
|
||||
set(MyxCMakeColorYellow "${Esc}[33m")
|
||||
set(MyxCMakeColorBlue "${Esc}[34m")
|
||||
set(MyxCMakeColorMagenta "${Esc}[35m")
|
||||
set(MyxCMakeColorCyan "${Esc}[36m")
|
||||
set(MyxCMakeColorWhite "${Esc}[37m")
|
||||
set(MyxCMakeColorBoldRed "${Esc}[1;31m")
|
||||
set(MyxCMakeColorBoldGreen "${Esc}[1;32m")
|
||||
set(MyxCMakeColorBoldYellow "${Esc}[1;33m")
|
||||
set(MyxCMakeColorBoldBlue "${Esc}[1;34m")
|
||||
set(MyxCMakeColorBoldMagenta "${Esc}[1;35m")
|
||||
set(MyxCMakeColorBoldCyan "${Esc}[1;36m")
|
||||
set(MyxCMakeColorBoldWhite "${Esc}[1;37m")
|
||||
endif()
|
||||
|
||||
function(myx_cmake_message_error)
|
||||
message(FATAL_ERROR ${MyxCMakeColorBoldRed}${ARGV}${MyxCMakeColorReset})
|
||||
endfunction()
|
||||
|
||||
function(myx_cmake_message_warning)
|
||||
message(WARNING ${MyxCMakeColorRed}${ARGV}${MyxCMakeColorReset})
|
||||
endfunction()
|
||||
|
||||
function(myx_cmake_message_status)
|
||||
message(STATUS ${MyxCMakeColorMagenta}${ARGV}${MyxCMakeColorReset})
|
||||
endfunction()
|
||||
|
||||
function(myx_cmake_message_notice)
|
||||
message(${MyxCMakeColorBold}${ARGV}${MyxCMakeColorReset})
|
||||
endfunction()
|
||||
|
||||
function(myx_cmake_message)
|
||||
message(${MyxCMakeColorReset}${ARGV}${MyxCMakeColorReset})
|
||||
endfunction()
|
@ -1,18 +1,20 @@
|
||||
cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
include(MyxCMakeColoredMessages)
|
||||
include(MyxCMakeCheckPaths)
|
||||
|
||||
set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS
|
||||
${CMAKE_CXX_SOURCE_FILE_EXTENSIONS};tpp;tcc)
|
||||
link_directories(${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
|
||||
set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS ${CMAKE_CXX_SOURCE_FILE_EXTENSIONS};tpp;tcc)
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
|
||||
include(MyxCMakeProjectVersion)
|
||||
include(MyxCMakeRequiredVariables)
|
||||
include(MyxCMakeGlobalFunctions)
|
||||
include(MyxCMakeGlobalVariables)
|
||||
include(MyxCMakeToday)
|
||||
include(MyxCMakeDates)
|
||||
include(MyxCMakeLSBInfo)
|
||||
include(MyxCMakePaths)
|
||||
include(MyxCMakeCompiler)
|
||||
include(MyxCMakeCompilerFlags)
|
||||
include(MyxCMakeDistCC)
|
||||
@ -21,6 +23,7 @@ include(MyxCMakePrecompiledHeaders)
|
||||
include(MyxCMakeBuildTypes)
|
||||
include(MyxCMakeDebugOutputOptions)
|
||||
|
||||
include(MyxCMakeCodeAnalyzeApplyReplacements)
|
||||
include(MyxCMakeCodeAnalyzeClangCheck)
|
||||
include(MyxCMakeCodeAnalyzeClangTidy)
|
||||
include(MyxCMakeCodeAnalyzeClazy)
|
||||
@ -32,14 +35,12 @@ include(MyxCMakeAddSharedLibrary)
|
||||
include(MyxCMakeAddStaticLibrary)
|
||||
include(MyxCMakePkgConfig)
|
||||
include(MyxCMakeNinjaGeneratorHelper)
|
||||
|
||||
# include(CMLibDocDoxygen) include(CMLibDocBreathe)
|
||||
# include(CMLibExternalProject)
|
||||
|
||||
include(MyxCMakeDocDoxygen)
|
||||
include(MyxCMakeDocBreathe)
|
||||
include(MyxCMakeExternalProject)
|
||||
include(MyxCMakeCPack)
|
||||
include(MyxCMakeUninstall)
|
||||
|
||||
|
||||
# Additional functions
|
||||
include(MyxCMakeGenerateGitInfoHeader)
|
||||
include(MyxCMakeGeneratePrivateConfigHeader)
|
||||
|
@ -1,4 +1,7 @@
|
||||
function(myx_cmake_common_target_properties target)
|
||||
if(NOT TARGET ${target})
|
||||
myx_cmake_message_error("MyxCMake: Target ${target} does not exists.")
|
||||
endif()
|
||||
get_target_property(_target_type ${target} TYPE)
|
||||
|
||||
set(__visibility PUBLIC)
|
||||
@ -8,8 +11,7 @@ function(myx_cmake_common_target_properties target)
|
||||
#
|
||||
if(TARGET Qt5::Core)
|
||||
if(_target_type STREQUAL EXECUTABLE)
|
||||
target_compile_options(${target}
|
||||
PUBLIC ${Qt5Core_EXECUTABLE_COMPILE_FLAGS})
|
||||
target_compile_options(${target} PUBLIC ${Qt5Core_EXECUTABLE_COMPILE_FLAGS})
|
||||
endif()
|
||||
if(NOT MYX_CMAKE_DEBUG_OUTPUT)
|
||||
target_compile_definitions(${target} PUBLIC QT_NO_DEBUG_OUTPUT)
|
||||
@ -48,19 +50,15 @@ function(myx_cmake_common_target_properties target)
|
||||
|
||||
endif()
|
||||
|
||||
target_compile_features(${target} ${__visibility} cxx_alias_templates
|
||||
cxx_nullptr cxx_override)
|
||||
target_compile_features(${target} ${__visibility} cxx_alias_templates cxx_nullptr cxx_override)
|
||||
if(_target_type STREQUAL EXECUTABLE)
|
||||
set_target_properties(${target} PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
set_target_properties(
|
||||
${target} PROPERTIES RUNTIME_OUTPUT_DIRECTORY
|
||||
${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR})
|
||||
set_target_properties(${target} PROPERTIES
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR})
|
||||
if(CMAKE_CXX_COMPILE_OPTIONS_PIE)
|
||||
target_compile_options(${target} PUBLIC ${CMAKE_CXX_COMPILE_OPTIONS_PIE})
|
||||
endif()
|
||||
if(CMAKE_CXX_COMPILER_IS_GCC AND MYX_CMAKE_CODE_COVERAGE)
|
||||
myx_cmake_code_coverage(${target})
|
||||
endif()
|
||||
install(TARGETS ${target} COMPONENT main RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
@ -91,15 +89,6 @@ function(myx_cmake_common_target_properties target)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# cmake-format: off
|
||||
if(COMMAND cotire)
|
||||
set_property(TARGET ${target}
|
||||
PROPERTY COTIRE_ENABLE_PRECOMPILED_HEADER ${MYX_CMAKE_PRECOMPILED_HEADERS})
|
||||
set_property(TARGET ${target}
|
||||
PROPERTY COTIRE_ADD_UNITY_BUILD ${MYX_CMAKE_UNITY_BUILD})
|
||||
endif()
|
||||
# cmake-format: on
|
||||
|
||||
if(CMAKE_BUILD_TYPE STREQUAL Profile)
|
||||
target_compile_definitions(${target} ${__visibility} PROFILE)
|
||||
elseif(CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
@ -116,12 +105,19 @@ function(myx_cmake_common_target_properties target)
|
||||
${target} ${__visibility}
|
||||
"MYX_CMAKE_LSB_CODENAME_${MYX_CMAKE_LSB_CODENAME}")
|
||||
|
||||
myx_cmake_clang_tidy_analyze(${target})
|
||||
myx_cmake_clang_check_analyze(${target})
|
||||
myx_cmake_clazy_analyze(${target})
|
||||
myx_cmake_pvs_studio_analyze(${target})
|
||||
myx_cmake_analyze_clang_tidy(${target})
|
||||
myx_cmake_analyze_clang_check(${target})
|
||||
myx_cmake_analyze_clazy(${target})
|
||||
myx_cmake_analyze_pvs_studio(${target})
|
||||
myx_cmake_format_sources(${target})
|
||||
|
||||
if(_target_type MATCHES "_LIBRARY$" AND NOT ${target}-install-headers)
|
||||
# Цель, используемая только для установки заголовочных файлов без компиляции проекта
|
||||
add_custom_target(${target}-install-headers
|
||||
COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=dev
|
||||
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
|
||||
endif()
|
||||
|
||||
# Создание в каталоге ${CMAKE_BINARY_DIR} стандартных каталогов bin,include,lib
|
||||
if(NOT TARGET ${target}-default-directories)
|
||||
add_custom_target(
|
||||
@ -135,9 +131,8 @@ function(myx_cmake_common_target_properties target)
|
||||
endif()
|
||||
|
||||
# Создание в каталоге ${CMAKE_BINARY_DIR} символических ссылок на каталоги в ${CMAKE_SOURCE_DIR}/files
|
||||
if(NOT TARGET ${target}-symlinks AND UNIX)
|
||||
add_custom_target(
|
||||
${target}-symlinks
|
||||
if(NOT TARGET myx-cmake-symlinks-to-project-directories AND UNIX)
|
||||
add_custom_target(myx-cmake-symlinks-to-project-directories
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
# Ссылка на каталог с журналами
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_SOURCE_DIR}/files/log
|
||||
@ -151,6 +146,30 @@ function(myx_cmake_common_target_properties target)
|
||||
# Ссылка на каталог настроек
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_SOURCE_DIR}/files/etc
|
||||
${CMAKE_BINARY_DIR}/etc)
|
||||
add_dependencies(${target} ${target}-symlinks)
|
||||
add_dependencies(${target} myx-cmake-symlinks-to-project-directories)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(myx_cmake_common_target_properties_post_link target)
|
||||
if(NOT TARGET ${target})
|
||||
myx_cmake_message_error("MyxCMake: Target ${target} does not exists.")
|
||||
endif()
|
||||
get_target_property(_target_type ${target} TYPE)
|
||||
|
||||
# cmake-format: off
|
||||
if(COMMAND cotire)
|
||||
set_property(TARGET ${target}
|
||||
PROPERTY COTIRE_ENABLE_PRECOMPILED_HEADER ${MYX_CMAKE_PRECOMPILED_HEADERS})
|
||||
set_property(TARGET ${target}
|
||||
PROPERTY COTIRE_ADD_UNITY_BUILD ${MYX_CMAKE_UNITY_BUILD})
|
||||
endif()
|
||||
# cmake-format: on
|
||||
|
||||
if(NOT _target_type STREQUAL INTERFACE_LIBRARY)
|
||||
if(CMAKE_CXX_COMPILER_IS_GCC AND MYX_CMAKE_CODE_COVERAGE)
|
||||
myx_cmake_code_coverage(${target})
|
||||
endif()
|
||||
add_sanitizers(${target})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
# C compiler name
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "Intel")
|
||||
set(CMAKE_C_COMPILER_IS_INTEL ON)
|
||||
elseif(CMAKE_C_COMPILER_ID STREQUAL "Clang" OR CMAKE_C_COMPILER_ID STREQUAL
|
||||
"AppleClang")
|
||||
elseif(CMAKE_C_COMPILER_ID STREQUAL "Clang" OR
|
||||
CMAKE_C_COMPILER_ID STREQUAL "AppleClang")
|
||||
set(CMAKE_C_COMPILER_IS_CLANG ON)
|
||||
elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
set(CMAKE_C_COMPILER_IS_GCC ON)
|
||||
@ -13,8 +13,8 @@ endif()
|
||||
# C++ compiler name
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
set(CMAKE_CXX_COMPILER_IS_INTEL ON)
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL
|
||||
"AppleClang")
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR
|
||||
CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
||||
set(CMAKE_CXX_COMPILER_IS_CLANG ON)
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
set(CMAKE_CXX_COMPILER_IS_GCC ON)
|
||||
@ -25,13 +25,12 @@ endif()
|
||||
# Предпочтительные пути к утилитам для компоновки
|
||||
if(CMAKE_CXX_COMPILER_IS_GCC)
|
||||
# Astra Linux Smolensk 1.5
|
||||
if(MYX_CMAKE_LSB_DISTRIBUTOR_ID STREQUAL "AstraLinuxSE"
|
||||
AND MYX_CMAKE_LSB_CODENAME STREQUAL "smolensk"
|
||||
AND MYX_CMAKE_LSB_RELEASE STREQUAL "1.5")
|
||||
if(MYX_CMAKE_LSB_DISTRIBUTOR_ID STREQUAL "AstraLinuxSE" AND
|
||||
MYX_CMAKE_LSB_CODENAME STREQUAL "smolensk" AND
|
||||
MYX_CMAKE_LSB_RELEASE STREQUAL "1.5")
|
||||
find_program(CMAKE_GCC_AR NAMES "/usr/bin/x86_64-linux-gnu-gcc-ar-4.7")
|
||||
find_program(CMAKE_GCC_NM NAMES "/usr/bin/x86_64-linux-gnu-gcc-nm-4.7")
|
||||
find_program(CMAKE_GCC_RANLIB
|
||||
NAMES "/usr/bin/x86_64-linux-gnu-gcc-ranlib-4.7")
|
||||
find_program(CMAKE_GCC_RANLIB NAMES "/usr/bin/x86_64-linux-gnu-gcc-ranlib-4.7")
|
||||
# Elbrus E2K
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "e2k")
|
||||
find_program(CMAKE_GCC_AR
|
||||
@ -47,18 +46,12 @@ if(CMAKE_CXX_COMPILER_IS_GCC)
|
||||
endif()
|
||||
|
||||
if(CMAKE_GCC_AR)
|
||||
set(CMAKE_AR
|
||||
${CMAKE_GCC_AR}
|
||||
CACHE STRING "" FORCE)
|
||||
set(CMAKE_AR ${CMAKE_GCC_AR} CACHE STRING "" FORCE)
|
||||
endif()
|
||||
if(CMAKE_GCC_NM)
|
||||
set(CMAKE_NM
|
||||
${CMAKE_GCC_NM}
|
||||
CACHE STRING "" FORCE)
|
||||
set(CMAKE_NM ${CMAKE_GCC_NM} CACHE STRING "" FORCE)
|
||||
endif()
|
||||
if(CMAKE_GCC_RANLIB)
|
||||
set(CMAKE_RANLIB
|
||||
${CMAKE_GCC_RANLIB}
|
||||
CACHE STRING "" FORCE)
|
||||
set(CMAKE_RANLIB ${CMAKE_GCC_RANLIB} CACHE STRING "" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
@ -8,11 +8,11 @@ macro(CHECK_ENABLE_CXX_FLAG flag)
|
||||
unset(CMAKE_REQUIRED_QUIET)
|
||||
|
||||
if(CHECK_CXX_FLAG)
|
||||
message(STATUS "'${flag}': flag is supported.")
|
||||
myx_cmake_message_notice("'${flag}': flag is supported.")
|
||||
string(CONCAT _MYX_CMAKE_DETECTED_CXX_FLAGS
|
||||
"${_MYX_CMAKE_DETECTED_CXX_FLAGS} ${flag}")
|
||||
else()
|
||||
message(STATUS "'${flag}': flag is NOT supported.")
|
||||
myx_cmake_message_status("'${flag}': flag is NOT supported.")
|
||||
endif()
|
||||
# NOTE: check_cxx_compiler stores variables in the cache.
|
||||
unset(CHECK_CXX_FLAG CACHE)
|
||||
@ -25,11 +25,11 @@ macro(CHECK_ENABLE_DEBUG_CXX_FLAG flag)
|
||||
unset(CMAKE_REQUIRED_QUIET)
|
||||
|
||||
if(CHECK_CXX_FLAG_DEBUG)
|
||||
message(STATUS "'${flag}': debug flag is supported.")
|
||||
myx_cmake_message_notice("'${flag}': debug flag is supported.")
|
||||
string(CONCAT _MYX_CMAKE_DETECTED_CXX_FLAGS_DEBUG
|
||||
"${_MYX_CMAKE_DETECTED_CXX_FLAGS_DEBUG} ${flag}")
|
||||
else()
|
||||
message(STATUS "'${flag}': debug flag is NOT supported.")
|
||||
myx_cmake_message_status("'${flag}': debug flag is NOT supported.")
|
||||
endif()
|
||||
# NOTE: check_cxx_compiler stores variables in the cache.
|
||||
unset(CHECK_CXX_FLAG_DEBUG CACHE)
|
||||
|
18
MyxCMake/modules/MyxCMakeDates.cmake
Normal file
18
MyxCMake/modules/MyxCMakeDates.cmake
Normal file
@ -0,0 +1,18 @@
|
||||
if(NOT MYX_CMAKE_TODAY)
|
||||
if(WIN32)
|
||||
execute_process(COMMAND "cmd" " /C date /T" OUTPUT_VARIABLE MYX_CMAKE_TODAY)
|
||||
else()
|
||||
execute_process(COMMAND "date" "+%d/%m/%Y" OUTPUT_VARIABLE MYX_CMAKE_TODAY)
|
||||
endif()
|
||||
string(REGEX REPLACE "(..)/(..)/(....).*" "\\3-\\2-\\1" MYX_CMAKE_TODAY ${MYX_CMAKE_TODAY})
|
||||
endif()
|
||||
|
||||
if(NOT MYX_CMAKE_YEAR)
|
||||
if(WIN32)
|
||||
execute_process(COMMAND "cmd" " /C date /T" OUTPUT_VARIABLE MYX_CMAKE_YEAR)
|
||||
else()
|
||||
execute_process(COMMAND "date" "+%d/%m/%Y" OUTPUT_VARIABLE MYX_CMAKE_YEAR)
|
||||
endif()
|
||||
string(REGEX REPLACE "(..)/(..)/(....).*" "\\3" MYX_CMAKE_YEAR ${MYX_CMAKE_YEAR})
|
||||
endif()
|
||||
|
@ -6,13 +6,7 @@ option(MYX_CMAKE_WARNING_OUTPUT "Enable warning output" OFF)
|
||||
# Если сборка производится в режиме для отладки, то включаются флаги для
|
||||
# разрешения отладочной печати
|
||||
if(CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
set(MYX_CMAKE_DEBUG_OUTPUT
|
||||
ON
|
||||
CACHE BOOL "" FORCE)
|
||||
set(MYX_CMAKE_INFO_OUTPUT
|
||||
ON
|
||||
CACHE BOOL "" FORCE)
|
||||
set(MYX_CMAKE_WARNING_OUTPUT
|
||||
ON
|
||||
CACHE BOOL "" FORCE)
|
||||
set(MYX_CMAKE_DEBUG_OUTPUT ON CACHE BOOL "" FORCE)
|
||||
set(MYX_CMAKE_INFO_OUTPUT ON CACHE BOOL "" FORCE)
|
||||
set(MYX_CMAKE_WARNING_OUTPUT ON CACHE BOOL "" FORCE)
|
||||
endif()
|
||||
|
@ -2,12 +2,12 @@ find_program(DISTCC_EXECUTABLE distcc)
|
||||
mark_as_advanced(DISTCC_EXECUTABLE)
|
||||
if(DISTCC_EXECUTABLE)
|
||||
foreach(lang C CXX)
|
||||
if(NOT DEFINED CMAKE_${lang}_COMPILER_LAUNCHER
|
||||
AND NOT CMAKE_${lang}_COMPILER MATCHES ".*/distcc$")
|
||||
message(STATUS "MyxCMake: distcc enabled for ${lang}")
|
||||
set(CMAKE_${lang}_COMPILER_LAUNCHER
|
||||
${DISTCC_EXECUTABLE}
|
||||
CACHE STRING "")
|
||||
# cmake-format: off
|
||||
if(NOT DEFINED CMAKE_${lang}_COMPILER_LAUNCHER AND
|
||||
NOT CMAKE_${lang}_COMPILER MATCHES ".*/distcc$")
|
||||
myx_cmake_message_notice("MyxCMake: distcc enabled for ${lang}")
|
||||
set(CMAKE_${lang}_COMPILER_LAUNCHER ${DISTCC_EXECUTABLE} CACHE STRING "")
|
||||
endif()
|
||||
# cmake-format: on
|
||||
endforeach()
|
||||
endif()
|
||||
|
49
MyxCMake/modules/MyxCMakeExternalProject.cmake
Normal file
49
MyxCMake/modules/MyxCMakeExternalProject.cmake
Normal file
@ -0,0 +1,49 @@
|
||||
include(ExternalProject)
|
||||
|
||||
if(CMAKE_BUILD_TYPE)
|
||||
list(APPEND MYX_CMAKE_EXTERNAL_PROJECT_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
|
||||
endif()
|
||||
|
||||
if(MYX_CMAKE_DIR)
|
||||
list(APPEND MYX_CMAKE_EXTERNAL_PROJECT_ARGS -DMYX_CMAKE_MAIN_DIR=${MYX_CMAKE_DIR})
|
||||
endif()
|
||||
|
||||
if(CMAKE_C_COMPILER)
|
||||
list(APPEND MYX_CMAKE_EXTERNAL_PROJECT_ARGS -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER})
|
||||
endif()
|
||||
|
||||
if(CMAKE_C_FLAGS)
|
||||
list(APPEND MYX_CMAKE_EXTERNAL_PROJECT_ARGS -E env "CFLAGS=${CMAKE_C_FLAGS}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_CPP_COMPILER)
|
||||
list(APPEND MYX_CMAKE_EXTERNAL_PROJECT_ARGS -DCMAKE_CPP_COMPILER=${CMAKE_CPP_COMPILER})
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_FLAGS)
|
||||
list(APPEND MYX_CMAKE_EXTERNAL_PROJECT_ARGS -E env "CXXFLAGS=${CMAKE_CXX_FLAGS}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_Fortran_COMPILER)
|
||||
list(APPEND MYX_CMAKE_EXTERNAL_PROJECT_ARGS -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER})
|
||||
endif()
|
||||
|
||||
if(CMAKE_Fortran_FLAGS)
|
||||
list(APPEND MYX_CMAKE_EXTERNAL_PROJECT_ARGS -E env "FFLAGS=${CMAKE_Fortran_FLAGS}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_INSTALL_PREFIX)
|
||||
list(APPEND MYX_CMAKE_EXTERNAL_PROJECT_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR})
|
||||
endif()
|
||||
|
||||
if(CMAKE_PREFIX_PATH)
|
||||
list(APPEND MYX_CMAKE_EXTERNAL_PROJECT_ARGS -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH})
|
||||
endif()
|
||||
|
||||
if(Qt5_DIR)
|
||||
list(APPEND MYX_CMAKE_EXTERNAL_PROJECT_ARGS -DQt5_DIR=${Qt5_DIR})
|
||||
endif()
|
||||
|
||||
if(Qt5Core_DIR)
|
||||
list(APPEND MYX_CMAKE_EXTERNAL_PROJECT_ARGS -DQt5Core_DIR=${Qt5Core_DIR})
|
||||
endif()
|
@ -1,42 +1,87 @@
|
||||
find_program(UNCRUSTIFY_EXE NAMES uncrustify)
|
||||
|
||||
if(UNCRUSTIFY_EXE)
|
||||
if(NOT EXISTS ${CMAKE_BINARY_DIR}/uncrustify-classheader.txt)
|
||||
file(GENERATE OUTPUT ${CMAKE_BINARY_DIR}/uncrustify-classheader.txt CONTENT
|
||||
"/**
|
||||
* @class $(fclass)
|
||||
* @brief TODO
|
||||
* @details TODO
|
||||
*/")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS ${CMAKE_BINARY_DIR}/uncrustify-filefooter.txt)
|
||||
file(GENERATE OUTPUT ${CMAKE_BINARY_DIR}/uncrustify-filefooter.txt CONTENT
|
||||
"// EOF $(filename)")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS ${CMAKE_BINARY_DIR}/uncrustify-fileheader.txt)
|
||||
file(GENERATE OUTPUT ${CMAKE_BINARY_DIR}/uncrustify-fileheader.txt CONTENT
|
||||
"/**
|
||||
* @file $(filename)
|
||||
* @brief TODO
|
||||
* @details TODO
|
||||
*/")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS ${CMAKE_BINARY_DIR}/uncrustify-funcheader.txt)
|
||||
file(GENERATE OUTPUT ${CMAKE_BINARY_DIR}/uncrustify-funcheader.txt CONTENT
|
||||
"/**
|
||||
* @fn $(fclass)::$(function)
|
||||
* $(javaparam)
|
||||
* @details TODO
|
||||
*/")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
function(myx_cmake_format_sources target)
|
||||
|
||||
if(NOT TARGET myx-cmake-format-sources)
|
||||
add_custom_target(myx-cmake-format-sources)
|
||||
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$")
|
||||
|
||||
if(NOT TARGET myx-cmake-format-sources)
|
||||
add_custom_target(myx-cmake-format-sources)
|
||||
endif()
|
||||
if(NOT TARGET myx-cmake-check-format-sources)
|
||||
add_custom_target(myx-cmake-check-format-sources)
|
||||
endif()
|
||||
if(NOT TARGET myx-cmake-add-doxygen-comments)
|
||||
add_custom_target(myx-cmake-add-doxygen-comments)
|
||||
endif()
|
||||
|
||||
find_program(UNCRUSTIFY_EXE NAMES uncrustify)
|
||||
if(UNCRUSTIFY_EXE)
|
||||
if(EXISTS ${CMAKE_SOURCE_DIR}/files/etc/uncrustify.cfg)
|
||||
list(APPEND UNCRUSTIFY_OPTS -c ${CMAKE_SOURCE_DIR}/files/etc/uncrustify.cfg)
|
||||
if(NOT TARGET myx-cmake-format-sources-check)
|
||||
add_custom_target(myx-cmake-format-sources-check)
|
||||
endif()
|
||||
if(NOT TARGET myx-cmake-doc-doxygen-append-comments)
|
||||
add_custom_target(myx-cmake-doc-doxygen-append-comments)
|
||||
endif()
|
||||
|
||||
if(EXISTS ${CMAKE_SOURCE_DIR}/.uncrustify.cfg)
|
||||
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/uncrustify-${target}.cfg
|
||||
COMMAND ${UNCRUSTIFY_EXE} --update-config-with-doc
|
||||
-c ${CMAKE_SOURCE_DIR}/.uncrustify.cfg
|
||||
-o ${CMAKE_BINARY_DIR}/uncrustify-${target}.cfg)
|
||||
list(APPEND UNCRUSTIFY_OPTS -c ${CMAKE_BINARY_DIR}/uncrustify-${target}.cfg)
|
||||
endif()
|
||||
# cmake-format: off
|
||||
add_custom_target(${target}-check-format-sources-uncrustify
|
||||
add_custom_target(${target}-format-sources-check-uncrustify
|
||||
DEPENDS ${CMAKE_BINARY_DIR}/uncrustify-${target}.cfg
|
||||
COMMAND ${UNCRUSTIFY_EXE} ${UNCRUSTIFY_OPTS} --check ${__sources})
|
||||
list(APPEND UNCRUSTIFY_OPTS --replace --no-backup)
|
||||
add_custom_target(${target}-format-sources-uncrustify
|
||||
DEPENDS ${CMAKE_BINARY_DIR}/uncrustify-${target}.cfg
|
||||
COMMAND ${UNCRUSTIFY_EXE} ${UNCRUSTIFY_OPTS} --mtime ${__sources})
|
||||
add_custom_target(${target}-add-doxygen-comments-uncrustify
|
||||
|
||||
add_custom_target(${target}-doc-doxygen-append-comments
|
||||
DEPENDS ${CMAKE_BINARY_DIR}/uncrustify-${target}.cfg
|
||||
COMMAND ${UNCRUSTIFY_EXE} ${UNCRUSTIFY_OPTS}
|
||||
--set cmt_insert_file_header=fileheader.txt
|
||||
--set cmt_insert_file_footer=filefooter.txt
|
||||
--set cmt_insert_func_header=funcheader.txt
|
||||
--set cmt_insert_class_header=classheader.txt
|
||||
--set cmt_insert_class_header=uncrustify-classheader.txt
|
||||
--set cmt_insert_file_footer=uncrustify-filefooter.txt
|
||||
--set cmt_insert_file_header=uncrustify-fileheader.txt
|
||||
--set cmt_insert_func_header=uncrustify-funcheader.txt
|
||||
--set cmt_insert_before_ctor_dtor=true ${__sources})
|
||||
# cmake-format: on
|
||||
add_dependencies(myx-cmake-check-format-sources ${target}-check-format-sources-uncrustify)
|
||||
add_dependencies(myx-cmake-format-sources ${target}-format-sources-uncrustify)
|
||||
add_dependencies(myx-cmake-add-doxygen-comments ${target}-add-doxygen-comments-uncrustify)
|
||||
add_dependencies(myx-cmake-format-sources-check ${target}-format-sources-check-uncrustify)
|
||||
add_dependencies(myx-cmake-doc-doxygen-append-comments ${target}-doc-doxygen-append-comments)
|
||||
else()
|
||||
message(STATUS "MyxCMake: uncrustify executable is not found")
|
||||
endif()
|
||||
@ -49,4 +94,9 @@ function(myx_cmake_format_sources target)
|
||||
else()
|
||||
message(STATUS "MyxCMake: dos2unix executable is not found")
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
add_custom_target(${target}-format-sources-unexec COMMAND chmod -x ${__sources})
|
||||
add_dependencies(myx-cmake-format-sources ${target}-format-sources-unexec)
|
||||
endif()
|
||||
endfunction()
|
||||
|
@ -2,9 +2,7 @@
|
||||
function(myx_cmake_canonical_string in_string out_string)
|
||||
string(TOUPPER ${in_string} _arg_uppercase)
|
||||
string(REGEX REPLACE "[ -]" "_" _arg_fixed ${_arg_uppercase})
|
||||
set(${out_string}
|
||||
${_arg_fixed}
|
||||
PARENT_SCOPE)
|
||||
set(${out_string} ${_arg_fixed} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Добавление общего префикса ко всем переменным в списке
|
||||
@ -13,7 +11,5 @@ function(myx_cmake_list_transform_prepend var prefix)
|
||||
foreach(filename ${${var}})
|
||||
list(APPEND temp "${prefix}${filename}")
|
||||
endforeach()
|
||||
set(${var}
|
||||
"${temp}"
|
||||
PARENT_SCOPE)
|
||||
set(${var} ${temp} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
@ -14,16 +14,12 @@ string(TOLOWER ${MYX_CMAKE_THEME_NAME_CANONICAL} MYX_CMAKE_THEME_NAME_LOWER)
|
||||
string(TOUPPER ${MYX_CMAKE_ORGANIZATION_NAME_CANONICAL} MYX_CMAKE_ORGANIZATION_NAME_UPPER)
|
||||
string(TOUPPER ${MYX_CMAKE_PROJECT_NAME_CANONICAL} MYX_CMAKE_PROJECT_NAME_UPPER)
|
||||
string(TOUPPER ${MYX_CMAKE_THEME_NAME_CANONICAL} MYX_CMAKE_THEME_NAME_UPPER)
|
||||
# cmake-format: on
|
||||
|
||||
option(MYX_CMAKE_ADD_THEME_PREFIX "Append theme name to install prefix" OFF)
|
||||
if(MYX_CMAKE_ADD_THEME_PREFIX AND NOT MYX_CMAKE_THEME_PREFIX_APPENDED)
|
||||
if(NOT MYX_CMAKE_THEME_NAME_LOWER STREQUAL "default")
|
||||
set(MYX_CMAKE_THEME_PREFIX_APPENDED
|
||||
ON
|
||||
CACHE BOOL "" FORCE)
|
||||
set(CMAKE_INSTALL_PREFIX
|
||||
"${CMAKE_INSTALL_PREFIX}/${MYX_CMAKE_THEME_NAME}"
|
||||
CACHE PATH "" FORCE)
|
||||
set(MYX_CMAKE_THEME_PREFIX_APPENDED ON CACHE BOOL "" FORCE)
|
||||
set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/${MYX_CMAKE_THEME_NAME}" CACHE PATH "" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
# cmake-format: on
|
||||
|
@ -24,6 +24,6 @@ else()
|
||||
execute_process(COMMAND ${_lsb_release_executable} -si OUTPUT_VARIABLE MYX_CMAKE_LSB_DISTRIBUTOR_ID OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(COMMAND ${_lsb_release_executable} -sc OUTPUT_VARIABLE MYX_CMAKE_LSB_CODENAME OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(COMMAND ${_lsb_release_executable} -sr OUTPUT_VARIABLE MYX_CMAKE_LSB_RELEASE OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
# cmake-format: on
|
||||
endif()
|
||||
# cmake-format: on
|
||||
endif()
|
||||
|
9
MyxCMake/modules/MyxCMakePaths.cmake
Normal file
9
MyxCMake/modules/MyxCMakePaths.cmake
Normal file
@ -0,0 +1,9 @@
|
||||
if(MYX_CMAKE_LSB_DISTRIBUTOR_ID STREQUAL "AstraLinuxSE" OR
|
||||
MYX_CMAKE_LSB_DISTRIBUTOR_ID STREQUAL "AstraLinuxCE")
|
||||
set(CMAKE_37_MODULES_DIR "/usr/share/cmake-3.7/Modules")
|
||||
if(IS_DIRECTORY ${CMAKE_37_MODULES_DIR})
|
||||
if(NOT ${CMAKE_37_MODULES_DIR} IN_LIST CMAKE_MODULE_PATH)
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_37_MODULES_DIR})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
@ -1,39 +1,42 @@
|
||||
function(myx_cmake_generate_pkgconfig target)
|
||||
set(options)
|
||||
set(oneVA COMPONENT)
|
||||
set(oneVA COMPONENT BASENAME)
|
||||
set(multiVA)
|
||||
|
||||
cmake_parse_arguments(ARG "${options}" "${oneVA}" "${multiVA}" ${ARGN})
|
||||
|
||||
if(NOT ARG_BASENAME)
|
||||
set(ARG_BASENAME ${target})
|
||||
endif()
|
||||
|
||||
if(NOT ARG_COMPONENT)
|
||||
set(ARG_COMPONENT dev)
|
||||
endif()
|
||||
|
||||
get_target_property(_target_type ${target} TYPE)
|
||||
|
||||
if(_target_type STREQUAL INTERFACE_LIBRARY)
|
||||
get_target_property(__target_type ${target} TYPE)
|
||||
if(__target_type STREQUAL INTERFACE_LIBRARY)
|
||||
file(
|
||||
WRITE "${CMAKE_BINARY_DIR}/${target}.pc"
|
||||
WRITE "${CMAKE_BINARY_DIR}/${ARG_BASENAME}.pc"
|
||||
"prefix=${CMAKE_INSTALL_PREFIX}\n"
|
||||
"exec_prefix=${CMAKE_INSTALL_PREFIX}\n"
|
||||
"includedir=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}\n"
|
||||
"\n"
|
||||
"Name: ${target}\n"
|
||||
"Description: ${target} header-only library\n"
|
||||
"Name: ${ARG_BASENAME}\n"
|
||||
"Description: ${ARG_BASENAME} header-only library\n"
|
||||
"Version: ${PROJECT_VERSION}\n"
|
||||
"\n"
|
||||
"Requires:\n"
|
||||
"Cflags: -I${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}\n")
|
||||
else()
|
||||
file(
|
||||
WRITE "${CMAKE_BINARY_DIR}/${target}.pc"
|
||||
WRITE "${CMAKE_BINARY_DIR}/${ARG_BASENAME}.pc"
|
||||
"prefix=${CMAKE_INSTALL_PREFIX}\n"
|
||||
"exec_prefix=${CMAKE_INSTALL_PREFIX}\n"
|
||||
"libdir=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}\n"
|
||||
"includedir=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}\n"
|
||||
"\n"
|
||||
"Name: ${target}\n"
|
||||
"Description: ${target} library\n"
|
||||
"Name: ${ARG_BASENAME}\n"
|
||||
"Description: ${ARG_BASENAME} library\n"
|
||||
"Version: ${PROJECT_VERSION}\n"
|
||||
"\n"
|
||||
"Requires:\n"
|
||||
@ -41,7 +44,7 @@ function(myx_cmake_generate_pkgconfig target)
|
||||
"Cflags: -I${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}\n")
|
||||
endif()
|
||||
install(
|
||||
FILES "${CMAKE_BINARY_DIR}/${target}.pc"
|
||||
FILES "${CMAKE_BINARY_DIR}/${ARG_BASENAME}.pc"
|
||||
COMPONENT ${ARG_COMPONENT}
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||
endfunction()
|
||||
|
@ -1,10 +1,10 @@
|
||||
# cmake-format: off
|
||||
if(${CMAKE_VERSION} VERSION_LESS "3.16.0")
|
||||
include(cotire OPTIONAL)
|
||||
if(COMMAND cotire)
|
||||
option(MYX_CMAKE_PRECOMPILED_HEADERS "MyxCMake: enable precompiled headers"
|
||||
OFF)
|
||||
option(MYX_CMAKE_PRECOMPILED_HEADERS "MyxCMake: enable precompiled headers" OFF)
|
||||
endif()
|
||||
else()
|
||||
option(MYX_CMAKE_PRECOMPILED_HEADERS "MyxCMake: enable precompiled headers"
|
||||
OFF)
|
||||
option(MYX_CMAKE_PRECOMPILED_HEADERS "MyxCMake: enable precompiled headers" OFF)
|
||||
endif()
|
||||
# cmake-format: on
|
||||
|
@ -1,17 +1,15 @@
|
||||
function(myx_cmake_check_project_version)
|
||||
if(NOT ${PROJECT_VERSION_PATCH} MATCHES "([0-9]+)")
|
||||
message(FATAL_ERROR "MyxCMake: Please set project version in X.Y.Z format")
|
||||
myx_cmake_message_error("MyxCMake: Please set project version in X.Y.Z format")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(myx_cmake_set_project_version_int)
|
||||
# cmake-format: off
|
||||
myx_cmake_check_project_version()
|
||||
math(
|
||||
EXPR
|
||||
_version_int
|
||||
"(${PROJECT_VERSION_MAJOR} << 16) + (${PROJECT_VERSION_MINOR} << 8) + ${PROJECT_VERSION_PATCH}"
|
||||
)
|
||||
math(EXPR _version_int "(${PROJECT_VERSION_MAJOR} << 16) + (${PROJECT_VERSION_MINOR} << 8) + ${PROJECT_VERSION_PATCH}")
|
||||
set_property(GLOBAL PROPERTY PROJECT_VERSION_INT ${_version_int})
|
||||
# cmake-format: on
|
||||
endfunction()
|
||||
|
||||
myx_cmake_set_project_version_int()
|
||||
|
@ -3,32 +3,25 @@
|
||||
# CMakeLists.txt до подключения MyxCMake, либо передать из командной строки
|
||||
# через ключ -D
|
||||
#
|
||||
|
||||
# cmake-format: off
|
||||
if(NOT MYX_CMAKE_ORGANIZATION_NAME)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"MyxCMake: Required variable MYX_CMAKE_ORGANIZATION_NAME is not defined")
|
||||
myx_cmake_message_error("MyxCMake: Required variable MYX_CMAKE_ORGANIZATION_NAME is not defined")
|
||||
endif()
|
||||
|
||||
if(NOT MYX_CMAKE_AUTHOR_NAME)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"MyxCMake: Required variable MYX_CMAKE_AUTHOR_NAME is not defined")
|
||||
myx_cmake_message_error("MyxCMake: Required variable MYX_CMAKE_AUTHOR_NAME is not defined")
|
||||
endif()
|
||||
|
||||
if(NOT MYX_CMAKE_AUTHOR_EMAIL)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"MyxCMake: Required variable MYX_CMAKE_AUTHOR_EMAIL is not defined")
|
||||
myx_cmake_message_error("MyxCMake: Required variable MYX_CMAKE_AUTHOR_EMAIL is not defined")
|
||||
endif()
|
||||
set(CPACK_PACKAGE_CONTACT
|
||||
"${MYX_CMAKE_AUTHOR_NAME} <${MYX_CMAKE_AUTHOR_EMAIL}>"
|
||||
CACHE STRING "")
|
||||
|
||||
if(NOT MYX_CMAKE_DESCRIPTION)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"MyxCMake: Required variable MYX_CMAKE_DESCRIPTION is not defined")
|
||||
myx_cmake_message_error("MyxCMake: Required variable MYX_CMAKE_DESCRIPTION is not defined")
|
||||
endif()
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
|
||||
${MYX_CMAKE_DESCRIPTION}
|
||||
CACHE STRING "")
|
||||
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${MYX_CMAKE_DESCRIPTION} CACHE STRING "")
|
||||
set(CPACK_PACKAGE_CONTACT "${MYX_CMAKE_AUTHOR_NAME} <${MYX_CMAKE_AUTHOR_EMAIL}>" CACHE STRING "")
|
||||
# cmake-format: on
|
||||
|
||||
|
@ -1,8 +0,0 @@
|
||||
if(NOT TODAY)
|
||||
if(WIN32)
|
||||
execute_process(COMMAND "cmd" " /C date /T" OUTPUT_VARIABLE TODAY)
|
||||
else()
|
||||
execute_process(COMMAND "date" "+%d/%m/%Y" OUTPUT_VARIABLE TODAY)
|
||||
endif()
|
||||
string(REGEX REPLACE "(..)/(..)/(....).*" "\\3-\\2-\\1" TODAY ${TODAY})
|
||||
endif()
|
48
MyxCMake/thirdparty/PVS-Studio.cmake
vendored
48
MyxCMake/thirdparty/PVS-Studio.cmake
vendored
@ -3,7 +3,7 @@
|
||||
#
|
||||
# Version 12
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
cmake_minimum_required(VERSION 3.0.0)
|
||||
cmake_policy(SET CMP0054 NEW)
|
||||
|
||||
if (PVS_STUDIO_AS_SCRIPT)
|
||||
@ -31,7 +31,8 @@ if (PVS_STUDIO_AS_SCRIPT)
|
||||
endif ()
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
|
||||
file(REMOVE "${PVS_STUDIO_LOG_FILE}")
|
||||
execute_process(COMMAND ${PVS_STUDIO_COMMAND} ${additional_args}
|
||||
RESULT_VARIABLE result
|
||||
OUTPUT_VARIABLE output
|
||||
@ -58,13 +59,17 @@ function (pvs_studio_log TEXT)
|
||||
endfunction ()
|
||||
|
||||
function (pvs_studio_relative_path VAR ROOT FILEPATH)
|
||||
if (WIN32)
|
||||
STRING(REGEX REPLACE "\\\\" "/" ROOT ${ROOT})
|
||||
STRING(REGEX REPLACE "\\\\" "/" FILEPATH ${FILEPATH})
|
||||
endif()
|
||||
set("${VAR}" "${FILEPATH}" PARENT_SCOPE)
|
||||
if ("${FILEPATH}" MATCHES "^/.*$" OR "${FILEPATH}" MATCHES "^.:/.*$")
|
||||
if (IS_ABSOLUTE "${FILEPATH}")
|
||||
file(RELATIVE_PATH RPATH "${ROOT}" "${FILEPATH}")
|
||||
if (NOT "${RPATH}" MATCHES "^\\.\\..*$")
|
||||
if (NOT IS_ABSOLUTE "${RPATH}")
|
||||
set("${VAR}" "${RPATH}" PARENT_SCOPE)
|
||||
endif ()
|
||||
endif ()
|
||||
endif()
|
||||
endif()
|
||||
endfunction ()
|
||||
|
||||
function (pvs_studio_join_path VAR DIR1 DIR2)
|
||||
@ -96,7 +101,7 @@ macro (pvs_studio_append_flags_from_property CXX C DIR PREFIX)
|
||||
endmacro ()
|
||||
|
||||
macro (pvs_studio_append_standard_flag FLAGS STANDARD)
|
||||
if ("${STANDARD}" MATCHES "^(99|11|14|17)$")
|
||||
if ("${STANDARD}" MATCHES "^(99|11|14|17|20)$")
|
||||
if ("${PVS_STUDIO_PREPROCESSOR}" MATCHES "gcc|clang")
|
||||
list(APPEND "${FLAGS}" "-std=c++${STANDARD}")
|
||||
endif ()
|
||||
@ -205,8 +210,9 @@ function (pvs_studio_analyze_file SOURCE SOURCE_DIR BINARY_DIR)
|
||||
|
||||
string(REPLACE ";" "$<SEMICOLON>" cmdline "${cmdline}")
|
||||
set(pvscmd "${CMAKE_COMMAND}"
|
||||
-D PVS_STUDIO_AS_SCRIPT=TRUE
|
||||
-D "PVS_STUDIO_AS_SCRIPT=TRUE"
|
||||
-D "PVS_STUDIO_COMMAND=${cmdline}"
|
||||
-D "PVS_STUDIO_LOG_FILE=${LOG}"
|
||||
-P "${PVS_STUDIO_SCRIPT}"
|
||||
)
|
||||
|
||||
@ -513,10 +519,14 @@ function (pvs_studio_add_target)
|
||||
if ("${PVS_STUDIO_FORMAT}" STREQUAL "")
|
||||
set(PVS_STUDIO_FORMAT "errorfile")
|
||||
endif ()
|
||||
set(converter_no_help "")
|
||||
if (PVS_STUDIO_HIDE_HELP)
|
||||
set(converter_no_help "--noHelpMessages")
|
||||
endif()
|
||||
list(APPEND COMMANDS
|
||||
COMMAND "${CMAKE_COMMAND}" -E remove -f "${PVS_STUDIO_LOG}.pvs.raw"
|
||||
COMMAND "${CMAKE_COMMAND}" -E rename "${PVS_STUDIO_LOG}" "${PVS_STUDIO_LOG}.pvs.raw"
|
||||
COMMAND "${PVS_STUDIO_CONVERTER}" "${PVS_STUDIO_CONVERTER_ARGS}" -t "${PVS_STUDIO_FORMAT}" "${PVS_STUDIO_LOG}.pvs.raw" -o "${PVS_STUDIO_LOG}" -a "${PVS_STUDIO_MODE}"
|
||||
COMMAND "${PVS_STUDIO_CONVERTER}" "${PVS_STUDIO_CONVERTER_ARGS}" ${converter_no_help} -t "${PVS_STUDIO_FORMAT}" "${PVS_STUDIO_LOG}.pvs.raw" -o "${PVS_STUDIO_LOG}" -a "${PVS_STUDIO_MODE}"
|
||||
)
|
||||
if(NOT PVS_STUDIO_KEEP_COMBINED_PLOG)
|
||||
list(APPEND COMMANDS COMMAND "${CMAKE_COMMAND}" -E remove -f "${PVS_STUDIO_LOG}.pvs.raw")
|
||||
@ -544,9 +554,7 @@ function (pvs_studio_add_target)
|
||||
endif ()
|
||||
|
||||
if (PVS_STUDIO_OUTPUT)
|
||||
if (PVS_STUDIO_HIDE_HELP AND NOT WIN32)
|
||||
set(COMMANDS COMMAND grep -v " error: Help:" ${PVS_STUDIO_LOG} 1>&2 || exit 0)
|
||||
elseif (WIN32)
|
||||
if (WIN32)
|
||||
set(COMMANDS COMMAND type "${PVS_STUDIO_LOG}" 1>&2)
|
||||
else ()
|
||||
set(COMMANDS COMMAND cat "${PVS_STUDIO_LOG}" 1>&2)
|
||||
@ -555,9 +563,25 @@ function (pvs_studio_add_target)
|
||||
set(COMMANDS "")
|
||||
endif ()
|
||||
|
||||
set(props_file "${CMAKE_BINARY_DIR}/${PVS_STUDIO_TARGET}.user.props")
|
||||
file(WRITE "${props_file}" [=[
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<CustomBuild>
|
||||
<BuildInParallel>true</BuildInParallel>
|
||||
</CustomBuild>
|
||||
</ItemDefinitionGroup>
|
||||
</Project>
|
||||
]=])
|
||||
|
||||
add_custom_target("${PVS_STUDIO_TARGET}" ${ALL} ${COMMANDS}
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
|
||||
DEPENDS ${PVS_STUDIO_DEPENDS} "${PVS_STUDIO_LOG}")
|
||||
set_target_properties("${PVS_STUDIO_TARGET}" PROPERTIES VS_USER_PROPS "${props_file}")
|
||||
|
||||
# A workaround to add implicit dependencies of source files from include directories
|
||||
set_target_properties("${PVS_STUDIO_TARGET}" PROPERTIES INCLUDE_DIRECTORIES "${inc_path}")
|
||||
|
@ -3,16 +3,19 @@
|
||||
set -e
|
||||
|
||||
V=$(grep -i "project.*VERSION.*LANGUAGES" CMakeLists.txt | sed 's/.*VERSION \([0-9.]*\) .*/\1/')
|
||||
D=$(mktemp -d "/tmp/myx-cmake.XXXXXX")
|
||||
D=build
|
||||
|
||||
mkdir -p "$D/myx-cmake-$V"
|
||||
cp -ap CMakeLists.txt MyxCMake "$D/myx-cmake-$V"
|
||||
pushd "$D"
|
||||
tar Jcf "myx-cmake_${V}.orig.tar.xz" "myx-cmake-$V"
|
||||
popd
|
||||
|
||||
cp -ap debian "$D/myx-cmake-$V"
|
||||
pushd "$D/myx-cmake-$V"
|
||||
dch -D unstable -v "${V}-1" -m "New version."
|
||||
debuild
|
||||
dpkg-buildpackage -us -uc
|
||||
popd
|
||||
cp -f ${D}/myx*deb .
|
||||
|
||||
rm -rf "$D/myx-cmake-$V"
|
||||
|
||||
|
5
debian/rules
vendored
5
debian/rules
vendored
@ -2,3 +2,8 @@
|
||||
|
||||
%:
|
||||
dh $@ --buildsystem=cmake
|
||||
|
||||
override_dh_fixperms:
|
||||
dh_fixperms
|
||||
find debian -name asan-wrapper -print0 | xargs -0 chmod +x
|
||||
|
||||
|
Reference in New Issue
Block a user