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"