Skip to content

Latest commit

 

History

History
51 lines (41 loc) · 1.45 KB

README.md

File metadata and controls

51 lines (41 loc) · 1.45 KB
git clone --recurse-submodules [email protected]:animeshxd/tdffi-dev.git
cd tdffi-dev/

build tdlib https://github.com/tdlib/td#building

mkdir td/build
cd td/build
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build . --target tdjson
cd ..
cd .. # tdffi-dev/
mkdir -p headers/td/telegram/
cp td/build/td/telegram/tdjson_export.h headers/td/telegram/tdjson_export.h
cp td/td/telegram/td_json_client.h headers/td_json_client.h

dart pub global activate ffigen
# for termux: dart pub global activate ffigen -sgit https://github.com/animeshxd/ffigen

python generator/generate_dart.py
cd tdffi

# use it in your own dart/flutter package
#
# dart/flutter create <your/package/location>
# DART_PACKAGE_DIR=<your/package/location> python generator/generate_dart.py
# cd <your/package/location>
# dart pub add ffi

dart pub get


# change in ffigen.yaml
# output: 'your/package/location/lib/src/generated/ffi/td_json_client.dart'
# The output: location should be relative to ffigen.yaml or is absolute

# dart pub global run ffigen --config ../ffigen.yaml 
# dart pub global run ffigen --config <path/to/ffigen.yaml> 

output locations:

  • tdffi/lib/td.dart
  • tdffi/lib/src/generated/
  • json/

example: