You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by zh...@apache.org on 2021/10/28 01:49:02 UTC

[incubator-mxnet] branch master updated: An option to clorize output during build (#20681)

This is an automated email from the ASF dual-hosted git repository.

zhasheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git


The following commit(s) were added to refs/heads/master by this push:
     new 4f289f8  An option to clorize output during build (#20681)
4f289f8 is described below

commit 4f289f87497955861ce37a8413773ea4671e1f56
Author: mozga <ma...@intel.com>
AuthorDate: Thu Oct 28 03:46:32 2021 +0200

    An option to clorize output during build (#20681)
---
 CMakeLists.txt | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 090403f..d6893c6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -90,6 +90,7 @@ option(USE_ASAN "Enable Clang/GCC ASAN sanitizers." OFF)
 cmake_dependent_option(ENABLE_TESTCOVERAGE "Enable compilation with test coverage metric output" OFF "NOT MSVC" OFF)
 option(BUILD_EXTENSION_PATH "Path to extension to build" "")
 option(BUILD_CYTHON_MODULES "Build cython modules." OFF)
+option(COLORIZE_OUTPUT "Colorize output during compilation" ON)
 option(LOG_FATAL_THROW "Log exceptions but do not abort" ON)
 cmake_dependent_option(USE_SPLIT_ARCH_DLL "Build a separate DLL for each Cuda arch (Windows only)." ON "MSVC" OFF)
 cmake_dependent_option(USE_CCACHE "Attempt using CCache to wrap the compilation" ON "UNIX" OFF)
@@ -176,6 +177,18 @@ add_definitions(-DDMLC_USE_CXX11)
 add_definitions(-DDMLC_STRICT_CXX11)
 add_definitions(-DDMLC_USE_CXX14)
 add_definitions(-DMSHADOW_IN_CXX11)
+
+if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
+  if(${COLORIZE_OUTPUT})
+    string(APPEND CMAKE_CXX_FLAGS " -fcolor-diagnostics")
+  endif()
+endif()
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.9)
+  if(${COLORIZE_OUTPUT})
+    string(APPEND CMAKE_CXX_FLAGS " -fdiagnostics-color=always")
+  endif()
+endif()
+
 if(MSVC)
   add_definitions(-D_SCL_SECURE_NO_WARNINGS)
   add_definitions(-D_CRT_SECURE_NO_WARNINGS)