diff --git a/README.md b/README.md index 4cc0a2e..bf1df77 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ Created by members of the [Ipsilon] (ex-[Ewasm]) team. - [evmc](https://github.com/ethereum/evmc) - [intx](https://github.com/chfast/intx) +- [ethash](https://github.com/chfast/ethash) - [blueprint](https://github.com/NilFoundation/zkllvm-blueprint) - [crypto3](https://github.com/NilFoundation/crypto3) @@ -40,12 +41,18 @@ Run tests: nix flake check ``` -## Build +## Build without Nix + +### Provide CMAKE_PREFIX_PATH with paths to dependent modules +```bash +export CMAKE_PREFIX_PATH=$EVMC_PATH:$INTX_PATH:$ETHASH_PATH:$BLUEPRINT_PATH:$CRYPTO3_PATH +``` +Note: this variable could be retrieved from Nix shell environment ### Configure cmake ```bash -cmake -G "Ninja" -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_ASSIGNER_TESTS=TRUE +cmake -G "Ninja" -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_ASSIGNER_TESTS=TRUE -DHUNTER_ENABLED=OFF ``` diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index dd20833..0b32409 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -5,6 +5,24 @@ hunter_add_package(intx) find_package(intx CONFIG REQUIRED) +# Find crypto3 and blueprint packages +# TODO: replace with find_package if possible +string(REPLACE ":" ";" MODULE_LIST $ENV{CMAKE_PREFIX_PATH}) +foreach(module_path ${MODULE_LIST}) + if (module_path MATCHES ".*blueprint") + set(BLUEPRINT_DIR ${module_path}) + elseif(module_path MATCHES ".*[cC]rypto3") + set(CRYPTO3_DIR ${module_path}) + endif() +endforeach() + +if ("${BLUEPRINT_DIR}" STREQUAL "") + message(FATAL_ERROR "blueprint library was not found. You should provide it through CMAKE_PREFIX_PATH") +endif() +if ("${CRYPTO3_DIR}" STREQUAL "") + message(FATAL_ERROR "crypto3 library was not found. You should provide it through CMAKE_PREFIX_PATH") +endif() + add_subdirectory(fprinter) add_subdirectory(evmone) add_subdirectory(assigner) diff --git a/lib/assigner/CMakeLists.txt b/lib/assigner/CMakeLists.txt index fbc47a1..ba4f541 100644 --- a/lib/assigner/CMakeLists.txt +++ b/lib/assigner/CMakeLists.txt @@ -7,10 +7,14 @@ option(BUILD_ASSIGNER_TESTS "Build unit tests" FALSE) add_library(${PROJECT_NAME} STATIC src/vm_host.cpp) +find_package(Boost COMPONENTS REQUIRED filesystem log log_setup program_options thread system) + target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include ${include_dir}/evmone ${CMAKE_CURRENT_SOURCE_DIR}/../evmone + ${BLUEPRINT_DIR}/include + ${CRYPTO3_DIR}/include ${Boost_INCLUDE_DIRS}) @@ -19,10 +23,13 @@ target_include_directories(${PROJECT_NAME} PUBLIC target_link_libraries(${PROJECT_NAME} PUBLIC evmone) +# Install assigner headers install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/nil/blueprint/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/nil/blueprint) +# Install library +install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) -#evmone +# Install evmone headers install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../evmone/vm.hpp ${CMAKE_CURRENT_SOURCE_DIR}/../evmone/execution_state.hpp ${CMAKE_CURRENT_SOURCE_DIR}/../evmone/tracing.hpp diff --git a/lib/evmone/CMakeLists.txt b/lib/evmone/CMakeLists.txt index d22a561..7ad6e23 100644 --- a/lib/evmone/CMakeLists.txt +++ b/lib/evmone/CMakeLists.txt @@ -30,7 +30,7 @@ add_library(evmone ${evmone_sources}) get_target_property(FPRINTER_DIR fprinter SOURCE_DIR) target_compile_features(evmone PUBLIC cxx_std_20) -target_link_libraries(evmone PUBLIC evmc::evmc intx::intx PRIVATE ethash::keccak) +target_link_libraries(evmone PUBLIC evmc::evmc intx::intx ethash::keccak) target_include_directories(evmone PUBLIC $$ ${FPRINTER_DIR}