From 473551d760bb52d3c8d12b2096c10210e9387389 Mon Sep 17 00:00:00 2001 From: Determinant Date: Thu, 26 Jul 2018 14:53:33 -0400 Subject: add auto generated config.h --- .gitignore | 1 + CMakeLists.txt | 7 ++----- include/salticidae/util.h | 5 +++-- src/config.h.in | 7 +++++++ 4 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 src/config.h.in diff --git a/.gitignore b/.gitignore index 0b0d2ec..eff5651 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ cmake-build-debug/ libsalticidae.a src/*.swo src/*.swp +include/salticidae/config.h *.a *.o *.la diff --git a/CMakeLists.txt b/CMakeLists.txt index c004fd8..587584f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,11 +53,8 @@ endif() option(SALTICIDAE_ENABLE_DEBUG_LOG "enable debug log" OFF) option(SALTICIDAE_ENABLE_NORMAL_LOG "enable regular log" ON) -if (SALTICIDAE_ENABLE_DEBUG_LOG) - add_definitions(-DSALTICIDAE_DEBUG_LOG) -elseif(SALTICIDAE_ENABLE_NORMAL_LOG) - add_definitions(-DSALTICIDAE_NORMAL_LOG) -endif() + +configure_file(src/config.h.in include/salticidae/config.h @ONLY) set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -W -Wall -Wextra -pedantic -Wsuggest-override") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -W -Wall -Wextra -pedantic -Wsuggest-override") diff --git a/include/salticidae/util.h b/include/salticidae/util.h index 505f014..e589693 100644 --- a/include/salticidae/util.h +++ b/include/salticidae/util.h @@ -34,6 +34,7 @@ #include #include +#include "salticidae/config.h" #include "salticidae/ref.h" namespace salticidae { @@ -83,12 +84,12 @@ class Logger { extern Logger logger; -#ifdef SALTICIDAE_DEBUG_LOG +#ifdef SALTICIDAE_ENABLE_DEBUG_LOG #define SALTICIDAE_NORMAL_LOG #define SALTICIDAE_ENABLE_LOG_DEBUG #endif -#ifdef SALTICIDAE_NORMAL_LOG +#ifdef SALTICIDAE_ENABLE_NORMAL_LOG #define SALTICIDAE_ENABLE_LOG_INFO #define SALTICIDAE_ENABLE_LOG_WARN #endif diff --git a/src/config.h.in b/src/config.h.in new file mode 100644 index 0000000..7637923 --- /dev/null +++ b/src/config.h.in @@ -0,0 +1,7 @@ +#ifndef _SALTICIDAE_CONFIG_H +#define _SALTICIDAE_CONFIG_H + +#cmakedefine SALTICIDAE_ENABLE_DEBUG_LOG +#cmakedefine SALTICIDAE_ENABLE_NORMAL_LOG + +#endif -- cgit v1.2.3-70-g09d2