diff --git a/.drone.yml b/.drone.yml index 31d3246..9e1b905 100644 --- a/.drone.yml +++ b/.drone.yml @@ -158,10 +158,18 @@ steps: # TODO: upgrade to go1.16, remove mod/vendor, add go install for 1.16 - echo `git describe --tags` > VERSION - echo `date +%G-%m-%d-%H-%M` > BUILDDATE - - name: build-macos + - name: build-macos-x64 commands: - export PATH=$PATH:/usr/local/go/bin/ - - make macos + - make libCwtch.x64.dylib + - name: build-macos-arm64 + when: + event: + - push + status: [ success ] + commands: + - export PATH=$PATH:/usr/local/go/bin/ + - make libCwtch.arm.dylib - name: deploy-buildfiles environment: BUILDFILES_KEY: @@ -177,6 +185,7 @@ steps: - export DIR=libCwtch-go-macos-`cat BUILDDATE`-`cat VERSION` - mkdir $DIR - mv libCwtch.dylib $DIR/ + - mv libCwtch.arm64.dylib $DIR/ - cd $DIR - find . -type f -exec shasum -a 512 {} \; > ./../sha512s.txt - mv ./../sha512s.txt . diff --git a/Makefile b/Makefile index d1b4778..9b2f983 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ all: linux android windows linux: libCwtch.so -macos: libCwtch.dylib +macos: libCwtch.x64.dylib libCwtch.arm.dylib android: cwtch.aar @@ -18,9 +18,13 @@ libCwtch.so: lib.go ./switch-ffi.sh go build -ldflags "-X main.buildVer=$(shell git describe --tags) -X main.buildDate=$(shell date +%G-%m-%d-%H-%M)" -buildmode c-shared -o libCwtch.so -libCwtch.dylib: lib.go +libCwtch.x64.dylib: lib.go ./switch-ffi.sh - go build -ldflags "-X main.buildVer=$(shell git describe --tags) -X main.buildDate=$(shell date +%G-%m-%d-%H-%M)" -buildmode c-shared -o libCwtch.dylib + go build -ldflags "-X main.buildVer=$(shell git describe --tags) -X main.buildDate=$(shell date +%G-%m-%d-%H-%M)" -buildmode c-shared -o libCwtch.x64.dylib + +libCwtch.arm.dylib: lib.go + ./switch-ffi.sh + env GOARCH=arm64 GOOS=darwin CGO_ENABLED=1 go build -ldflags "-X main.buildVer=$(shell git describe --tags) -X main.buildDate=$(shell date +%G-%m-%d-%H-%M)" -buildmode c-shared -o libCwtch.arm64.dylib cwtch.aar: lib.go ./switch-gomobile.sh diff --git a/README.md b/README.md index 21e7ae3..26f897e 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ C-bindings for the Go Cwtch Library. make linux make android make windows + make macos ## Android Build Notes @@ -16,6 +17,12 @@ 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 @@ -43,4 +50,4 @@ written to `stdout` when `DebugInfo()` is called. ## MacOS -- copy libCwtch.dylib into the directory you are executing from +- copy libCwtch.x64.dylib and libCwtch.arm.dylib into the directory you are executing from