Use color output to print configuration. (#6219)
authorAina Niemetz <aina.niemetz@gmail.com>
Sat, 27 Mar 2021 01:07:27 +0000 (18:07 -0700)
committerGitHub <noreply@github.com>
Sat, 27 Mar 2021 01:07:27 +0000 (18:07 -0700)
CMakeLists.txt
cmake/Helpers.cmake

index 7d0c98be2280a4b2e0a81959e77fc8e968479422..cd89b6c8aadd977e9124a06fcf601c0217948d56 100644 (file)
@@ -620,6 +620,14 @@ install(FILES
 #-----------------------------------------------------------------------------#
 # Print build configuration
 
+# Set colors.
+if(NOT WIN32)
+  string(ASCII 27 Esc)
+  set(Green "${Esc}[32m")
+  set(Blue "${Esc}[1;34m")
+  set(ResetColor "${Esc}[m")
+endif()
+
 # Convert build type to lower case.
 string(TOLOWER ${CMAKE_BUILD_TYPE} CVC4_BUILD_PROFILE_STRING)
 
@@ -627,97 +635,99 @@ string(TOLOWER ${CMAKE_BUILD_TYPE} CVC4_BUILD_PROFILE_STRING)
 get_directory_property(CVC4_DEFINITIONS COMPILE_DEFINITIONS)
 string(REPLACE ";" " " CVC4_DEFINITIONS "${CVC4_DEFINITIONS}")
 
-message("CVC4 ${CVC4_RELEASE_STRING}")
+message("")
+print_info("CVC4 ${CVC4_RELEASE_STRING}")
 message("")
 if(ENABLE_COMP_INC_TRACK)
-  message("Build profile             : ${CVC4_BUILD_PROFILE_STRING} (incremental)")
+  print_config("Build profile             " "${CVC4_BUILD_PROFILE_STRING} (incremental)")
 else()
-  message("Build profile             : ${CVC4_BUILD_PROFILE_STRING}")
+  print_config("Build profile             " "${CVC4_BUILD_PROFILE_STRING}")
 endif()
 message("")
-print_config("GPL                       :" ENABLE_GPL)
-print_config("Best configuration        :" ENABLE_BEST)
+print_config("GPL                       " ENABLE_GPL)
+print_config("Best configuration        " ENABLE_BEST)
 message("")
-print_config("Assertions                :" ENABLE_ASSERTIONS)
-print_config("Debug symbols             :" ENABLE_DEBUG_SYMBOLS)
-print_config("Debug context mem mgr     :" ENABLE_DEBUG_CONTEXT_MM)
+print_config("Assertions                " ENABLE_ASSERTIONS)
+print_config("Debug symbols             " ENABLE_DEBUG_SYMBOLS)
+print_config("Debug context mem mgr     " ENABLE_DEBUG_CONTEXT_MM)
 message("")
-print_config("Dumping                   :" ENABLE_DUMPING)
-print_config("Muzzle                    :" ENABLE_MUZZLE)
-print_config("Proofs                    :" ENABLE_PROOFS)
-print_config("Statistics                :" ENABLE_STATISTICS)
-print_config("Tracing                   :" ENABLE_TRACING)
+print_config("Dumping                   " ENABLE_DUMPING)
+print_config("Muzzle                    " ENABLE_MUZZLE)
+print_config("Proofs                    " ENABLE_PROOFS)
+print_config("Statistics                " ENABLE_STATISTICS)
+print_config("Tracing                   " ENABLE_TRACING)
 message("")
-print_config("ASan                      :" ENABLE_ASAN)
-print_config("UBSan                     :" ENABLE_UBSAN)
-print_config("TSan                      :" ENABLE_TSAN)
-print_config("Coverage (gcov)           :" ENABLE_COVERAGE)
-print_config("Profiling (gprof)         :" ENABLE_PROFILING)
-print_config("Unit tests                :" ENABLE_UNIT_TESTING)
-print_config("Valgrind                  :" ENABLE_VALGRIND)
+print_config("ASan                      " ENABLE_ASAN)
+print_config("UBSan                     " ENABLE_UBSAN)
+print_config("TSan                      " ENABLE_TSAN)
+print_config("Coverage (gcov)           " ENABLE_COVERAGE)
+print_config("Profiling (gprof)         " ENABLE_PROFILING)
+print_config("Unit tests                " ENABLE_UNIT_TESTING)
+print_config("Valgrind                  " ENABLE_VALGRIND)
 message("")
-print_config("Shared libs               :" ENABLE_SHARED)
-print_config("Static binary             :" ENABLE_STATIC_BINARY)
-print_config("Python bindings           :" BUILD_BINDINGS_PYTHON)
-print_config("Java bindings             :" BUILD_BINDINGS_JAVA)
-print_config("Python2                   :" USE_PYTHON2)
+print_config("Shared libs               " ENABLE_SHARED)
+print_config("Static binary             " ENABLE_STATIC_BINARY)
+print_config("Python bindings           " BUILD_BINDINGS_PYTHON)
+print_config("Java bindings             " BUILD_BINDINGS_JAVA)
+print_config("Python2                   " USE_PYTHON2)
 message("")
-print_config("ABC                       :" USE_ABC)
-print_config("CaDiCaL                   :" USE_CADICAL)
-print_config("CryptoMiniSat             :" USE_CRYPTOMINISAT)
-print_config("GLPK                      :" USE_GLPK)
-print_config("Kissat                    :" USE_KISSAT)
-print_config("LibPoly                   :" USE_POLY)
+print_config("ABC                       " USE_ABC)
+print_config("CaDiCaL                   " USE_CADICAL)
+print_config("CryptoMiniSat             " USE_CRYPTOMINISAT)
+print_config("GLPK                      " USE_GLPK)
+print_config("Kissat                    " USE_KISSAT)
+print_config("LibPoly                   " USE_POLY)
 message("")
-print_config("Build libcvc4 only        :" BUILD_LIB_ONLY)
+print_config("Build libcvc4 only        " BUILD_LIB_ONLY)
 
 if(CVC4_USE_CLN_IMP)
-  message("MP library                : cln")
+  print_config("MP library                " "cln")
 else()
-  message("MP library                : gmp")
+  print_config("MP library                " "gmp")
 endif()
-print_config("Editline                  :" ${USE_EDITLINE})
-print_config("SymFPU                    :" ${USE_SYMFPU})
+print_config("Editline                  " ${USE_EDITLINE})
+print_config("SymFPU                    " ${USE_SYMFPU})
 message("")
 if(ABC_DIR)
-  message("ABC dir                   : ${ABC_DIR}")
+  print_config("ABC dir                   " ${ABC_DIR})
 endif()
 if(ANTLR_DIR)
-  message("ANTLR dir                 : ${ANTLR_DIR}")
+  print_config("ANTLR dir                 " ${ANTLR_DIR})
 endif()
 if(CADICAL_DIR)
-  message("CADICAL dir               : ${CADICAL_DIR}")
+  print_config("CADICAL dir               " ${CADICAL_DIR})
 endif()
 if(CRYPTOMINISAT_DIR)
-  message("CRYPTOMINISAT dir         : ${CRYPTOMINISAT_DIR}")
+  print_config("CRYPTOMINISAT dir         " ${CRYPTOMINISAT_DIR})
 endif()
 if(GLPK_DIR)
-  message("GLPK dir                  : ${GLPK_DIR}")
+  print_config("GLPK dir                  " ${GLPK_DIR})
 endif()
 if(GMP_DIR)
-  message("GMP dir                   : ${GMP_DIR}")
+  print_config("GMP dir                   " ${GMP_DIR})
 endif()
 if(KISSAT_DIR)
-  message("KISSAT dir                : ${KISSAT_DIR}")
+  print_config("KISSAT dir                " ${KISSAT_DIR})
 endif()
 if(POLY_DIR)
-  message("LibPoly dir               : ${POLY_DIR}")
+  print_config("LibPoly dir               " ${POLY_DIR})
 endif()
 if(SYMFPU_DIR)
-  message("SYMFPU dir                : ${SYMFPU_DIR}")
+  print_config("SYMFPU dir                " ${SYMFPU_DIR})
 endif()
 message("")
-message("CPPLAGS (-D...)           : ${CVC4_DEFINITIONS}")
-message("CXXFLAGS                  : ${CMAKE_CXX_FLAGS}")
-message("CFLAGS                    : ${CMAKE_C_FLAGS}")
-message("Linker flags              : ${CMAKE_EXE_LINKER_FLAGS}")
+print_config("CPPLAGS (-D...)" "${CVC4_DEFINITIONS}")
+print_config("CXXFLAGS       " "${CMAKE_CXX_FLAGS}")
+print_config("CFLAGS         " "${CMAKE_C_FLAGS}")
+print_config("Linker flags   " "${CMAKE_EXE_LINKER_FLAGS}")
 message("")
-message("Install prefix            : ${CMAKE_INSTALL_PREFIX}")
+print_config("Install prefix " "${CMAKE_INSTALL_PREFIX}")
 message("")
 
 if(GPL_LIBS)
   message(
-  "CVC4 license             : ${Yellow}GPLv3 (due to optional libraries; see below)${ResetColor}"
+  "${Blue}CVC4 license: "
+  "${Yellow}GPLv3 (due to optional libraries; see below)${ResetColor}"
   "\n"
   "\n"
   "Please note that CVC4 will be built against the following GPLed libraries:"
@@ -734,7 +744,7 @@ if(GPL_LIBS)
   )
 else()
   message(
-  "CVC4 license              : modified BSD"
+  "${Blue}CVC4 license:${ResetColor} modified BSD"
   "\n"
   "\n"
   "Note that this configuration is NOT built against any GPL'ed libraries, so"
index 871fcc0c799396412c9f382cbc061a2e52f117d4..d237d6016f5974efc813fe1c5248ed8a52a18a3c 100644 (file)
@@ -124,15 +124,21 @@ function(list_prepend in_list prepand_value out_list)
   set(${out_list} ${${out_list}} PARENT_SCOPE)
 endfunction()
 
+macro(print_info msg)
+  message("${Blue}${msg}${ResetColor}")
+endmacro()
+
 # Helper to print the configuration of a 2-valued or 3-valued option 'var'
 # with prefix 'str'.
 macro(print_config str var)
-  if(${var} STREQUAL "ON")
+  if("${var}" STREQUAL "ON")
     set(OPT_VAL_STR "on")
-  else()
+  elseif("${var}" STREQUAL "OFF")
     set(OPT_VAL_STR "off")
+  else()
+    set(OPT_VAL_STR ${var})
   endif()
-  message("${str} ${OPT_VAL_STR}")
+  message("${Blue}${str}: ${Green}${OPT_VAL_STR}${ResetColor}")
 endmacro()