diff --git a/CMakeLists.txt b/CMakeLists.txt index ff384361..99243a7d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,18 +56,23 @@ if(APPLE) endif() set(USE_PCH FALSE CACHE BOOL "Use shared precompiled headers") +set(DISABLE_TOR FALSE CACHE BOOL "Disable TOR library(and related tor-connect submodule)") +set(TESTNET FALSE CACHE BOOL "Compile for testnet") +set(BUILD_GUI FALSE CACHE BOOL "Build qt-daemon") include_directories(src contrib/eos_portable_archive contrib contrib/epee/include "${CMAKE_BINARY_DIR}/version" "${CMAKE_BINARY_DIR}/contrib/zlib") add_definitions(-DSTATICLIB) -set(TESTNET FALSE CACHE BOOL "Compile for testnet") if(TESTNET) message("!!!!!! NOTICE: Project is building for TESTNET !!!!!!") add_definitions(-DTESTNET) endif() -set(BUILD_GUI FALSE CACHE BOOL "Build qt-daemon") +if(DISABLE_TOR) + message("NOTICE: Building with disabled TOR support!") + add_definitions(-DDISABLE_TOR) +endif() set(STATIC ${MSVC} CACHE BOOL "Link libraries statically") diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index 23ceb7a1..601672d5 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -4,7 +4,10 @@ set(UPNPC_BUILD_TESTS OFF CACHE BOOL "Build test executables") add_subdirectory(zlib) add_subdirectory(db) add_subdirectory(ethereum) -add_subdirectory(tor-connect) + +if( NOT DISABLE_TOR) + add_subdirectory(tor-connect) +endif() if(CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "Android") @@ -18,7 +21,10 @@ set_property(TARGET libminiupnpc-static PROPERTY FOLDER "contrib") set_property(TARGET zlibstatic PROPERTY FOLDER "contrib") set_property(TARGET mdbx PROPERTY FOLDER "contrib") set_property(TARGET lmdb PROPERTY FOLDER "contrib") -set_property(TARGET tor-connect PROPERTY FOLDER "contrib") +if( NOT DISABLE_TOR) + set_property(TARGET tor-connect PROPERTY FOLDER "contrib") +endif() + set_property(TARGET upnpc-static mdbx_chk mdbx_copy mdbx_dump mdbx_load mdbx_stat PROPERTY FOLDER "unused") if(MSVC) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 892a8585..7e3465f9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -170,7 +170,11 @@ ENABLE_SHARED_PCH_EXECUTABLE(connectivity_tool) add_executable(simplewallet ${SIMPLEWALLET}) add_dependencies(simplewallet version) -target_link_libraries(simplewallet wallet rpc currency_core crypto common zlibstatic ethash tor-connect ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) +target_link_libraries(simplewallet wallet rpc currency_core crypto common zlibstatic ethash ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) + if(NOT DISABLE_TOR) + target_link_libraries(simplewallet tor-connect) + endif() + ENABLE_SHARED_PCH(simplewallet SIMPLEWALLET) ENABLE_SHARED_PCH_EXECUTABLE(simplewallet) @@ -194,7 +198,10 @@ if(BUILD_GUI) QT5_USE_MODULES(Zano WebEngineWidgets WebChannel) find_package(Qt5PrintSupport REQUIRED) - target_link_libraries(Zano wallet rpc currency_core crypto common zlibstatic ethash tor-connect Qt5::WebEngineWidgets Qt5::PrintSupport ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) + target_link_libraries(Zano wallet rpc currency_core crypto common zlibstatic ethash Qt5::WebEngineWidgets Qt5::PrintSupport ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) + if(NOT DISABLE_TOR) + target_link_libraries(Zano tor-connect) + endif() if (UNIX AND NOT APPLE) target_link_libraries(Zano rt) endif() diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 9f4abdc6..92bdd848 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -31,7 +31,10 @@ using namespace epee; #include "version.h" #include "common/encryption_filter.h" #include "crypto/bitcoin/sha256_helper.h" -#include "common/tor_helper.h" +#ifndef DISABLE_TOR + #include "common/tor_helper.h" +#endif + #include "storages/levin_abstract_invoke2.h" using namespace currency; @@ -4602,8 +4605,7 @@ void wallet2::notify_state_change(const std::string& state_code, const std::stri //---------------------------------------------------------------------------------------------------------------- void wallet2::send_transaction_to_network(const transaction& tx) { -#define ENABLE_TOR_RELAY -#ifdef ENABLE_TOR_RELAY +#ifndef DISABLE_TOR if (!m_disable_tor_relay) { //TODO check that core synchronized @@ -4644,6 +4646,7 @@ void wallet2::send_transaction_to_network(const transaction& tx) } } else +#endif // { COMMAND_RPC_SEND_RAW_TX::request req; req.tx_as_hex = epee::string_tools::buff_to_hex_nodelimer(tx_to_blob(tx)); @@ -4656,7 +4659,7 @@ void wallet2::send_transaction_to_network(const transaction& tx) WLT_LOG_L2("transaction " << get_transaction_hash(tx) << " generated ok and sent to daemon:" << ENDL << currency::obj_to_json_str(tx)); } -#endif // + } //---------------------------------------------------------------------------------------------------------------- void wallet2::add_sent_tx_detailed_info(const transaction& tx,