diff --git a/.gitignore b/.gitignore index 53eee01b..71a1545a 100644 --- a/.gitignore +++ b/.gitignore @@ -38,6 +38,7 @@ lib/ *.ninja* CMakeCache.txt CMakeFiles/ +.idea/ cmake_install.cmake *.DS_Store .idea/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 15bcb6c9..6dcf635d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,8 @@ # Robert Hauck - Enable support for PNG/Freetype # Qiangqiang Wu - Add biicode support +option(CMAKE_VERBOSE_PREPROCESSOR "Show annoying debug messages during compilation." OFF) +option(CMAKE_STOP_VERBOSE_PREPROCESSOR "Stop compilation after showing the annoying debug messages." ON) option(BUILD_NANA_DEMOS "Build all the demos form the nana_demo repository." ON) option(CMAKE_STD_make_unique_NOT_SUPPORTED "Add support for make_unique<>().") #set(CMAKE_STD_make_unique_NOT_SUPPORTED OFF) @@ -99,6 +101,9 @@ if(ENABLE_JPEG) endif() +if(CMAKE_VERBOSE_PREPROCESSOR) + add_definitions(-DVERBOSE_PREPROCESSOR) +endif(CMAKE_VERBOSE_PREPROCESSOR) # STD_make_unique_NOT_SUPPORTED if(CMAKE_STD_make_unique_NOT_SUPPORTED) diff --git a/include/nana/config.hpp b/include/nana/config.hpp index b13c0886..cbac37f0 100644 --- a/include/nana/config.hpp +++ b/include/nana/config.hpp @@ -36,6 +36,7 @@ * - USE_github_com_meganz_mingw_std_threads (MinGW with GCC < 4.8.1) * - STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED (MinGW with GCC < 4.8.1) * - STD_TO_STRING_NOT_SUPPORTED (MinGW with GCC < 4.8) + * - VERBOSE_PREPROCESSOR, STOP_VERBOSE_PREPROCESSOR * - STD_make_unique_NOT_SUPPORTED (MinGW with GCC < 4.8.1) * or __cpp_lib_make_unique * http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0096r0.html#detail.cpp14.n3656 @@ -188,5 +189,13 @@ #endif #endif +#if !defined(VERBOSE_PREPROCESSOR) + //#define VERBOSE_PREPROCESSOR +#endif + +#if !defined(STOP_VERBOSE_PREPROCESSOR) + #define STOP_VERBOSE_PREPROCESSOR +#endif + #endif // NANA_CONFIG_HPP \ No newline at end of file diff --git a/include/nana/deploy.hpp b/include/nana/deploy.hpp index f10dbebc..2b8f7e13 100644 --- a/include/nana/deploy.hpp +++ b/include/nana/deploy.hpp @@ -15,9 +15,12 @@ #ifndef NANA_DEPLOY_HPP #define NANA_DEPLOY_HPP -#include - #include +#if defined(VERBOSE_PREPROCESSOR) + #include +#endif + +#include #include diff --git a/include/nana/verbose_preprocessor.hpp b/include/nana/verbose_preprocessor.hpp new file mode 100644 index 00000000..b62267f6 --- /dev/null +++ b/include/nana/verbose_preprocessor.hpp @@ -0,0 +1,56 @@ +/** + * Nana Verbose preprocessor + * Nana C++ Library(http://www.nanapro.org) + * Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com) + * + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + * + * @file nana/verbose_preprocessor.hpp + * + * @brief show the values of configuration constants during compilation to facilitate build debugging. + * + * Set VERBOSE_PREPROCESSOR to 1 to show the messages or to 0 for a normal build. + * Normally set to 0. Set to 1 only in case you want to debug the build system because it is extremely repetitive and slow. + * + * @authors Ariel Vina-Rodriguez (qPCR4vir) + * + */ +// Created by ariel.rodriguez on 08.12.2015. +// + +#ifndef NANA_VERBOSE_PREPROCESSOR_H +#define NANA_VERBOSE_PREPROCESSOR_H + +#if defined(VERBOSE_PREPROCESSOR) + + #define STRING2(x) #x + #define STRING(x) STRING2(x) + #pragma message ( "\nVerbose preprocessor =" STRING(VERBOSE_PREPROCESSOR)" , \n STOP_VERBOSE_PREPROCESSOR=" STRING(STOP_VERBOSE_PREPROCESSOR) ) + + #pragma message ( "\nWindows: \n _WIN32=" STRING(_WIN32) ", \n __WIN32__ =" STRING(__WIN32__) " , \n WIN32=" STRING(WIN32)" , \n NANA_WINDOWS=" STRING(NANA_WINDOWS) ) + + #pragma message ( "\nUNICODE: \n NANA_UNICODE=" STRING(NANA_UNICODE) ", \n _UNICODE =" STRING(_UNICODE) " , \n UNICODE=" STRING(UNICODE) ) + + #pragma message ( "\nMinGW: \n __MINGW32__=" STRING(__MINGW32__) ", \n __MINGW64__=" STRING(__MINGW64__) " , \n MINGW=" STRING(MINGW) ) + + #pragma message ( "\nGNU: \n __GNUC__=" STRING(__GNUC__) ", \n __GNUC_MINOR__=" STRING(__GNUC_MINOR__) " , \n __GNUC_PATCHLEVEL__=" STRING(__GNUC_PATCHLEVEL__) ) + + #pragma message ( "\nSTD: \nSTD_CODECVT_NOT_SUPPORTED=" STRING(STD_CODECVT_NOT_SUPPORTED) " , \nSTD_THREAD_NOT_SUPPORTED=" STRING(STD_THREAD_NOT_SUPPORTED) ) + + #pragma message ( "\nSTD: \nUSE_github_com_meganz_mingw_std_threads=" STRING(USE_github_com_meganz_mingw_std_threads) " , \nSTD_THREAD_NOT_SUPPORTED=" STRING(STD_THREAD_NOT_SUPPORTED) ) + + #pragma message ( "\nClang compiler: \n__clang__=" STRING(__clang__) ", \n__GLIBCPP__=" STRING(__GLIBCPP__) " , \n__GLIBCXX__=" STRING(__GLIBCXX__) ) + + #pragma message ( "\nMSC: \n_MSC_VER=" STRING(_MSC_VER) ", \n_MSC_FULL_VER=" STRING(_MSC_FULL_VER ) ) + + #if defined(STOP_VERBOSE_PREPROCESSOR) + #error ("\nCompilation stopped to avoid annoying messages") + #endif + +#endif // VERBOSE_PREPROCESSOR + + + +#endif //NANA_VERBOSE_PREPROCESSOR_H