-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathMakefile
More file actions
115 lines (92 loc) · 2.96 KB
/
Makefile
File metadata and controls
115 lines (92 loc) · 2.96 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
CARGO ?= $(shell which cargo)
SWIFTFORMAT ?= $(shell which swiftformat)
TARGET_DIR = target
OUT_LIBS_ANDROID ?= out/libs/jniLibs
OUT_INCLUDE ?= out/include
PROTO_DIR ?= protos
SWIFT_PROTO_OUT_DIR ?= app/Shared/Protos
PROTO_SRCS := $(wildcard $(PROTO_DIR)/*.proto)
PROCESSOR ?= $(shell uname -p)
ifeq (${PROCESSOR}, arm)
IOS_SIM_TARGET = aarch64-apple-ios-sim
else
IOS_SIM_TARGET = x86_64-apple-ios
endif
IOS_TARGET = aarch64-apple-ios
IOS_ALL_TARGETS = ${IOS_TARGET} ${IOS_SIM_TARGET}
ALL_TARGETS ?= unspecified-target
MODE ?= debug
ifeq (${MODE}, debug)
CARGO_MODE_ARG = --profile dev
else
CARGO_MODE_ARG = --profile ${MODE}
endif
OUT_FRAMEWORK = out/logic-ios.xcframework
.PHONY: logic build tuist swift-pb
ios: logic-ios-release
logic-ios-%:
make logic-ios MODE=$*
logic-ios:
make logic ALL_TARGETS="${IOS_ALL_TARGETS}"
logic-sim:
make logic ALL_TARGETS="${IOS_SIM_TARGET}"
logic-deploy:
make logic ALL_TARGETS="${IOS_TARGET}" MODE=release
logic-deploy-debug:
make logic ALL_TARGETS="${IOS_TARGET}" MODE=debug
logic: swift-pb build-logic create-framework
swift-pb:
@echo ">>>>> Swift PB"
@mkdir -p $(SWIFT_PROTO_OUT_DIR)
protoc --swift_out=$(SWIFT_PROTO_OUT_DIR)/ --swift_opt=Visibility=Public -I $(PROTO_DIR)/ $(PROTO_SRCS)
build-logic:
@echo ">>>>> Build liblogic.a for '${ALL_TARGETS}' in ${MODE} mode"
@for target in ${ALL_TARGETS}; do \
CMD="${CARGO} build --package logic --target $${target} ${CARGO_MODE_ARG}" ;\
echo ">>> $${CMD}" ;\
$${CMD} ;\
done
@echo ">>>>> Copy bindings"
cp logic/logic/bindings.h ${OUT_INCLUDE}
create-framework:
@echo ">>>>> Create Framework to ${OUT_FRAMEWORK}"
@CMD="xcodebuild -create-xcframework" ;\
for target in ${ALL_TARGETS}; do \
logic_lib="${TARGET_DIR}/$${target}/${MODE}/liblogic.a" ;\
CMD="$${CMD} -library $${logic_lib}" ;\
done ;\
CMD="$${CMD} -headers ${OUT_INCLUDE}/* -output ${OUT_FRAMEWORK}" ;\
rm -rf ${OUT_FRAMEWORK} ;\
echo ">>> $${CMD}" ;\
$${CMD}
kotlin-pb:
@echo ">>>>> Kotlin PB"
protoc --java_out=android --kotlin_out=android -I protos/ protos/*.proto
logic-android-%:
make logic-android MODE=$*
logic-android:
@echo ">>>>> Build liblogic.so for Android in ${MODE} mode"
${CARGO} ndk --package logic --target arm64-v8a --target x86_64 --target x86 --platform 26 build ${CARGO_MODE_ARG}
cp ${TARGET_DIR}/aarch64-linux-android/${MODE}/liblogic.so ${OUT_LIBS_ANDROID}/arm64-v8a/
cp ${TARGET_DIR}/x86_64-linux-android/${MODE}/liblogic.so ${OUT_LIBS_ANDROID}/x86_64/
cp ${TARGET_DIR}/i686-linux-android/${MODE}/liblogic.so ${OUT_LIBS_ANDROID}/x86/
swiftformat:
@if [ -z "${SWIFTFORMAT}" ]; then \
echo "warning: swiftformat not installed, skip" ;\
else \
${SWIFTFORMAT} . ;\
fi
tuist:
tuist generate -p app --no-open
clean-xcode-proj:
rm -rf app/MNGA.xcodeproj app/MNGA.xcworkspace
build: swift-pb logic-ios
xcraft build
launch: swift-pb logic-deploy
xcraft launch
launch-sim: swift-pb logic-sim
xcraft launch --profile sim
nightly:
rustup override set nightly
nightly-unset:
rustup override unset