windows build readme

This commit is contained in:
Aleksandr Zelenin 2022-01-04 07:59:32 +03:00
parent e5d2ffd3f9
commit 7eada9065f
2 changed files with 18 additions and 5 deletions

View file

@ -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

View file

@ -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"