Search code examples
dockercmakehyperledger-iroha

Building Iroha in Docker with cmake


I try to build Iroha Hyperledger using Doker. after I clone the image and try to execute the build with CMake

cmake -H. -Bbuild -DCMAKE_TOOLCHAIN_FILE=/opt/dependencies/scripts/buildsystems/vcpkg.cmake -G "Ninja"

I got this error:

Could not find toolchain file:
  /opt/dependencies/scripts/buildsystems/vcpkg.cmake
Call Stack (most recent call first):
  CMakeLists.txt:12 (PROJECT)

I use CMake 3.16

Any help


Solution

  • Commands to do (as @kyb said) and according to instruction:

    1. Installing dependencies:
    apt-get update; \
    apt-get -y --no-install-recommends install \
    build-essential ninja-build \
    git ca-certificates tar curl unzip cmake
    
    1. Clonning iroha:
    git clone https://github.com/hyperledger/iroha.git
    
    1. Building dependencies:
    iroha/vcpkg/build_iroha_deps.sh
    vcpkg/vcpkg integrate install
    

    As a result You will see command like:

    -DCMAKE_TOOLCHAIN_FILE=/path/to/vcpkg/scripts/buildsystems/vcpkg.cmake
    
    1. Finally You need to add the command to the CMake command (as You provided):
    cmake -H. -Bbuild -DCMAKE_TOOLCHAIN_FILE=/opt/dependencies/scripts/buildsystems/vcpkg.cmake -G "Ninja"
    
    1. Last step would be run ninja:
    cmake --build . --target irohad -- -j<number of threads>
    
    1. Optionally You can install the binaries:
    cmake --install . --target irohad