From 5f00c067f863f812a740dc209b1fb829f04042eb Mon Sep 17 00:00:00 2001 From: Determinant Date: Thu, 26 Jul 2018 14:54:21 -0400 Subject: add auto generated config.h --- .gitignore | 1 + CMakeLists.txt | 6 +----- include/hotstuff/util.h | 5 +++-- salticidae | 2 +- src/config.h.in | 7 +++++++ 5 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 src/config.h.in diff --git a/.gitignore b/.gitignore index f502a81..85d0a04 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ hotstuff-keygen libhotstuff.a src/*.swo src/*.swp +include/hotstuff/config.h *.a *.o *.la diff --git a/CMakeLists.txt b/CMakeLists.txt index ca4d39d..0e65e00 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,11 +58,7 @@ endif() option(HOTSTUFF_ENABLE_DEBUG_LOG "enable debug log" OFF) option(HOTSTUFF_ENABLE_NORMAL_LOG "enable normal log" ON) -if(HOTSTUFF_ENABLE_DEBUG_LOG) - add_definitions(-DHOTSTUFF_DEBUG_LOG) -elseif(HOTSTUFF_ENABLE_NORMAL_LOG) - add_definitions(-DHOTSTUFF_NORMAL_LOG) -endif() +configure_file(src/config.h.in include/hotstuff/config.h @ONLY) # add executables diff --git a/include/hotstuff/util.h b/include/hotstuff/util.h index 42c0135..2b02cfd 100644 --- a/include/hotstuff/util.h +++ b/include/hotstuff/util.h @@ -1,6 +1,7 @@ #ifndef _HOTSTUFF_UTIL_H #define _HOTSTUFF_UTIL_H +#include "hotstuff/config.h" #include "salticidae/util.h" namespace hotstuff { @@ -12,12 +13,12 @@ class Logger: public salticidae::Logger { extern Logger logger; -#ifdef HOTSTUFF_DEBUG_LOG +#ifdef HOTSTUFF_ENABLE_DEBUG_LOG #define HOTSTUFF_NORMAL_LOG #define HOTSTUFF_ENABLE_LOG_DEBUG #endif -#ifdef HOTSTUFF_NORMAL_LOG +#ifdef HOTSTUFF_ENABLE_NORMAL_LOG #define HOTSTUFF_ENABLE_LOG_INFO #define HOTSTUFF_ENABLE_LOG_WARN #endif diff --git a/salticidae b/salticidae index 1b006d5..473551d 160000 --- a/salticidae +++ b/salticidae @@ -1 +1 @@ -Subproject commit 1b006d5164c605ef44652b4442309983bfc0d24a +Subproject commit 473551d760bb52d3c8d12b2096c10210e9387389 diff --git a/src/config.h.in b/src/config.h.in new file mode 100644 index 0000000..ce1e575 --- /dev/null +++ b/src/config.h.in @@ -0,0 +1,7 @@ +#ifndef _HOTSTUFF_CONFIG_H +#define _HOTSTUFF_CONFIG_H + +#cmakedefine HOTSTUFF_ENABLE_DEBUG_LOG +#cmakedefine HOTSTUFF_ENABLE_NORMAL_LOG + +#endif -- cgit v1.2.3-70-g09d2