diff --git a/Makefile b/Makefile index c31a5dd..db5361d 100644 --- a/Makefile +++ b/Makefile @@ -28,10 +28,14 @@ cwtch.aar: lib.go 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 + GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc go build -buildmode c-shared -o libCwtch.dll + +# Command to build a static .lib for windows. Some linkers want this even when using a .dll at runtime. Still seems to have a dep on msvcrt.lib +libCwtch.lib: lib.go + GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc CGO_CFLAGS=-D__USE_MINGW_ANSI_STDIO=0 CGO_CPPFLAGS=-D__USE_MINGW_ANSI_STDIO=0 go build -buildmode c-archive -o libCwtch.lib clean: - rm -f cwtch.aar cwtch_go.apk libCwtch.h libCwtch.so cwtch-sources.jar libCwtch.dll libCwtch.dylib + rm -f cwtch.aar cwtch_go.apk libCwtch.h libCwtch.so cwtch-sources.jar libCwtch.dll libCwtch.lib libCwtch.dylib # iOS - for testing purposes only for now, not officially supported diff --git a/README.md b/README.md index 8cbd741..01acb57 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,10 @@ Go 1.17.4, NDK 22.1.7171670, and gomobile 4e6c2922fdeed32d3596616518aaee7b0d79ce Other version combinations untested and some definitely do not work. +## Windows + +Cwtch relies on sqlite which in turn requires the use of CGO. As per [this issue](https://github.com/golang/go/issues/12029) that means [TDM-GCC](https://jmeubank.github.io/tdm-gcc/download/) is required to be installed and used to compile on Windows. Install it and add it to your path and `make windows` should then work. + ## Experimental iOS support make ios