From 6d6256f83b8533428a3ac8e0a101650762b7fb17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Mon, 2 Mar 2015 15:28:07 +0100 Subject: [PATCH] Allow mixing debug version of evmjit with release version of LLVM library --- evmjit/libevmjit/BuildInfo.h.in | 1 + evmjit/libevmjit/CMakeLists.txt | 2 ++ evmjit/libevmjit/Utils.cpp | 6 ++++++ 3 files changed, 9 insertions(+) diff --git a/evmjit/libevmjit/BuildInfo.h.in b/evmjit/libevmjit/BuildInfo.h.in index 204b4d89b..4b72144ed 100644 --- a/evmjit/libevmjit/BuildInfo.h.in +++ b/evmjit/libevmjit/BuildInfo.h.in @@ -8,3 +8,4 @@ #define LLVM_VERSION "${LLVM_PACKAGE_VERSION}" #define LLVM_ASSERTIONS "${LLVM_ENABLE_ASSERTIONS}" +#define LLVM_DEBUG ${LLVM_DEBUG} diff --git a/evmjit/libevmjit/CMakeLists.txt b/evmjit/libevmjit/CMakeLists.txt index 943c64e42..d72c58009 100644 --- a/evmjit/libevmjit/CMakeLists.txt +++ b/evmjit/libevmjit/CMakeLists.txt @@ -48,6 +48,8 @@ else() set(EVMJIT_SOVERSION ${EVMJIT_VERSION_MAJOR}) endif() + +string(COMPARE EQUAL "${LLVM_ENABLE_ASSERTIONS}" "ON" LLVM_DEBUG) configure_file(BuildInfo.h.in ${CMAKE_CURRENT_BINARY_DIR}/gen/BuildInfo.gen.h) message(STATUS "EVM JIT version: ${EVMJIT_VERSION_MAJOR}.${EVMJIT_VERSION_MINOR}.${EVMJIT_VERSION_PATCH} ${EVMJIT_VERSION_PRERELEASE} (${EVMJIT_VERSION_FULL})") diff --git a/evmjit/libevmjit/Utils.cpp b/evmjit/libevmjit/Utils.cpp index 3644def04..b010b1d96 100644 --- a/evmjit/libevmjit/Utils.cpp +++ b/evmjit/libevmjit/Utils.cpp @@ -2,6 +2,8 @@ #include +#include "BuildInfo.gen.h" + #if !defined(NDEBUG) // Debug namespace dev @@ -12,7 +14,11 @@ namespace evmjit std::ostream& getLogStream(char const* _channel) { static std::ostream nullStream{nullptr}; +#if LLVM_DEBUG return (llvm::DebugFlag && llvm::isCurrentDebugType(_channel)) ? std::cerr : nullStream; +#else + return (void)_channel, nullStream; +#endif } }