C-bindings for the Go Cwtch Library https://cwtch.im
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.3 KiB

6 months ago
2 months ago
2 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
  1. IOS_OUT := ./ios
  2. .PHONY: all linux android windows macos clean ios
  3. DEFAULT_GOAL: linux
  4. all: linux android windows
  5. linux: libCwtch.so
  6. macos: libCwtch.dylib
  7. android: cwtch.aar
  8. windows: libCwtch.dll
  9. libCwtch.so: lib.go
  10. ./switch-ffi.sh
  11. go build -buildmode c-shared -o libCwtch.so
  12. libCwtch.dylib: lib.go
  13. ./switch-ffi.sh
  14. go build -buildmode c-shared -o libCwtch.dylib
  15. cwtch.aar: lib.go
  16. ./switch-gomobile.sh
  17. gomobile bind -target android
  18. libCwtch.dll: lib.go
  19. ./switch-ffi.sh
  20. GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc-win32 go build -buildmode c-shared -o libCwtch.dll
  21. clean:
  22. rm -f cwtch.aar cwtch_go.apk libCwtch.h libCwtch.so cwtch-sources.jar libCwtch.dll libCwtch.dylib
  23. # iOS - for testing purposes only for now, not officially supported
  24. ios-arm64:
  25. CGO_ENABLED=1 \
  26. GOOS=darwin \
  27. GOARCH=arm64 \
  28. SDK=iphoneos \
  29. CGO_CFLAGS="-fembed-bitcode" \
  30. CC=$(PWD)/clangwrap.sh \
  31. go build -buildmode=c-archive -tags ios -o $(IOS_OUT)/arm64.a .
  32. ios-x86_64:
  33. CGO_ENABLED=1 \
  34. GOOS=darwin \
  35. GOARCH=amd64 \
  36. SDK=iphonesimulator \
  37. CC=$(PWD)/clangwrap.sh \
  38. go build -buildmode=c-archive -tags ios -o $(IOS_OUT)/x86_64.a .
  39. ios: ios-arm64 ios-x86_64
  40. lipo $(IOS_OUT)/x86_64.a $(IOS_OUT)/arm64.a -create -output $(IOS_OUT)/cwtch.a
  41. cp $(IOS_OUT)/arm64.h $(IOS_OUT)/cwtch.h