Skip to content

PlatONnetwork/PlatON-CDT

Repository files navigation

logo

中文

PlatON-CDT (Contract Development Toolkit)

PlatON-CDT is a toolchain for WebAssembly(WASM) and set of tools to faciliate contract writing for the PlatON platform.

Build

Required

  • GCC 5.4+ or Clang 4.0+
  • CMake 3.5+
  • Git
  • Tar
  • Wget
  • Golang 1.14+

Ubuntu

Required: 18.04

  • Install Dependencies
sudo apt install build-essential cmake libz-dev libtinfo-dev tar wget
  • Get Source Code
git clone https://github.com/PlatONnetwork/PlatON-CDT.git
cd PlatON-CDT
git checkout feature/wasm
  • Build Code

    • Build with script

      ./scripts/build.sh
      cd build
      sudo make install
    • cmake build

      mkdir build && cd build
      cmake ..
      make -j
      sudo make install

      Some common cmake options:

      • -DTEST=ON To build a unit test module, you need to install go1.13 and above first (the unit test module is not built by default).
      • -DCMAKE_INSTALL_PREFIX=directory Specify the directory to install cdt related tools and dependent libraries (default / usr / local).
      • -DCDT_BUILD_TYPE=type The valid options for the build type are Debug and Release. Debug mode assertion checking will be enabled, and the log file will print debugging and error information. (The default is Release).

      If you are building a unit test module, you need to download PlatON-Go in the ./tools/platon-test/node directory, and compile it after the download is complete.

      cd tools/platon-test && mkdir node && cd node
      git clone git@github.com:PlatONnetwork/PlatON-Go.git --recursive
      cd PlatON-Go
      git checkout ${BRANCH}
      make all

Usage

If you use the CMAKE_INSTALL_PREFIX option to specify the installation directory, you must add the executable file path generated by PlatON-CDT to the PATH environment variable before using PlatON-CDT (installed in the /usr/local/bin directory by default).

platon-cpp test.cpp

run command could generate test.wasm and test.abi.json in current dirctoy.

License

GNU General Public License v3.0, see LICENSE.