4
0
mirror of https://github.com/QuasarApp/LIEF.git synced 2025-05-11 11:09:32 +00:00

Reorg so when LIEF_LOGGING=off easylogging++ does not get included at all

This commit is contained in:
illera88 2017-11-20 00:17:00 +07:00 committed by Romain Thomas
parent 4e38d9cf99
commit 93a4b2e2b2
28 changed files with 70 additions and 41 deletions

@ -228,19 +228,21 @@ set(mbedtls_src_tls
# easyloggingpp
# -------------
set(ELG_VERSION 9.94.2)
set(ELG_SHA256 SHA256=f99adeb098e28cd6c97ebb7dfe8ddd55bf6b79578aa65b55c34b4b2527f1f235)
set(ELG_URL "${THIRD_PARTY_DIRECTORY}/easyloggingpp-${ELG_VERSION}.zip" CACHE STRING "URL to the easyloggingpp lib repo")
ExternalProject_Add(lief_easyloggingpp
URL ${ELG_URL}
URL_HASH ${ELG_SHA256}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
UPDATE_COMMAND ""
INSTALL_COMMAND "")
if (LIEF_LOGGING)
set(ELG_VERSION 9.94.2)
set(ELG_SHA256 SHA256=f99adeb098e28cd6c97ebb7dfe8ddd55bf6b79578aa65b55c34b4b2527f1f235)
set(ELG_URL "${THIRD_PARTY_DIRECTORY}/easyloggingpp-${ELG_VERSION}.zip" CACHE STRING "URL to the easyloggingpp lib repo")
ExternalProject_Add(lief_easyloggingpp
URL ${ELG_URL}
URL_HASH ${ELG_SHA256}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
UPDATE_COMMAND ""
INSTALL_COMMAND "")
ExternalProject_get_property(lief_easyloggingpp SOURCE_DIR)
set(ELG_SOURCE_DIR "${SOURCE_DIR}/src")
ExternalProject_get_property(lief_easyloggingpp SOURCE_DIR)
set(ELG_SOURCE_DIR "${SOURCE_DIR}/src")
endif()
# Fuzzing
# ~~~~~~~
@ -308,10 +310,13 @@ endif()
set_source_files_properties(${mbedtls_src_crypto} PROPERTIES GENERATED TRUE)
set_source_files_properties(${mbedtls_src_x509} PROPERTIES GENERATED TRUE)
set_source_files_properties(${mbedtls_src_tls} PROPERTIES GENERATED TRUE)
if (LIEF_LOGGING)
set_source_files_properties(${ELG_SOURCE_DIR}/easylogging++.cc PROPERTIES GENERATED TRUE)
set(ELG_CC_PATH "${ELG_SOURCE_DIR}/easylogging++.cc")
endif()
set(LIBLIEF_SOURCE_FILES
"${ELG_SOURCE_DIR}/easylogging++.cc"
"${ELG_CC_PATH}"
"${mbedtls_src_crypto}"
"${mbedtls_src_x509}"
"${mbedtls_src_tls}"
@ -473,7 +478,9 @@ set(LIEF_PRIVATE_INCLUDE_DIR
source_group("mbedtls\\crypto" FILES ${mbedtls_src_crypto})
source_group("mbedtls\\x509" FILES ${mbedtls_src_x509})
source_group("mbedtls\\tls" FILES ${mbedtls_src_tls})
if (LIEF_LOGGING)
source_group("easylogging" FILES ${ELG_SOURCE_DIR}/easylogging++.cc)
endif()
# Library definition
# ==================
@ -494,8 +501,10 @@ if (LIEF_ENABLE_JSON)
add_dependencies(LIB_LIEF_SHARED lief_libjson)
endif()
add_dependencies(LIB_LIEF_STATIC lief_easyloggingpp)
add_dependencies(LIB_LIEF_SHARED lief_easyloggingpp)
if (LIEF_LOGGING)
add_dependencies(LIB_LIEF_STATIC lief_easyloggingpp)
add_dependencies(LIB_LIEF_SHARED lief_easyloggingpp)
endif()
add_dependencies(LIB_LIEF_STATIC lief_rang_cpp_color)
add_dependencies(LIB_LIEF_SHARED lief_rang_cpp_color)

@ -0,0 +1,13 @@
#ifndef LIEF_LOGGINGPP_H_
#define LIEF_LOGGINGPP_H_
#if defined(LIEF_LOGGING_SUPPORT)
#include "easylogging++.h"
#else
#include <iostream>
#define VLOG(...) std::cout
#define LOG(...) std::cout
#define LOG_IF(...) std::cout
#endif
#endif

@ -19,8 +19,9 @@
#include <fstream>
#include <cassert>
#include <sstream>
#include <algorithm>
#include "easylogging++.h"
#include "LIEF/logging++.hpp"
#include "LIEF/BinaryStream/VectorStream.hpp"
#include "LIEF/exception.hpp"

@ -16,6 +16,7 @@
#include <algorithm>
#include <iterator>
#include <numeric>
#include <sstream>
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
@ -25,7 +26,7 @@
#include <stdexcept>
#include "easylogging++.h"
#include "LIEF/logging++.hpp"
#include "LIEF/exception.hpp"
#include "LIEF/utils.hpp"

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "easylogging++.h"
#include "LIEF/logging++.hpp"
#include "LIEF/ELF/enums.hpp"
namespace LIEF {
namespace ELF {

@ -15,7 +15,7 @@
*/
#include <numeric>
#include "easylogging++.h"
#include "LIEF/logging++.hpp"
#include "LIEF/BinaryStream/VectorStream.hpp"

@ -17,7 +17,7 @@
#include <stdexcept>
#include <algorithm>
#include "easylogging++.h"
#include "LIEF/logging++.hpp"
#include "LIEF/ELF/DataHandler/Handler.hpp"
#include "LIEF/exception.hpp"

@ -21,7 +21,7 @@
#include <stdexcept>
#include <functional>
#include "easylogging++.h"
#include "LIEF/logging++.hpp"
#include "LIEF/filesystem/filesystem.h"
#include "LIEF/exception.hpp"

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "easylogging++.h"
#include "LIEF/logging++.hpp"
#include "LIEF/utils.hpp"

@ -20,7 +20,7 @@
#include <functional>
#include <iterator>
#include "easylogging++.h"
#include "LIEF/logging++.hpp"
#include "LIEF/visitors/Hash.hpp"

@ -17,7 +17,7 @@
#include <algorithm>
#include <iterator>
#include "easylogging++.h"
#include "LIEF/logging++.hpp"
#include "LIEF/exception.hpp"

@ -14,7 +14,7 @@
* limitations under the License.
*/
#include "easylogging++.h"
#include "LIEF/logging++.hpp"
#include "LIEF/MachO/Binary.hpp"
#include "LIEF/MachO/Builder.hpp"
@ -24,6 +24,7 @@
#include <algorithm>
#include <numeric>
#include <sstream>
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "easylogging++.h"
#include "LIEF/logging++.hpp"
namespace LIEF {
namespace MachO {

@ -14,7 +14,7 @@
* limitations under the License.
*/
#include "easylogging++.h"
#include "LIEF/logging++.hpp"
#include "LIEF/MachO/DyldInfo.hpp"
#include "LIEF/MachO/FunctionStarts.hpp"

@ -18,7 +18,7 @@
#include <fstream>
#include <iterator>
#include "easylogging++.h"
#include "LIEF/logging++.hpp"
#include "LIEF/MachO/Builder.hpp"
#include "Builder.tcc"

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "easylogging++.h"
#include "LIEF/logging++.hpp"
namespace LIEF {
namespace MachO {

@ -21,7 +21,7 @@
#include <stdexcept>
#include <functional>
#include "easylogging++.h"
#include "LIEF/logging++.hpp"
#include "LIEF/filesystem/filesystem.h"
#include "LIEF/exception.hpp"

@ -15,7 +15,7 @@
*/
#include "easylogging++.h"
#include "LIEF/logging++.hpp"
#include "LIEF/MachO/ParserConfig.hpp"

@ -16,7 +16,7 @@
#include <numeric>
#include <iomanip>
#include "easylogging++.h"
#include "LIEF/logging++.hpp"
#include "LIEF/visitors/Hash.hpp"
#include "LIEF/MachO/ThreadCommand.hpp"

@ -20,7 +20,7 @@
#include <numeric>
#include <limits>
#include "easylogging++.h"
#include "LIEF/logging++.hpp"
#include "LIEF/visitors/Hash.hpp"
#include "LIEF/exception.hpp"

@ -19,7 +19,7 @@
#include <iterator>
#include <numeric>
#include "easylogging++.h"
#include "LIEF/logging++.hpp"
#include "LIEF/utf8.h"
#include "LIEF/exception.hpp"

@ -23,7 +23,7 @@
#include <mbedtls/oid.h>
#include <mbedtls/x509_crt.h>
#include "easylogging++.h"
#include "LIEF/logging++.hpp"
#include "LIEF/filesystem/filesystem.h"
#include "LIEF/exception.hpp"

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "easylogging++.h"
#include "LIEF/logging++.hpp"
#include "LIEF/PE/LoadConfigurations.hpp"
#include "LoadConfigurations/LoadConfigurations.tcc"

@ -15,7 +15,7 @@
*/
#include <iomanip>
#include "easylogging++.h"
#include "LIEF/logging++.hpp"
#include "LIEF/visitors/Hash.hpp"

@ -19,7 +19,7 @@
#include "rang.hpp"
#include "easylogging++.h"
#include "LIEF/logging++.hpp"
#include "LIEF/exception.hpp"
#include "LIEF/visitors/Hash.hpp"

@ -20,10 +20,12 @@
#include "LIEF/utf8.h"
#include "easylogging++.h"
#include "LIEF/logging++.hpp"
#include "pkcs7.h"
#include <cstring>
#include "LIEF/exception.hpp"
#include "LIEF/PE/utils.hpp"

@ -23,7 +23,7 @@
#include <sstream>
#include <string>
#include "easylogging++.h"
#include "LIEF/logging++.hpp"
#include "mbedtls/md5.h"
#include "LIEF/utf8.h"

@ -13,9 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "easylogging++.h"
#include "LIEF/config.h"
#include "LIEF/logging.hpp"
#include "LIEF/logging++.hpp"
#include <map>
#if defined(LIEF_LOGGING_SUPPORT)
INITIALIZE_EASYLOGGINGPP