Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
54 lines (45 loc) · 1.88 KB
/
Copy pathMakefile
File metadata and controls
54 lines (45 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
PLATFORM_MATRIX ?= \
"iOS,iOS Simulator,iPhone" \
"watchOS,watchOS Simulator,Watch" \
"xrOS,visionOS Simulator,Apple Vision Pro"
.PHONY: test test-macos test-package-platform build-examples build-example-ios build-example-vision build-example-macos
EXAMPLE_PROJECT ?= Example/Example.xcodeproj
IOS_SIM_DEST ?= generic/platform=iOS Simulator
VISIONOS_SIM_DEST ?= generic/platform=visionOS Simulator
MACOS_DEST ?= platform=macOS
build-examples: build-example-ios build-example-vision build-example-macos
build-example-ios:
@set -e; \
echo "==> Building VRMExample (iOS Simulator)"; \
xcodebuild -project "$(EXAMPLE_PROJECT)" -scheme VRMExample -destination "$(IOS_SIM_DEST)" build
build-example-vision:
@set -e; \
echo "==> Building VisionExample (visionOS Simulator)"; \
xcodebuild -project "$(EXAMPLE_PROJECT)" -scheme VisionExample -destination "$(VISIONOS_SIM_DEST)" build
build-example-macos:
@set -e; \
echo "==> Building MacExample (macOS)"; \
xcodebuild -project "$(EXAMPLE_PROJECT)" -scheme MacExample -destination "$(MACOS_DEST)" build
# macOS has no simulator, so it runs through SwiftPM rather than the matrix below.
test-macos:
@set -e; \
echo "==> Testing macOS"; \
swift test
test: test-macos
@set -e; \
for entry in $(PLATFORM_MATRIX); do \
old_ifs="$$IFS"; IFS=,; set -- $$entry; IFS="$$old_ifs"; \
platform="$$1"; sim="$$2"; device="$$3"; \
echo "==> Testing $${platform} ($${device})"; \
$(MAKE) test-package-platform \
SIM_PLATFORM="$$sim" \
RUNTIME_PLATFORM="$$platform" \
DEVICE_NAME="$$device" || exit 1; \
done
test-package-platform:
@if [ -n "$(SIM_PLATFORM)" ] && [ -n "$(RUNTIME_PLATFORM)" ] && [ -n "$(DEVICE_NAME)" ]; then \
./scripts/test-on-simulator.sh "$(SIM_PLATFORM)" "$(RUNTIME_PLATFORM)" "$(DEVICE_NAME)" $(if $(RESULT_BUNDLE),"$(RESULT_BUNDLE)"); \
else \
echo "SIM_PLATFORM/RUNTIME_PLATFORM/DEVICE_NAME is required" >&2; \
exit 1; \
fi