From bc940a145ca8150bc1e8fbb18d0a4685e9b09ce0 Mon Sep 17 00:00:00 2001 From: StevenWdV Date: Wed, 24 Nov 2021 17:47:17 +0100 Subject: Support more platforms, add make clean targets, support embedding lib in nupkg --- Makefile | 6 ++++- exports/.gitignore | 4 +--- exports/Makefile | 24 ++++++++++++------- wrappers/csharp/EduVpnCommon.csproj | 47 +++++++++++++++++++++++++++++++++---- wrappers/csharp/Makefile | 12 +++++++++- 5 files changed, 75 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index b11b774..3cb93fa 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: build test test-go test-wrappers +.PHONY: build test test-go test-wrappers clean build: $(MAKE) -C exports build @@ -10,3 +10,7 @@ test-go: test-wrappers: build $(MAKE) -C wrappers/csharp test + +clean: + $(MAKE) -C exports clean + $(MAKE) -C wrappers/csharp clean diff --git a/exports/.gitignore b/exports/.gitignore index a95b306..63ea916 100644 --- a/exports/.gitignore +++ b/exports/.gitignore @@ -1,3 +1 @@ -*.dll -*.so -*.h +/*/ diff --git a/exports/Makefile b/exports/Makefile index 94781be..912e930 100644 --- a/exports/Makefile +++ b/exports/Makefile @@ -1,12 +1,18 @@ -.PHONY: build +.PHONY: build clean -ifeq ($(OS),Windows_NT) - lib_suffix := .dll -else - lib_suffix := .so -endif +lib_suffix_linux = .so +lib_suffix_windows = .dll +lib_suffix_darwin = .dylib -build: eduvpn_verify$(lib_suffix) +OS = $(shell go env GOHOSTOS) +ARCH = $(shell go env GOHOSTARCH) +LIB_SUFFIX = $(lib_suffix_$(OS)) -eduvpn_verify.dll eduvpn_verify.so: exports.go ../verify.go - go build -o $@ -buildmode=c-shared $< +# Creates targets like 'linux/amd64/eduvpn_verify.so' +build: $(OS)/$(ARCH)/eduvpn_verify$(LIB_SUFFIX) + +$(OS)/$(ARCH)/eduvpn_verify$(LIB_SUFFIX): exports.go ../verify.go + CGO_ENABLED=1 GOOS=$(OS) GOARCH=$(ARCH) go build -o $@ -buildmode=c-shared $< + +clean: + rm -rf ../exports/*/ diff --git a/wrappers/csharp/EduVpnCommon.csproj b/wrappers/csharp/EduVpnCommon.csproj index 1bbbc23..04df7f0 100644 --- a/wrappers/csharp/EduVpnCommon.csproj +++ b/wrappers/csharp/EduVpnCommon.csproj @@ -4,6 +4,11 @@ netstandard2.0 8 enable + EduVpn.Common + 0.1.0 + + Common EduVpn logic + EduVpn @@ -14,13 +19,47 @@ + + + + - - PreserveNewest + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always - - PreserveNewest + + Always diff --git a/wrappers/csharp/Makefile b/wrappers/csharp/Makefile index 293a7a2..1761edc 100644 --- a/wrappers/csharp/Makefile +++ b/wrappers/csharp/Makefile @@ -1,4 +1,14 @@ -.PHONY: test +.PHONY: build pack test clean + +build: + dotnet publish EduVpnCommon.csproj --configuration Release + +pack: + dotnet pack EduVpnCommon.csproj --configuration Release test: + $(MAKE) -C ../../exports dotnet test + +clean: + rm -rf bin/ obj/ EduVpnCommonTests/bin/ EduVpnCommonTests/obj/ -- cgit v1.2.3