跳至主要内容
此页面是从英文翻译而来的。请注意,与原始页面相比,可能会出现错误或差异。真实的文档来源应始终是英文版本。

How to compile a smart contract with CMake

Overview

This guide provides instructions to compile a smart contract with CMake.

Before you begin

  • You have the source of the contract saved in a local folder, e.g. ./examples/hello/

Procedure

Follow the following steps to compile your contract.

  1. Navigate to the hello folder in examples (./examples/hello), you should then see the ./src/hello.cpp file

  2. Run following commands:

    mkdir build
    cd build
    cmake ..
    make
  3. Verify the following two files were generated:

  • the compiled binary wasm: hello.wasm,
  • and the generated ABI file: hello.abi.

Summary

In conclusion, the above instructions show how to compile a smart contract with CMake.