From 7eada9065fe346e684bad634f8afb6aa102a0b00 Mon Sep 17 00:00:00 2001 From: Aleksandr Zelenin Date: Tue, 4 Jan 2022 07:59:32 +0300 Subject: [PATCH] windows build readme --- README.md | 17 ++++++++++++++++- client/tdjson_dynamic.go | 6 ++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9cf7ce2..9aa0666 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,22 @@ Go wrapper for [TDLib (Telegram Database Library)](https://github.com/tdlib/td) ## TDLib installation -Use [TDLib build instructions](https://tdlib.github.io/td/build.html) +Use [TDLib build instructions](https://tdlib.github.io/td/build.html) to build. + +### Windows + +Build with environment variables: + +``` +CGO_CFLAGS=-IC:/path/to/tdlib/build/tdlib/include +CGO_LDFLAGS=-LC:/path/to/tdlib/build/tdlib/bin -ltdjson +``` + +Example for PowerShell: + +```powershell +$env:CGO_CFLAGS="-IC:/td/tdlib/include"; $env:CGO_LDFLAGS="-LC:/td/tdlib/bin -ltdjson"; go build -trimpath -ldflags="-s -w" -o demo.exe .\cmd\demo.go +``` ## Usage diff --git a/client/tdjson_dynamic.go b/client/tdjson_dynamic.go index 4a88485..cda7e2e 100644 --- a/client/tdjson_dynamic.go +++ b/client/tdjson_dynamic.go @@ -1,6 +1,6 @@ -//go:build libtdjson && (linux || darwin || windows) +//go:build libtdjson && (linux || darwin) // +build libtdjson -// +build linux darwin windows +// +build linux darwin package client @@ -9,7 +9,5 @@ package client #cgo linux LDFLAGS: -L/usr/local/lib -ltdjson -lstdc++ -lssl -lcrypto -ldl -lz -lm #cgo darwin CFLAGS: -I/usr/local/include #cgo darwin LDFLAGS: -L/usr/local/lib -ltdjson -lstdc++ -lssl -lcrypto -ldl -lz -lm -#cgo windows CFLAGS: -Ic:/td -Ic:/td/example/csharp/build -#cgo windows LDFLAGS: -Lc:/td/example/csharp/build/Release -ltdjson */ import "C"