This repository has been archived on 2023-06-16. You can view files and clone it, but cannot push or open issues or pull requests.
libcwtch-go/Makefile

46 lines
1001 B
Makefile
Raw Normal View History

2021-05-10 18:25:49 +00:00
IOS_OUT := ./ios
2021-06-26 23:20:57 +00:00
.PHONY: all linux android windows clean
2021-06-24 22:30:46 +00:00
DEFAULT_GOAL: linux
all: linux android
linux: libCwtch.so
android: cwtch.aar
windows: libCwtch.dll
libCwtch.so: lib.go
./switch-ffi.sh
go build -buildmode c-shared -o libCwtch.so
cwtch.aar: lib.go
./switch-gomobile.sh
gomobile bind -target android
libCwtch.dll: lib.go
./switch-ffi.sh
GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc-win32 go build -buildmode c-shared -o libCwtch.dll
clean:
rm -f cwtch.aar cwtch_go.apk libCwtch.h libCwtch.so cwtch-sources.jar libCwtch.dll
2021-05-10 18:25:49 +00:00
ios-arm64:
CGO_ENABLED=1 \
GOOS=darwin \
GOARCH=arm64 \
CGO_CFLAGS="-fembed-bitcode" \
go build -buildmode=c-archive -tags ios -o $(IOS_OUT)/arm64.a .
ios-x86_64:
CGO_ENABLED=1 \
GOOS=darwin \
GOARCH=amd64 \
go build -buildmode=c-archive -tags ios -o $(IOS_OUT)/x86_64.a .
ios: ios-arm64 ios-x86_64
lipo $(IOS_OUT)/x86_64.a $(IOS_OUT)/arm64.a -create -output $(IOS_OUT)/cwtch.a
cp $(IOS_OUT)/arm64.h $(IOS_OUT)/cwtch.h