From 3e22bd19882d61db43ed6e2c089526941c529f63 Mon Sep 17 00:00:00 2001 From: Peter Oschwald Date: Fri, 15 Sep 2023 12:05:54 -0500 Subject: [PATCH] Create EosioChain interface library. --- CMakeModules/EosioTester.cmake.in | 99 ++++++++++++------------ CMakeModules/EosioTesterBuild.cmake.in | 102 +++++++++++++------------ 2 files changed, 104 insertions(+), 97 deletions(-) diff --git a/CMakeModules/EosioTester.cmake.in b/CMakeModules/EosioTester.cmake.in index 27eefb1354..2478d7f9fc 100644 --- a/CMakeModules/EosioTester.cmake.in +++ b/CMakeModules/EosioTester.cmake.in @@ -67,60 +67,65 @@ if("eos-vm-oc" IN_LIST EOSIO_WASM_RUNTIMES) set(WRAP_MAIN "-Wl,-wrap=main") endif() +add_library(EosioChain INTERFACE) + +target_link_libraries(EosioChain INTERFACE + ${libchain} + ${libfc} + ${libwast} + ${libwasm} + ${libir} + ${libsoftfloat} + ${liboscrypto} + ${liblogging} + ${libchainbase} + ${libbuiltins} + ${libsecp256k1} + ${libbn256} + ${libbls12-381} + @GMP_LIBRARY@ + + Boost::date_time + Boost::filesystem + Boost::system + Boost::chrono + Boost::multi_index + Boost::multiprecision + Boost::interprocess + Boost::asio + Boost::signals2 + Boost::iostreams + "-lz" # Needed by Boost iostreams + + ${LLVM_LIBS} + + ${PLATFORM_SPECIFIC_LIBS} + + ${WRAP_MAIN} + Threads::Threads +) + +target_include_directories(EosioChain INTERFACE + @OPENSSL_INCLUDE_DIR@ + @CMAKE_INSTALL_PREFIX@ + @CMAKE_INSTALL_FULL_INCLUDEDIR@ + @CMAKE_INSTALL_FULL_INCLUDEDIR@/wasm-jit + @CMAKE_INSTALL_FULL_INCLUDEDIR@/softfloat ) + +#adds -ltr. Ubuntu eosio.contracts build breaks without this +if(UNIX AND NOT APPLE) + target_link_libraries(EosioChain INTERFACE ${LIBRT}) +endif() + macro(add_eosio_test_executable test_name) add_executable( ${test_name} ${ARGN} ) target_link_libraries( ${test_name} + EosioChain ${libtester} - ${libchain} - ${libfc} - ${libwast} - ${libwasm} - ${libir} - ${libsoftfloat} - ${liboscrypto} - ${liblogging} - ${libchainbase} - ${libbuiltins} - ${libsecp256k1} - ${libbn256} - ${libbls12-381} - @GMP_LIBRARY@ - - Boost::date_time - Boost::filesystem - Boost::system - Boost::chrono - Boost::multi_index - Boost::multiprecision - Boost::program_options - Boost::beast - Boost::interprocess - Boost::asio - Boost::signals2 - Boost::iostreams - "-lz" # Needed by Boost iostreams - Boost::unit_test_framework - ${LLVM_LIBS} - - ${PLATFORM_SPECIFIC_LIBS} - - ${WRAP_MAIN} - Threads::Threads + Boost::unit_test_framework ) - #adds -ltr. Ubuntu eosio.contracts build breaks without this - if(UNIX AND NOT APPLE) - target_link_libraries(${test_name} ${LIBRT}) - endif() - - target_include_directories( ${test_name} PUBLIC - @OPENSSL_INCLUDE_DIR@ - @CMAKE_INSTALL_PREFIX@ - @CMAKE_INSTALL_FULL_INCLUDEDIR@ - @CMAKE_INSTALL_FULL_INCLUDEDIR@/wasm-jit - @CMAKE_INSTALL_FULL_INCLUDEDIR@/softfloat ) - endmacro() macro(add_eosio_test test_name) diff --git a/CMakeModules/EosioTesterBuild.cmake.in b/CMakeModules/EosioTesterBuild.cmake.in index 91a17b6d6e..8ac8a99cc5 100644 --- a/CMakeModules/EosioTesterBuild.cmake.in +++ b/CMakeModules/EosioTesterBuild.cmake.in @@ -64,63 +64,65 @@ if("eos-vm-oc" IN_LIST EOSIO_WASM_RUNTIMES) set(WRAP_MAIN "-Wl,-wrap=main") endif() +add_library(EosioChain INTERFACE) + +target_link_libraries(EosioChain INTERFACE + ${libchain} + ${libfc} + ${libwast} + ${libwasm} + ${libir} + ${libsoftfloat} + ${liboscrypto} + ${liblogging} + ${libchainbase} + ${libbuiltins} + ${libsecp256k1} + ${libbn256} + ${libbls12-381} + @GMP_LIBRARY@ + + Boost::date_time + Boost::filesystem + Boost::system + Boost::chrono + Boost::multi_index + Boost::multiprecision + Boost::interprocess + Boost::asio + Boost::signals2 + Boost::iostreams + "-lz" # Needed by Boost iostreams + + ${LLVM_LIBS} + + ${PLATFORM_SPECIFIC_LIBS} + + ${WRAP_MAIN} + Threads::Threads +) + +target_include_directories(EosioChain INTERFACE + @OPENSSL_INCLUDE_DIR@ + @CMAKE_INSTALL_PREFIX@ + @CMAKE_INSTALL_FULL_INCLUDEDIR@ + @CMAKE_INSTALL_FULL_INCLUDEDIR@/wasm-jit + @CMAKE_INSTALL_FULL_INCLUDEDIR@/softfloat ) + +#adds -ltr. Ubuntu eosio.contracts build breaks without this +if(UNIX AND NOT APPLE) + target_link_libraries(EosioChain INTERFACE ${LIBRT}) +endif() + macro(add_eosio_test_executable test_name) add_executable( ${test_name} ${ARGN} ) target_link_libraries( ${test_name} + EosioChain ${libtester} - ${libchain} - ${libfc} - ${libwast} - ${libwasm} - ${libir} - ${libsoftfloat} - ${liboscrypto} - ${liblogging} - ${libchainbase} - ${libbuiltins} - ${libsecp256k1} - ${libbn256} - ${libbls12-381} - @GMP_LIBRARY@ - - Boost::date_time - Boost::filesystem - Boost::system - Boost::chrono - Boost::multi_index - Boost::multiprecision - Boost::program_options - Boost::beast - Boost::interprocess - Boost::asio - Boost::signals2 - Boost::iostreams - "-lz" # Needed by Boost iostreams - Boost::unit_test_framework - ${LLVM_LIBS} - - ${PLATFORM_SPECIFIC_LIBS} - - ${WRAP_MAIN} - Threads::Threads + Boost::unit_test_framework ) - #adds -ltr. Ubuntu eosio.contracts build breaks without this - if(UNIX AND NOT APPLE) - target_link_libraries(${test_name} ${LIBRT}) - endif() - - target_include_directories( ${test_name} PUBLIC - @OPENSSL_INCLUDE_DIR@ - @CMAKE_SOURCE_DIR@/libraries/chain/include - @CMAKE_BINARY_DIR@/libraries/chain/include - @CMAKE_SOURCE_DIR@/libraries/libfc/include - @CMAKE_SOURCE_DIR@/libraries/softfloat/source/include - @CMAKE_SOURCE_DIR@/libraries/appbase/include - @CMAKE_SOURCE_DIR@/libraries/chainbase/include - @CMAKE_SOURCE_DIR@/libraries/testing/include - @CMAKE_SOURCE_DIR@/libraries/wasm-jit/Include ) endmacro() macro(add_eosio_test test_name)