diff options
| -rw-r--r-- | Makefile | 6 | ||||
| -rw-r--r-- | exports/.gitignore | 4 | ||||
| -rw-r--r-- | exports/Makefile | 24 | ||||
| -rw-r--r-- | wrappers/csharp/EduVpnCommon.csproj | 47 | ||||
| -rw-r--r-- | wrappers/csharp/Makefile | 12 |
5 files changed, 75 insertions, 18 deletions
@@ -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 @@ <TargetFramework>netstandard2.0</TargetFramework> <LangVersion>8</LangVersion> <Nullable>enable</Nullable> + <PackageId>EduVpn.Common</PackageId> + <PackageVersion>0.1.0</PackageVersion> + <Authors /> + <Description>Common EduVpn logic</Description> + <Product>EduVpn</Product> </PropertyGroup> <ItemGroup> @@ -14,13 +19,47 @@ <EmbeddedResource Remove="EduVpnCommonTests/**" /> </ItemGroup> + <Target Name="Build library for current OS" BeforeTargets="PrepareForBuild" + Condition="!(Exists('../../exports/windows/amd64/eduvpn_verify.dll') + Or Exists('../../exports/windows/386/eduvpn_verify.dll') + Or Exists('../../exports/windows/arm/eduvpn_verify.dll') + Or Exists('../../exports/windows/arm64/eduvpn_verify.dll') + Or Exists('../../exports/linux/amd64/eduvpn_verify.so') + Or Exists('../../exports/linux/arm/eduvpn_verify.so') + Or Exists('../../exports/linux/arm64/eduvpn_verify.so'))"> + <Message Text="Shared eduvpn_verify library not found, you should build that one first" Importance="high" /> + </Target> + <ItemGroup> <None Remove="EduVpnCommonTests/**" /> - <None Condition="Exists('../../exports/eduvpn_verify.dll')" Include="../../exports/eduvpn_verify.dll"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + + <None Condition="Exists('../../exports/windows/amd64/eduvpn_verify.dll')" + Include="../../exports/windows/amd64/eduvpn_verify.dll" Pack="true" PackagePath="runtimes/win-x64/native/"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </None> + <None Condition="Exists('../../exports/windows/386/eduvpn_verify.dll')" + Include="../../exports/windows/386/eduvpn_verify.dll" Pack="true" PackagePath="runtimes/win-x86/native/"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </None> + <None Condition="Exists('../../exports/windows/arm/eduvpn_verify.dll')" + Include="../../exports/windows/arm/eduvpn_verify.dll" Pack="true" PackagePath="runtimes/win-arm/native/"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </None> + <None Condition="Exists('../../exports/windows/arm64/eduvpn_verify.dll')" + Include="../../exports/windows/arm64/eduvpn_verify.dll" Pack="true" PackagePath="runtimes/win-arm64/native/"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </None> + <None Condition="Exists('../../exports/linux/amd64/eduvpn_verify.so')" + Include="../../exports/linux/amd64/eduvpn_verify.so" Pack="true" PackagePath="runtimes/linux-x64/native/"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </None> + <None Condition="Exists('../../exports/linux/arm/eduvpn_verify.so')" + Include="../../exports/linux/arm/eduvpn_verify.so" Pack="true" PackagePath="runtimes/linux-arm/native/"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> </None> - <None Condition="Exists('../../exports/eduvpn_verify.so')" Include="../../exports/eduvpn_verify.so"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + <None Condition="Exists('../../exports/linux/arm64/eduvpn_verify.so')" + Include="../../exports/linux/arm64/eduvpn_verify.so" Pack="true" PackagePath="runtimes/linux-arm64/native/"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> </None> </ItemGroup> 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/ |
