From 96b032504e7a2994625e50b045ee91fd206c5d20 Mon Sep 17 00:00:00 2001 From: Vladislav Volkov Date: Wed, 23 Dec 2020 08:01:07 +0300 Subject: [PATCH] Errors and warnings highlighting for UNIX platforms (#3643) * Errors and warnings highlighting for UNIX platforms * The option added for errors and warning highlighting enabling --- .../IEDevScriptsConfig.cmake | 1 + cmake/developer_package/message.cmake | 23 +++++++++++++++++++ cmake/features.cmake | 2 ++ 3 files changed, 26 insertions(+) create mode 100644 cmake/developer_package/message.cmake diff --git a/cmake/developer_package/IEDevScriptsConfig.cmake b/cmake/developer_package/IEDevScriptsConfig.cmake index df40b2a984d..c8caf92f57b 100644 --- a/cmake/developer_package/IEDevScriptsConfig.cmake +++ b/cmake/developer_package/IEDevScriptsConfig.cmake @@ -20,6 +20,7 @@ endfunction() set_ci_build_number() include(features) +include(message) # # Detect target diff --git a/cmake/developer_package/message.cmake b/cmake/developer_package/message.cmake new file mode 100644 index 00000000000..fea169d5006 --- /dev/null +++ b/cmake/developer_package/message.cmake @@ -0,0 +1,23 @@ +# Copyright (C) 2018-2020 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +# + +if(UNIX AND ENABLE_ERROR_HIGHLIGHT) + function(message) + string(ASCII 27 ESC) + set(RESET "${ESC}[m") + set(RED "${ESC}[31;1m") + set(YELLOW "${ESC}[33;1m") + + list(GET ARGV 0 MessageType) + if(MessageType STREQUAL FATAL_ERROR OR MessageType STREQUAL SEND_ERROR) + list(REMOVE_AT ARGV 0) + _message(${MessageType} "${RED}${ARGV}${RESET}") + elseif(MessageType STREQUAL WARNING) + list(REMOVE_AT ARGV 0) + _message(${MessageType} "${YELLOW}${ARGV}${RESET}") + else() + _message("${ARGV}") + endif() + endfunction() +endif() diff --git a/cmake/features.cmake b/cmake/features.cmake index 8c63bd77b72..49b29562abe 100644 --- a/cmake/features.cmake +++ b/cmake/features.cmake @@ -25,6 +25,8 @@ In case SELECTIVE_BUILD is enabled, the SELECTIVE_BUILD_STAT variable should con Usage: -DSELECTIVE_BUILD=ON -DSELECTIVE_BUILD_STAT=/path/*.csv" OFF ALLOWED_VALUES ON OFF COLLECT) +ie_option(ENABLE_ERROR_HIGHLIGHT "Highlight errors and warnings during compile time" OFF) + # # Process options #