summaryrefslogtreecommitdiff
path: root/wrappers/swift
diff options
context:
space:
mode:
authorStevenWdV <stevenwdv@gmail.com>2022-02-04 01:18:12 +0100
committerStevenWdV <stevenwdv@gmail.com>2022-02-04 01:18:12 +0100
commitb60ecf2fe5ddfe506e02093286b3931873187e91 (patch)
treeb3804b1b95e70e96dec98cb0c2b571e0b895ebdd /wrappers/swift
parentbb85487e40b47d701e64085e7574cb477a431f1e (diff)
More Makefile cleanup, support building in folder with spaces
Diffstat (limited to 'wrappers/swift')
-rw-r--r--wrappers/swift/Makefile21
-rw-r--r--wrappers/swift/README.md7
2 files changed, 9 insertions, 19 deletions
diff --git a/wrappers/swift/Makefile b/wrappers/swift/Makefile
index b46a177..6dca0ef 100644
--- a/wrappers/swift/Makefile
+++ b/wrappers/swift/Makefile
@@ -1,33 +1,22 @@
.PHONY: build test install-header clean
EXPORTS_PATH ?= ../../exports
-EXPORTS_LIB_PATH ?= $(EXPORTS_PATH)/lib
-
-ifneq ($(MAKECMDGOALS),clean)
-include $(EXPORTS_PATH)/platform.mk
-
-LIB_DIR = $(EXPORTS_LIB_PATH)/$(GOOS)/$(GOARCH)
+include $(EXPORTS_PATH)/common.mk
ifeq ($(OS),Windows_NT)
SWIFT = ./swift.cmd
else
SWIFT = swift
endif
-endif
build: install-header
- $(SWIFT) build --configuration release -Xlinker -L"$(LIB_DIR)"
+ $(SWIFT) build --configuration release -Xlinker -L"$(EXPORTS_LIB_SUBFOLDER_PATH)"
test: install-header
- $(SWIFT) test --parallel -Xlinker -L"$(LIB_DIR)"
+ $(SWIFT) test --parallel -Xlinker -L"$(EXPORTS_LIB_SUBFOLDER_PATH)"
-install-header:
-ifneq ($(EXPORTS_PATH),)
-ifneq ($(wildcard $(EXPORTS_PATH)/Makefile),)
- $(MAKE) -C "$(EXPORTS_PATH)"
-endif
-endif
- install "$(LIB_DIR)/$(LIB_NAME).h" -Dt CEduVpnCommon/Sources/CEduVpnCommon/Headers # Copy header for modulemap
+install-header: .try_build_lib
+ install "$(EXPORTS_LIB_SUBFOLDER_PATH)/$(LIB_NAME).h" -Dt CEduVpnCommon/Sources/CEduVpnCommon/Headers # Copy header for modulemap
clean:
rm -rf .build/ CEduVpnCommon/Sources/CEduVpnCommon/Headers/*.h
diff --git a/wrappers/swift/README.md b/wrappers/swift/README.md
index f28b028..9b0fdfe 100644
--- a/wrappers/swift/README.md
+++ b/wrappers/swift/README.md
@@ -21,11 +21,12 @@ make GOOS=linux GOARCH=amd64
When using this library, you will need to make sure that the linker can find the shared Go library.
-<small>On Windows, you will also need to generate a .lib import library for the .dll. You can
+<details><summary>Windows</summary><small>
+On Windows, you will also need to generate a .lib import library for the .dll. You can
use `exports/generate_lib.ps1`
for this, passing in the path to the DLL file. Execute this from a Visual Studio Developer shell before building the
Swift project. Alternatively, you could use `objdump` and `llvm-dlltool`. You only need to update this if the list of
-exported symbols changes.</small>
+exported symbols changes.</small></details>
If you just want to copy over the C header file to the right directory for the modulemap in `CEduVpnCommon`, run:
@@ -34,7 +35,7 @@ make install-header
```
If you do not build this as part of the full repository, specify `EXPORTS_PATH="path/to/exports-folder"` when calling
-make. This folder must contain `platform.mk` and the `lib/` folder with built libraries and headers.
+make. This folder must contain `common.mk` and the `lib/` folder with built libraries and headers.
Test: