2019-09-10 10:30:35 +02:00
|
|
|
# Tonlib C++ basic usage examples
|
2019-09-07 12:03:22 +02:00
|
|
|
|
2019-09-10 10:30:35 +02:00
|
|
|
Tonlib should be prebuilt and installed to local subdirectory `tonlib/`:
|
2019-09-07 12:03:22 +02:00
|
|
|
```
|
2019-09-10 10:30:35 +02:00
|
|
|
cd <path to Ton sources>
|
2019-09-07 12:03:22 +02:00
|
|
|
mkdir build
|
|
|
|
cd build
|
2019-09-10 10:30:35 +02:00
|
|
|
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=../example/cpp/tonlib ..
|
2019-09-07 12:03:22 +02:00
|
|
|
cmake --build . --target install
|
|
|
|
```
|
|
|
|
|
|
|
|
Then you can build the examples:
|
|
|
|
```
|
2019-09-10 10:30:35 +02:00
|
|
|
cd <path to Ton sources>/example/cpp
|
2019-09-07 12:03:22 +02:00
|
|
|
mkdir build
|
|
|
|
cd build
|
2019-09-10 10:30:35 +02:00
|
|
|
cmake -DCMAKE_BUILD_TYPE=Release -DTonlib_DIR=<full path to Ton sources>/example/cpp/tonlib/lib/cmake/Tonlib ..
|
2019-09-07 12:03:22 +02:00
|
|
|
cmake --build .
|
|
|
|
```
|
|
|
|
|
2019-09-10 10:30:35 +02:00
|
|
|
To run `tonjson_example` you may need to manually copy a `tonlibjson` shared library from `tonlib/bin` to a directory containing built binaries.
|