2.0.2
This commit is contained in:
parent
d31802ed95
commit
dbf3fe4d0e
4
Makefile
4
Makefile
@ -3,9 +3,9 @@ TOP_DIR:=$(shell pwd)
|
||||
BUILD_DIR:=$(TOP_DIR)/build
|
||||
DEB_DIR:=$(BUILD_DIR)/deb/myxx-cmake-$(V)
|
||||
|
||||
all: update_version deb pack
|
||||
all: v deb pack
|
||||
|
||||
update_version:
|
||||
v:
|
||||
sed -i "s/CMake.*REQUIRED/CMake $V REQUIRED/" $(TOP_DIR)/README.md
|
||||
sed -i "s/VERSION \".*\"/VERSION \"$V\"/" $(TOP_DIR)/MyxxCMake/MyxxCMakeConfigVersion.cmake
|
||||
sed -i "s/VERSION .* LANG/VERSION $V LANG/" $(TOP_DIR)/debian/CMakeLists.txt
|
||||
|
@ -7,8 +7,18 @@ if(NOT MyxCMake_DIR)
|
||||
message(FATAL_ERROR "MyxxCMake library required MyxCMake to work")
|
||||
endif()
|
||||
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
set(MYXX_CMAKE_LIB_DIR "${MYXX_CMAKE_SOURCE_DIR}/lib" CACHE PATH "")
|
||||
set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "Verbose build output" FORCE)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE BOOL "Enable generation of compile_commands.json" FORCE)
|
||||
|
||||
set(MYXX_CMAKE_LIB_DIR "${MYXX_CMAKE_SOURCE_DIR}/lib")
|
||||
|
||||
set(MYXX_CMAKE_SANITIZERS_DIR "${MYXX_CMAKE_LIB_DIR}/sanitizers")
|
||||
if(IS_DIRECTORY "${MYXX_CMAKE_SANITIZERS_DIR}")
|
||||
if(NOT ${MYXX_CMAKE_SANITIZERS_DIR} IN_LIST CMAKE_MODULE_PATH)
|
||||
list(INSERT CMAKE_MODULE_PATH 0 "${MYXX_CMAKE_SANITIZERS_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
find_package(Sanitizers REQUIRED)
|
||||
|
||||
include(${MYXX_CMAKE_LIB_DIR}/Coverage.cmake)
|
||||
include(${MYXX_CMAKE_LIB_DIR}/AnalyzeApplyReplacements.cmake)
|
||||
@ -16,8 +26,7 @@ include(${MYXX_CMAKE_LIB_DIR}/AnalyzeClangTidy.cmake)
|
||||
include(${MYXX_CMAKE_LIB_DIR}/AnalyzeClangCheck.cmake)
|
||||
include(${MYXX_CMAKE_LIB_DIR}/AnalyzeClazy.cmake)
|
||||
|
||||
include(${MYXX_CMAKE_SOURCE_DIR}/sanitizers/FindSanitizers.cmake)
|
||||
include(${MYXX_CMAKE_SOURCE_DIR}/pvs-studio/PVS-Studio.cmake)
|
||||
include(${MYXX_CMAKE_LIB_DIR}/pvs-studio/PVS-Studio.cmake)
|
||||
include(${MYXX_CMAKE_LIB_DIR}/AnalyzePvsStudio.cmake)
|
||||
|
||||
function(myxx)
|
||||
@ -31,6 +40,7 @@ function(myxx)
|
||||
myxx_analyze_clang_check(${iter})
|
||||
myxx_analyze_clazy(${iter})
|
||||
myxx_analyze_pvs_studio(${iter})
|
||||
myxx_add_sanitizers(${iter})
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction(myxx)
|
||||
|
@ -1,4 +1,4 @@
|
||||
set(MYXX_CMAKE_PACKAGE_VERSION "2.0.1")
|
||||
set(MYXX_CMAKE_PACKAGE_VERSION "2.0.2")
|
||||
if(MYXX_CMAKE_PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else()
|
||||
|
@ -1,54 +1,59 @@
|
||||
find_program(PVS_STUDIO_ANALYZER_EXE pvs-studio-analyzer)
|
||||
find_program(PVS_STUDIO_CONVERTER_EXE plog-converter)
|
||||
|
||||
if(${CMAKE_VERSION} VERSION_LESS "3.17.0")
|
||||
set(MYXX_CMAKE_LIB_PVS_DIR_BACKPORT ${CMAKE_CURRENT_LIST_DIR})
|
||||
endif()
|
||||
|
||||
function(myxx_analyze_pvs_studio target)
|
||||
if(PVS_STUDIO_ANALYZER_EXE)
|
||||
if(${CMAKE_VERSION} VERSION_LESS "3.17.0")
|
||||
set(CMAKE_CURRENT_FUNCTION_LIST_DIR ${MYXX_CMAKE_LIB_PVS_DIR_BACKPORT})
|
||||
endif()
|
||||
if(NOT PVS_STUDIO_ANALYZER_EXE)
|
||||
message(STATUS "MyxxCMake: pvs-studio-analyzer not found.")
|
||||
return()
|
||||
endif()
|
||||
if(PVS_STUDIO_CONVERTER_EXE)
|
||||
if(NOT PVS_STUDIO_CONVERTER_EXE)
|
||||
message(STATUS "MyxxCMake: pvs-studio-converter not found.")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(TARGET myx-cmake-analyze-pvs-studio)
|
||||
return()
|
||||
if(NOT TARGET myxx-analyze-pvs-studio)
|
||||
add_custom_target(myxx-analyze-pvs-studio)
|
||||
endif()
|
||||
|
||||
set(options)
|
||||
set(oneValueArgs CHECKS)
|
||||
set(multiValueArgs)
|
||||
set(oneValueArgs HEADER MODE)
|
||||
set(multiValueArgs ARGS)
|
||||
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
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")
|
||||
if(NOT ARG_HEADER)
|
||||
set(ARG_HEADER ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/pvs-studio/pvs_studio.hpp.in)
|
||||
endif()
|
||||
|
||||
pvs_studio_add_target(TARGET myx-cmake-analyze-pvs-studio
|
||||
LOG
|
||||
COMPILE_COMMANDS
|
||||
if(NOT ARG_MODE)
|
||||
set(ARG_MODE "GA:1,2,3;64:1,2,3;OP:1,2,3;CS:1,2,3;OWASP:1,2,3")
|
||||
endif()
|
||||
|
||||
pvs_studio_add_target(TARGET ${target}-analyze-pvs-studio
|
||||
ANALYZE ${target}
|
||||
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)
|
||||
OUTPUT
|
||||
FORMAT errorfile
|
||||
ARGS --exclude-path ${CMAKE_CURRENT_BINARY_DIR} ${ARG_ARGS}
|
||||
MODE ${ARG_MODE})
|
||||
|
||||
get_target_property(__target_type ${target} TYPE)
|
||||
if(${__target_type} STREQUAL INTERFACE_LIBRARY)
|
||||
set(__target_type INTERFACE)
|
||||
get_target_property(target_type ${target} TYPE)
|
||||
if(${target_type} STREQUAL INTERFACE_LIBRARY)
|
||||
set(target_type INTERFACE)
|
||||
else()
|
||||
set(__target_type PRIVATE)
|
||||
set(target_type PRIVATE)
|
||||
endif()
|
||||
if(MSVC)
|
||||
target_compile_options(${target} BEFORE ${__target_type} /FI ${PVS_STUDIO_HEADER})
|
||||
target_compile_options(${target} BEFORE ${target_type} /FI ${ARG_HEADER})
|
||||
else() # GCC/Clang
|
||||
target_compile_options(${target} BEFORE ${__target_type} -include ${PVS_STUDIO_HEADER})
|
||||
target_compile_options(${target} BEFORE ${target_type} -include ${ARG_HEADER})
|
||||
endif()
|
||||
|
||||
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}")
|
||||
add_dependencies(${target}-analyze-pvs-studio ${target})
|
||||
add_dependencies(myxx-analyze-pvs-studio ${target}-analyze-pvs-studio)
|
||||
endfunction()
|
||||
|
@ -10,30 +10,32 @@ function(myxx_code_coverage target)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_IS_GCC)
|
||||
target_compile_options(${target} PUBLIC "--coverage")
|
||||
set_property(
|
||||
TARGET ${target}
|
||||
APPEND_STRING
|
||||
PROPERTY LINK_FLAGS " --coverage")
|
||||
set(options)
|
||||
set(oneValueArgs)
|
||||
set(multiValueArgs EXCLUDE)
|
||||
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
set_property(TARGET ${target} APPEND PROPERTY
|
||||
COMPILE_OPTIONS --coverage)
|
||||
set_property(TARGET ${target} APPEND 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")
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
set_property(TARGET ${target} APPEND PROPERTY
|
||||
COMPILE_OPTIONS -fprofile-instr-generate -fcoverage-mapping)
|
||||
set_property(TARGET ${target} APPEND PROPERTY LINK_FLAGS --coverage)
|
||||
endif()
|
||||
|
||||
if(LCOV_EXE)
|
||||
add_custom_target(${target}-coverage
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
COMMAND ${LCOV_EXE} --test-name ${target} --output "${target}.lcov" --capture
|
||||
COMMAND ${LCOV_EXE} --test-name ${target} --output "${target}.lcov"
|
||||
--capture
|
||||
--no-external
|
||||
--base-directory ${CMAKE_SOURCE_DIR}
|
||||
--directory ${CMAKE_BINARY_DIR})
|
||||
--directory ${CMAKE_BINARY_DIR}
|
||||
--exclude "/usr/\\\*"
|
||||
--exclude "${CMAKE_BINARY_DIR}/\\\*"
|
||||
--exclude "${CMAKE_BINARY_DIR}/\\\*")
|
||||
add_dependencies(${target}-coverage ${target})
|
||||
|
||||
if(GENHTML_EXE)
|
||||
|
9
MyxxCMake/lib/pvs-studio/pvs_studio.hpp.in
Normal file
9
MyxxCMake/lib/pvs-studio/pvs_studio.hpp.in
Normal file
@ -0,0 +1,9 @@
|
||||
// -*- C++ -*-
|
||||
#ifndef PVS_STUDIO_HPP_
|
||||
#define PVS_STUDIO_HPP_
|
||||
|
||||
#pragma once
|
||||
|
||||
//-V813_MINSIZE=33
|
||||
|
||||
#endif // PVS_STUDIO_HPP_
|
@ -32,13 +32,13 @@ if(DEFINED Sanitizers_FIND_QUIETLY)
|
||||
set(FIND_QUIETLY_FLAG "QUIET")
|
||||
endif()
|
||||
|
||||
find_package(ASan ${FIND_QUIETLY_FLAG})
|
||||
find_package(TSan ${FIND_QUIETLY_FLAG})
|
||||
find_package(MSan ${FIND_QUIETLY_FLAG})
|
||||
find_package(UBSan ${FIND_QUIETLY_FLAG})
|
||||
find_package(LeakSan ${FIND_QUIETLY_FLAG})
|
||||
find_package(CFI ${FIND_QUIETLY_FLAG})
|
||||
find_package(SS ${FIND_QUIETLY_FLAG})
|
||||
find_package(ASan REQUIRED ${FIND_QUIETLY_FLAG})
|
||||
find_package(TSan REQUIRED ${FIND_QUIETLY_FLAG})
|
||||
find_package(MSan REQUIRED ${FIND_QUIETLY_FLAG})
|
||||
find_package(UBSan REQUIRED ${FIND_QUIETLY_FLAG})
|
||||
find_package(LeakSan REQUIRED ${FIND_QUIETLY_FLAG})
|
||||
find_package(CFI REQUIRED ${FIND_QUIETLY_FLAG})
|
||||
find_package(SS REQUIRED ${FIND_QUIETLY_FLAG})
|
||||
|
||||
function(sanitizer_add_blacklist_file FILE)
|
||||
if(NOT IS_ABSOLUTE ${FILE})
|
||||
@ -49,7 +49,7 @@ function(sanitizer_add_blacklist_file FILE)
|
||||
sanitizer_check_compiler_flags("-fsanitize-blacklist=${FILE}" "SanitizerBlacklist" "SanBlist")
|
||||
endfunction()
|
||||
|
||||
function(add_sanitizers ...)
|
||||
function(myxx_add_sanitizers ...)
|
||||
# If no sanitizer is enabled, return immediately.
|
||||
if(NOT
|
||||
(SANITIZE_ADDRESS
|
||||
@ -106,4 +106,4 @@ function(add_sanitizers ...)
|
||||
add_sanitize_ss(${TARGET})
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction(add_sanitizers)
|
||||
endfunction(myxx_add_sanitizers)
|
@ -13,7 +13,7 @@
|
||||
эту библиотеку.
|
||||
|
||||
Для подключения функций необходимо в конце описания проекта
|
||||
(после описания целей, для которых нужно применить правила)
|
||||
(после создания целей, для которых нужно применить правила)
|
||||
добавить строки:
|
||||
|
||||
```cmake
|
||||
|
2
debian/CMakeLists.txt
vendored
2
debian/CMakeLists.txt
vendored
@ -1,5 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.6 FATAL_ERROR)
|
||||
project(myxx-cmake VERSION 2.0.1 LANGUAGES)
|
||||
project(myxx-cmake VERSION 2.0.2 LANGUAGES)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
file(WRITE ${CMAKE_SOURCE_DIR}/MyxxCMake/MyxxCMakeConfigVersion.cmake
|
||||
|
2
debian/changelog
vendored
2
debian/changelog
vendored
@ -1,4 +1,4 @@
|
||||
myxx-cmake (2.0.1) unstable; urgency=medium
|
||||
myxx-cmake (2.0.2) unstable; urgency=medium
|
||||
|
||||
* New version.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user