From 10bce36db43cac005e96bffbf153a328dc525f30 Mon Sep 17 00:00:00 2001 From: Yaron Date: Thu, 22 Sep 2022 21:25:00 +0800 Subject: [PATCH] [master] ZIL-4812: support compilation on Mac (#3020) * ZIL-4812: 1. Remove flag enabling duplicate targets (not supported in Xcode). 2. Remove incorrect CMake variables used to depend on websocketpp. * ZIL-4812: use the same CMAKE_BUILD_TYPE in our cmake scripts that compile dependencies in submodules. * ZIL-4812: 1. Suppress some warnings on AppleClang. 2. Don't include unsupported headers when compiling on Mac. 3. Temporarily leave an empty implementation in 2 functions displaying memory information. * ZIL-4812: some fixes of unnecessary / incorrct flags & target in CMakeLists.txt * ZIL-4812: fix compilation error when appending to a Json::arrayValue * ZIL-4812: 1. Fix some dependencies & include paths. 2. Protection against multiple inclusion of LLVMExtraTools.cmake 3. Workaround against an issue related to protobuf when compiled by vcpkg on x64-osx-dynamic. 4. Some CMakeLists.txt cleanup. --- CMakeLists.txt | 111 +++++++++++-------------- cmake/InstallG3log.cmake | 1 + cmake/InstallJsonrpccpp.cmake | 6 +- cmake/InstallSchnorr.cmake | 2 +- cmake/LLVMExtraTools.cmake | 2 + src/cmd/CMakeLists.txt | 9 +- src/libData/AccountData/CMakeLists.txt | 2 +- src/libEth/CMakeLists.txt | 4 +- src/libMessage/CMakeLists.txt | 15 ++-- src/libPersistence/ContractStorage.cpp | 2 + src/libPythonRunner/PythonRunner.cpp | 14 +++- src/libServer/CMakeLists.txt | 19 ++--- src/libServer/JSONConversion.cpp | 2 +- src/libUtils/CommonUtils.cpp | 6 +- src/libUtils/MemoryStats.cpp | 10 ++- src/libValidator/CMakeLists.txt | 2 +- tests/Crypto/CMakeLists.txt | 2 +- tests/Lookup/CMakeLists.txt | 16 +++- 18 files changed, 125 insertions(+), 100 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e520528ec2..a08994d2a4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,34 +11,35 @@ project(Zilliqa) # detect operating system message(STATUS "We are on a ${CMAKE_SYSTEM_NAME} system") +# Workaround: there's a bug related to protobuf 3.9.1 on vcpkg when compiled with +# x64-osx-dynamic (see https://github.com/microsoft/vcpkg/issues/8421). +# This is a simple workaround against this issue. +if (APPLE) + file(CREATE_LINK + ${CMAKE_BINARY_DIR}/vcpkg_installed/x64-osx-dynamic/lib + ${CMAKE_BINARY_DIR}/vcpkg_installed/x64-osx-dynamic/tools/lib + SYMBOLIC) +endif() + list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") # # check dependencies # find_package(Libevent REQUIRED) find_package(jsoncpp REQUIRED) - -set(THREADS_PREFER_PTHREAD_FLAG ON) -find_package(Threads REQUIRED) - -if(NOT TARGET jsonrpc-project) - include(InstallJsonrpccpp) -endif() - -include(InstallG3log) -find_package(g3logger CONFIG REQUIRED) - -include(InstallCryptoUtils) - -include(ProjectSecp256k1) - find_package(mongocxx REQUIRED) find_package(bsoncxx REQUIRED) - find_package(websocketpp REQUIRED) +find_package(leveldb REQUIRED) +#TODO: upgrade to OpenSSL 1.1.1a +find_package(OpenSSL REQUIRED) -include(InstallSchnorr) -include_directories(${SCHNORR_INCLUDE_DIR}/include) +include(FindProtobuf) +set(protobuf_MODULE_COMPATIBLE TRUE) +find_package(Protobuf REQUIRED) + +set(THREADS_PREFER_PTHREAD_FLAG ON) +find_package(Threads REQUIRED) find_package(PythonLibs REQUIRED) @@ -49,59 +50,38 @@ list(GET PY_VERSION_LIST 2 PY_VERSION_PATCH) set(PY_VERSION "${PY_VERSION_MAJOR}${PY_VERSION_MINOR}") - find_package(Boost COMPONENTS python-py${PY_VERSION} QUIET) find_package(Boost COMPONENTS python${PY_VERSION} QUIET) find_package(Boost COMPONENTS python3-py${PY_VERSION} QUIET) - - if(Boost_PYTHON-PY${PY_VERSION}_FOUND) - -set(PY_COMP_SUFFIX "python-py${PY_VERSION}") - + set(PY_COMP_SUFFIX "python-py${PY_VERSION}") elseif(Boost_PYTHON${PY_VERSION}_FOUND) - -set(PY_COMP_SUFFIX "python${PY_VERSION}") - + set(PY_COMP_SUFFIX "python${PY_VERSION}") elseif(Boost_PYTHON3-PY${PY_VERSION}_FOUND) - -set(PY_COMP_SUFFIX "python3-py${PY_VERSION}") - + set(PY_COMP_SUFFIX "python3-py${PY_VERSION}") else() - -message(FATAL_ERROR "Could not find boost python") - + message(FATAL_ERROR "Could not find boost python") endif() message(STATUS "Python suffix: ${PY_COMP_SUFFIX}") - - message(STATUS "Python Version: ${PY_VERSION_MAJOR}.${PY_VERSION_MINOR}") find_package(Boost COMPONENTS filesystem system unit_test_framework program_options ${PY_COMP_SUFFIX} REQUIRED) -find_program(HOMEBREW NAMES brew PATH /usr/local/bin) - -if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" AND HOMEBREW) - execute_process( - #TODO: upgrade to OpenSSL 1.1.1a - COMMAND ${HOMEBREW} --prefix openssl - OUTPUT_VARIABLE OPENSSL_ROOT_DIR - OUTPUT_STRIP_TRAILING_WHITESPACE - ) -elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - #TODO: upgrade to OpenSSL 1.1.1a - # include(InstallOpenSSL) - # set(OPENSSL_USE_STATIC_LIBS TRUE) - # set(OPENSSL_ROOT_DIR ${CMAKE_BINARY_DIR}/openssl) +if(NOT TARGET jsonrpc-project) + include(InstallJsonrpccpp) endif() -#TODO: upgrade to OpenSSL 1.1.1a -find_package(OpenSSL REQUIRED) -include_directories(${OPENSSL_INCLUDE_DIR}) +include(InstallG3log) +find_package(g3logger CONFIG REQUIRED) -find_package(leveldb REQUIRED) +include(InstallCryptoUtils) +include(ProjectSecp256k1) +include(InstallSchnorr) + +include_directories(${SCHNORR_INCLUDE_DIR}/include) +include_directories(${OPENSSL_INCLUDE_DIR}) if(OPENCL_MINE AND CUDA_MINE) message(FATAL_ERROR "Cannot support OpenCL (OPENCL_MINE=ON) and CUDA (CUDA=ON) at the same time") @@ -229,17 +209,10 @@ if(SJ_TEST_SJ_MISSING_MBTXNS) add_definitions(-DSJ_TEST_SJ_MISSING_MBTXNS) endif() -include(FindProtobuf) -set(protobuf_MODULE_COMPATIBLE TRUE) -find_package(Protobuf REQUIRED) include_directories(${PROTOBUF_INCLUDE_DIR}) - include_directories(${CMAKE_SOURCE_DIR}/src/depends/cryptoutils/include/) - include_directories(${G3LOG_INCLUDE_DIR}) -include_directories(${WEBSOCKETPP_INCLUDE_DIR}) - # export compile commands set(CMAKE_EXPORT_COMPILE_COMMANDS ON) @@ -267,6 +240,10 @@ add_compile_options(-Werror) add_compile_options(-pedantic) add_compile_options(-Wextra) +if (${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang") + add_compile_options(-Wno-unused-parameter) +endif() + if (THREAD_SANITIZER AND ADDRESS_SANITIZER) message(FATAL_ERROR "Cannot use ThreadSanitizer (THREAD_SANITIZER=ON) and AddressSanitizer (ADDRESS_SANITIZER=ON) at the same time") endif() @@ -300,7 +277,19 @@ if (LIBFUZZER_SANITIZER) message(STATUS "Libfuzzer with address and undefined behavior sanitizer enabled") endif() -set_property(GLOBAL PROPERTY ALLOW_DUPLICATE_CUSTOM_TARGETS 1) +# FIXME: This following +# +# add_custom_target(ctest COMMAND ${CMAKE_CTEST_COMMAND}) +# +# needs to be fixed. The same chunk of CMake code (as below: +# if (ENABLE_COVERAGE AND CMAKE_COMPILER_IS_GNUCXX) .... +# exists here, in cryptoutils & Schnorr. +# +# Once fixed, the following if-case for allowing duplciate targets +# (which isn't supported in Xcode) can be removed. +if (NOT ${CMAKE_GENERATOR} STREQUAL "Xcode") + set_property(GLOBAL PROPERTY ALLOW_DUPLICATE_CUSTOM_TARGETS 1) +endif() if (ENABLE_COVERAGE AND CMAKE_COMPILER_IS_GNUCXX) if (NOT TESTS) message(FATAL_ERROR "TESTS is not ON") diff --git a/cmake/InstallG3log.cmake b/cmake/InstallG3log.cmake index 4fefed1323..ccacd40c92 100644 --- a/cmake/InstallG3log.cmake +++ b/cmake/InstallG3log.cmake @@ -28,6 +28,7 @@ execute_process( COMMAND ${CMAKE_COMMAND} -H${G3LOG_SOURCE_DIR} -B${G3LOG_BINARY_DIR} + -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DUSE_DYNAMIC_LOGGING_LEVELS=ON -DG3_SHARED_LIB=OFF -DCMAKE_INSTALL_PREFIX=${G3LOG_INSTALL_DIR} diff --git a/cmake/InstallJsonrpccpp.cmake b/cmake/InstallJsonrpccpp.cmake index aa022657b7..d841023a1f 100644 --- a/cmake/InstallJsonrpccpp.cmake +++ b/cmake/InstallJsonrpccpp.cmake @@ -18,7 +18,7 @@ include(${CMAKE_ROOT}/Modules/ExternalProject.cmake) set(JSONRPC_CXX_FLAGS "-Wno-deprecated") set(CMAKE_ARGS -DCMAKE_INSTALL_PREFIX= - -DCMAKE_BUILD_TYPE=Release + -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} # Build static lib but suitable to be included in a shared lib. -DCMAKE_POSITION_INDEPENDENT_CODE=On -DWITH_COVERAGE=Off @@ -42,8 +42,8 @@ set(CMAKE_ARGS -DCMAKE_INSTALL_PREFIX= ExternalProject_Add(jsonrpc-project PREFIX src/depends/jsonrpc - URL https://github.com/Zilliqa/libjson-rpc-cpp/archive/v1.3.0-time-patch.tar.gz - URL_HASH SHA256=cfa2051f24deeba73b92b8f2f7c198eeafb148f7d71e914bfa1a5a33e895f1c8 + URL https://github.com/Zilliqa/libjson-rpc-cpp/archive/refs/tags/v1.3.0-time-patch-fix.tar.gz + URL_HASH SHA256=3315c508e6b8154e3c3f489f7f8826a9c4d697045ee101d80e443d759ac6e218 # On Windows it tries to install this dir. Create it to prevent failure. PATCH_COMMAND cp ${CMAKE_SOURCE_DIR}/vcpkg.json && cmake -E make_directory /win32-deps/include CMAKE_ARGS ${CMAKE_ARGS} diff --git a/cmake/InstallSchnorr.cmake b/cmake/InstallSchnorr.cmake index 79567a0223..16bea31bf7 100644 --- a/cmake/InstallSchnorr.cmake +++ b/cmake/InstallSchnorr.cmake @@ -30,7 +30,7 @@ execute_process( -DCMAKE_INSTALL_PREFIX=${SCHNORR_INSTALL_DIR} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DVCPKG_TARGET_TRIPLET=${VCPKG_TARGET_TRIPLET} - -DCMAKE_BUILD_TYPE:STRING=Release + -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -Wno-dev RESULT_VARIABLE SCHNORR_INSTALL_RET OUTPUT_FILE ${SCHNORR_INSTALL_LOG} diff --git a/cmake/LLVMExtraTools.cmake b/cmake/LLVMExtraTools.cmake index 255b7b7cd7..5d40715883 100644 --- a/cmake/LLVMExtraTools.cmake +++ b/cmake/LLVMExtraTools.cmake @@ -1,6 +1,8 @@ # Additional targets to perform clang-format/clang-tidy # It requires clang-format/clang-tidy 7.0.0+ +include_guard(GLOBAL) + # Get all project files file(GLOB_RECURSE ALL_CXX_SOURCES ${CMAKE_SOURCE_DIR}/src/*.cpp diff --git a/src/cmd/CMakeLists.txt b/src/cmd/CMakeLists.txt index 3567b7dec0..36d7f58eb6 100644 --- a/src/cmd/CMakeLists.txt +++ b/src/cmd/CMakeLists.txt @@ -126,4 +126,11 @@ add_custom_command(TARGET zilliqa POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ ${CMAKE_BINARY_DIR}/tests/Zilliqa) target_include_directories(buildTxBlockHashesToNums PUBLIC ${CMAKE_SOURCE_DIR}/src) -target_link_libraries(buildTxBlockHashesToNums PUBLIC "-Wl,--start-group" AccountData Persistence) + +if (${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang") + target_link_libraries(buildTxBlockHashesToNums PUBLIC AccountData Persistence) +else() + # FIXME: "-Wl,--start-group" was apparently added as a hack for some circular dependency; this shouldn't + # really be required and resolved by fixing the (circular) dependencies. + target_link_libraries(buildTxBlockHashesToNums PUBLIC "-Wl,--start-group" AccountData Persistence) +endif() diff --git a/src/libData/AccountData/CMakeLists.txt b/src/libData/AccountData/CMakeLists.txt index e3cd30cfab..d0f29efea6 100644 --- a/src/libData/AccountData/CMakeLists.txt +++ b/src/libData/AccountData/CMakeLists.txt @@ -1,3 +1,3 @@ add_library(AccountData Account.cpp AccountStoreTemp.cpp AccountStoreBase.cpp AccountStoreSC.cpp AccountStoreTrie.cpp AccountStore.cpp AccountStoreAtomic.cpp Transaction.cpp LogEntry.cpp TransactionReceipt.cpp ScillaClient.cpp BloomFilter.cpp EvmClient.cpp EvmClient.h InvokeType.h AccountStoreSCEvm.cpp) target_include_directories(AccountData PUBLIC ${PROJECT_SOURCE_DIR}/src) -target_link_libraries (AccountData PUBLIC Server Block BlockHeader Message Trie Utils Persistence TraceableDB EthCrypto ${JSONCPP_LINK_TARGETS}) +target_link_libraries (AccountData PUBLIC Server Block BlockHeader Message Trie Utils Persistence TraceableDB EthCrypto jsonrpc::client) diff --git a/src/libEth/CMakeLists.txt b/src/libEth/CMakeLists.txt index f6ddd59a92..d726332661 100644 --- a/src/libEth/CMakeLists.txt +++ b/src/libEth/CMakeLists.txt @@ -1,5 +1,5 @@ add_library(Eth Eth.cpp) -target_include_directories(Eth PUBLIC ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/src) +target_include_directories(Eth PUBLIC ${PROJECT_SOURCE_DIR}/src) target_link_libraries(Eth EthCrypto AccountData) add_library(Filters @@ -10,4 +10,4 @@ add_library(Filters filters/APICache.cpp ) -target_link_libraries(Filters Utils ${JSONCPP_LINK_TARGETS}) +target_link_libraries(Filters Utils jsonrpc::client) diff --git a/src/libMessage/CMakeLists.txt b/src/libMessage/CMakeLists.txt index 0c020f4116..1be9f105f7 100644 --- a/src/libMessage/CMakeLists.txt +++ b/src/libMessage/CMakeLists.txt @@ -1,23 +1,22 @@ protobuf_generate_cpp(PROTO_SRC PROTO_HEADER ZilliqaMessage.proto) -add_library (Message ${PROTO_HEADER} ${PROTO_SRC} Messenger.cpp MessengerAccountStoreBase.cpp MessengerAccountStoreTrie.cpp) -#target_compile_options(Message PRIVATE "-Wno-unused-variable") -#target_compile_options(Message PRIVATE "-Wno-unused-parameter") +add_library (MessageCommon STATIC ${PROTO_SRC}) +target_link_libraries (MessageCommon PUBLIC protobuf::libprotobuf) + +add_library (Message Messenger.cpp MessengerAccountStoreBase.cpp MessengerAccountStoreTrie.cpp) get_target_property(MESSAGE_COMPILE_FLAGS Message COMPILE_OPTIONS ) message(STATUS "Message compile flags old = ${MESSAGE_COMPILE_FLAGS}") list(REMOVE_ITEM MESSAGE_COMPILE_FLAGS -Wextra -Werror) message(STATUS "Message compile flags new = ${MESSAGE_COMPILE_FLAGS}") set_target_properties(Message PROPERTIES COMPILE_OPTIONS "${MESSAGE_COMPILE_FLAGS}") target_include_directories (Message PUBLIC ${PROJECT_SOURCE_DIR}/src ${CMAKE_BINARY_DIR}/src) -target_link_libraries (Message PUBLIC protobuf::libprotobuf AccountData Block BlockHeader MiningData Utils CoinbaseData) +target_link_libraries (Message PUBLIC MessageCommon AccountData Block BlockHeader MiningData CoinbaseData) -add_library (MessageSWInfo ${PROTO_HEADER} ${PROTO_SRC} MessengerSWInfo.cpp) -#target_compile_options(MessageSWInfo PRIVATE "-Wno-unused-variable") -#target_compile_options(MessageSWInfo PRIVATE "-Wno-unused-parameter") +add_library (MessageSWInfo MessengerSWInfo.cpp) get_target_property(MESSAGESWINFO_COMPILE_FLAGS MessageSWInfo COMPILE_OPTIONS ) message(STATUS "MessageSWInfo compile flags old = ${MESSAGESWINFO_COMPILE_FLAGS}") list(REMOVE_ITEM MESSAGESWINFO_COMPILE_FLAGS -Wextra -Werror) message(STATUS "MessageSWInfo compile flags new = ${MESSAGESWINFO_COMPILE_FLAGS}") set_target_properties(MessageSWInfo PROPERTIES COMPILE_OPTIONS "${MESSAGESWINFO_COMPILE_FLAGS}") target_include_directories (MessageSWInfo PUBLIC ${PROJECT_SOURCE_DIR}/src ${CMAKE_BINARY_DIR}/src) -target_link_libraries (MessageSWInfo PUBLIC protobuf::libprotobuf Utils) +target_link_libraries (MessageSWInfo PUBLIC MessageCommon) diff --git a/src/libPersistence/ContractStorage.cpp b/src/libPersistence/ContractStorage.cpp index c9f6427a0f..27e4d67a7a 100644 --- a/src/libPersistence/ContractStorage.cpp +++ b/src/libPersistence/ContractStorage.cpp @@ -27,7 +27,9 @@ #include "libUtils/DataConversion.h" #include "libUtils/JsonUtils.h" +#ifndef __APPLE__ #include +#endif #include using namespace std; diff --git a/src/libPythonRunner/PythonRunner.cpp b/src/libPythonRunner/PythonRunner.cpp index 4ed165228b..a261724c32 100644 --- a/src/libPythonRunner/PythonRunner.cpp +++ b/src/libPythonRunner/PythonRunner.cpp @@ -15,7 +15,19 @@ * along with this program. If not, see . */ +#if defined(__APPLE__) && defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +#pragma clang diagnostic ignored "-Wmissing-field-initializers" +#pragma clang diagnostic ignored "-Wdeprecated-copy-with-user-provided-copy" +#endif + #include "PythonRunner.h" + +#if defined(__APPLE__) && defined(__clang__) +#pragma clang diagnostic pop +#endif + #include "libUtils/Logger.h" using namespace boost::python; @@ -148,4 +160,4 @@ boost::python::list PythonRunner::VectorToPyList(const vector& str) { L.append(s); } return L; -} \ No newline at end of file +} diff --git a/src/libServer/CMakeLists.txt b/src/libServer/CMakeLists.txt index abd5c12d92..1893b2abd8 100644 --- a/src/libServer/CMakeLists.txt +++ b/src/libServer/CMakeLists.txt @@ -3,20 +3,13 @@ add_library(Server Server.cpp ScillaIPCServer.cpp JSONConversion.cpp GetWorkServ add_dependencies(Server jsonrpc-project) target_include_directories(Server PUBLIC - ${PROJECT_SOURCE_DIR}/src - ${JSONRPC_INCLUDE_DIR} - ${WEBSOCKETPP_INCLUDE_DIR}) + ${PROJECT_SOURCE_DIR}/src) -target_link_libraries (Server PUBLIC - AccountData - Validator - RemoteStorageDB - Eth - ${JSONCPP_LINK_TARGETS} - ${WEBSOCKETPP_LIB} - Utils - Constants - POW) +target_link_libraries (Server PUBLIC + jsonrpc::server + AccountData + Validator + Eth) target_link_libraries (Server PRIVATE CryptoUtils diff --git a/src/libServer/JSONConversion.cpp b/src/libServer/JSONConversion.cpp index 90be65bbbb..bed85bc30e 100644 --- a/src/libServer/JSONConversion.cpp +++ b/src/libServer/JSONConversion.cpp @@ -58,7 +58,7 @@ const Json::Value JSONConversion::convertBooleanVectorToJson( Json::Value _json = Json::arrayValue; for (const auto& i : B) { - _json.append(i); + _json.append(Json::Value(i)); } return _json; } diff --git a/src/libUtils/CommonUtils.cpp b/src/libUtils/CommonUtils.cpp index 0d15b37a34..48924080bb 100644 --- a/src/libUtils/CommonUtils.cpp +++ b/src/libUtils/CommonUtils.cpp @@ -15,7 +15,9 @@ * along with this program. If not, see . */ +#ifdef __linux__ #include +#endif #include #include @@ -25,6 +27,7 @@ using namespace std; void CommonUtils ::ReleaseSTLMemoryCache() { +#ifdef __linux__ LOG_MARKER(); static mutex relMemoryCacheMutex; @@ -34,4 +37,5 @@ void CommonUtils ::ReleaseSTLMemoryCache() { } else { LOG_GENERAL(WARNING, "MemoryCache cleanup already in progress!"); } -} \ No newline at end of file +#endif +} diff --git a/src/libUtils/MemoryStats.cpp b/src/libUtils/MemoryStats.cpp index 30bac2cbea..a2ad4162b1 100644 --- a/src/libUtils/MemoryStats.cpp +++ b/src/libUtils/MemoryStats.cpp @@ -18,7 +18,9 @@ #include #include #include "libUtils/Logger.h" +#ifndef __APPLE__ #include "sys/sysinfo.h" +#endif #include "sys/types.h" using namespace std; @@ -71,6 +73,7 @@ int GetProcessVirtualMemoryStats() { // Note: this value is in KB! } void DisplayVirtualMemoryStats() { +#ifndef __APPLE__ struct sysinfo memInfo = {}; sysinfo(&memInfo); long long totalVirtualMem = memInfo.totalram; @@ -90,9 +93,13 @@ void DisplayVirtualMemoryStats() { LOG_GENERAL(INFO, "VM used by process = " << processVirtualMemUsed / 1024 << " MB" << " pid=" << Logger::GetPid()); +#endif } int64_t DisplayPhysicalMemoryStats(const string& str, int64_t startMem) { +#ifdef __APPLE__ + return 0; +#else struct sysinfo memInfo = {}; sysinfo(&memInfo); int processPhysMemUsed = GetProcessPhysicalMemoryStats(); @@ -105,4 +112,5 @@ int64_t DisplayPhysicalMemoryStats(const string& str, int64_t startMem) { LOG_GENERAL(INFO, "PM diff = " << diff << " " << str); } return processPhysMemUsedMB; -} \ No newline at end of file +#endif +} diff --git a/src/libValidator/CMakeLists.txt b/src/libValidator/CMakeLists.txt index d5a60b7803..b1c851c512 100644 --- a/src/libValidator/CMakeLists.txt +++ b/src/libValidator/CMakeLists.txt @@ -1,3 +1,3 @@ add_library (Validator Validator.cpp) target_include_directories (Validator PUBLIC ${PROJECT_SOURCE_DIR}/src) -target_link_libraries (Validator PUBLIC Mediator g3logger) +target_link_libraries (Validator PRIVATE Mediator) diff --git a/tests/Crypto/CMakeLists.txt b/tests/Crypto/CMakeLists.txt index 4d43dcf7cb..211b8ea0c6 100644 --- a/tests/Crypto/CMakeLists.txt +++ b/tests/Crypto/CMakeLists.txt @@ -6,7 +6,7 @@ target_link_libraries(Test_Sha2 PUBLIC OpenSSL::Crypto Utils Boost::unit_test_fr add_test(NAME Test_Sha2 COMMAND Test_Sha2) add_executable(Test_EthCrypto Test_EthCrypto.cpp) -target_link_libraries(Test_EthCrypto PUBLIC crypto Utils Boost::unit_test_framework) +target_link_libraries(Test_EthCrypto PUBLIC Utils Boost::unit_test_framework) target_link_libraries(Test_EthCrypto PUBLIC EthCrypto Eth OpenSSL::Crypto Common jsonrpc::client) add_test(NAME Test_EthCrypto COMMAND Test_EthCrypto) diff --git a/tests/Lookup/CMakeLists.txt b/tests/Lookup/CMakeLists.txt index 8ef7715f59..c03893e450 100644 --- a/tests/Lookup/CMakeLists.txt +++ b/tests/Lookup/CMakeLists.txt @@ -24,10 +24,18 @@ target_include_directories(Test_txn_send PUBLIC ${CMAKE_SOURCE_DIR}/src ${CMAKE_ target_link_libraries(Test_txn_send PUBLIC Node Mediator TestUtils) add_test(NAME Test_txn_send COMMAND Test_txn_send) - - -add_custom_command(TARGET Test_txn_send POST_BUILD - COMMAND sed -i '//c\ true' constants.xml) +if (${CMAKE_GENERATOR} STREQUAL "Xcode") + add_custom_command(TARGET Test_txn_send POST_BUILD + COMMAND sed -i '' 's,.*,true,' ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/constants.xml) +else() + if (APPLE) + add_custom_command(TARGET Test_txn_send POST_BUILD + COMMAND sed -i '' 's,.*,true,' constants.xml) + else() + add_custom_command(TARGET Test_txn_send POST_BUILD + COMMAND sed -i 's,.*,true,' constants.xml) + endif() +endif() add_custom_command(TARGET Test_txn_send POST_BUILD COMMAND echo "" > config.xml VERBATIM)