This repository contains two templates for developing IOTA client application out of the box.
- Bazel template: building your application with Bazel.
- CMake template: building your application with CMake.
For more details:
Bazel C++ Tutorial
CMake Tutorial
Source layout:
.
├── bazel_template
│ ├── BUILD
│ ├── .clang-format
│ ├── config.h
│ ├── .gitignore
│ ├── my_app.c
│ └── WORKSPACE
├── cmake_template
│ ├── .clang-format
│ ├── CMakeLists.txt
│ ├── config.h
│ ├── .gitignore
│ └── my_app.c
├── LICENSE
└── README.md
After clone this repository, copy and rename a template to your project workspace.
git clone https://github.com/oopsmonk/iota_c_templates.git
# cmake project
cp -r iota_c_templates/cmake_template iota_cmake_app
# bazel or bazelisk project
cp -r iota_c_templates/bazel_template iota_bazel_app
It is tested on Ubuntu but I believe it works on MacOS as well.
For making sure your Bazel is up-to-date or you can use bazelisk
# cmake
cd iota_cmake_app
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=$PWD .. && make -j8
# run the example
./my_app
# bazel
cd iota_bazel_app
bazel run my_app
# bazelisk
cd iota_bazel_app
USE_BAZEL_VERSION=3.2.0 bazelisk run my_app
It is tested via Powershell on Windows 10.
The iota.c library only support MinGW compiler on Windows, make sure you have installed it on your system.
Due to the CMake symlink issue we can use ninja generator instead of the default generator.
Requirements
# cmake
cp -r iota_c_templates/cmake_template iota_cmake_app
PS C:\Users\Sam\IOTA\> cd iota_cmake_app
PS C:\Users\Sam\IOTA\iota_cmake_app> mkdir app_build && cd app_build
PS C:\Users\Sam\IOTA\iota_cmake_app\app_build> cmake.exe -G Ninja -DCMAKE_INSTALL_PREFIX=$PWD ..
PS C:\Users\Sam\IOTA\iota_cmake_app\app_build> ninja.exe
# run the example
PS C:\Users\Sam\IOTA\iota_cmake_app\app_build> .\my_app.exe
# bazel
cp -r iota_c_templates/bazel_template iota_bazel_app
PS C:\Users\Sam\IOTA> cd iota_bazel_app
PS C:\Users\Sam\IOTA\iota_bazel_app> bazel.exe run --compiler=mingw-gcc my_app
# bazelisk
PS C:\Users\Sam\IOTA\iota_bazel_app> bazelisk.exe run --compiler=mingw-gcc my_app