forked from tangrams/tangram-es
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
289 lines (229 loc) · 8.12 KB
/
Makefile
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
all: android osx ios
.PHONY: clean
.PHONY: clean-android
.PHONY: clean-osx
.PHONY: clean-xcode
.PHONY: clean-ios
.PHONY: clean-rpi
.PHONY: clean-linux
.PHONY: clean-benchmark
.PHONY: clean-shaders
.PHONY: clean-tizen-arm
.PHONY: clean-tizen-x86
.PHONY: android
.PHONY: osx
.PHONY: xcode
.PHONY: ios
.PHONY: ios-framework
.PHONY: ios-framework-sim
.PHONY: ios-framework-universal
.PHONY: ios-docs
.PHONY: rpi
.PHONY: linux
.PHONY: benchmark
.PHONY: tests
.PHONY: cmake-osx
.PHONY: cmake-xcode
.PHONY: cmake-ios
.PHONY: cmake-rpi
.PHONY: cmake-linux
ANDROID_BUILD_DIR = platforms/android/tangram/build
OSX_BUILD_DIR = build/osx
OSX_XCODE_BUILD_DIR = build/xcode
IOS_BUILD_DIR = build/ios
IOS_DOCS_BUILD_DIR = build/ios-docs
RPI_BUILD_DIR = build/rpi
LINUX_BUILD_DIR = build/linux
TESTS_BUILD_DIR = build/tests
BENCH_BUILD_DIR = build/bench
TIZEN_ARM_BUILD_DIR = build/tizen-arm
TIZEN_X86_BUILD_DIR = build/tizen-x86
OSX_TARGET = tangram
IOS_TARGET = tangram
IOS_FRAMEWORK_TARGET = TangramMap
OSX_XCODE_PROJ = tangram.xcodeproj
IOS_XCODE_PROJ = tangram.xcodeproj
IOS_FRAMEWORK_XCODE_PROJ = tangram.xcodeproj
ifeq (, $(shell which xcpretty))
XCPRETTY =
else
XCPRETTY = | xcpretty && exit $${PIPESTATUS[0]}
endif
# Default build type is Release
ifndef BUILD_TYPE
BUILD_TYPE = Release
endif
BENCH_CMAKE_PARAMS = \
-DBENCHMARK=1 \
-DAPPLICATION=0 \
-DCMAKE_BUILD_TYPE=Release \
${CMAKE_OPTIONS}
UNIT_TESTS_CMAKE_PARAMS = \
-DUNIT_TESTS=1 \
-DAPPLICATION=0 \
-DCMAKE_BUILD_TYPE=Debug \
${CMAKE_OPTIONS}
IOS_CMAKE_PARAMS = \
-DTANGRAM_PLATFORM=ios \
-G Xcode \
${CMAKE_OPTIONS}
OSX_XCODE_CMAKE_PARAMS = \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DTANGRAM_PLATFORM=osx \
-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING="10.9" \
-G Xcode \
${CMAKE_OPTIONS}
OSX_CMAKE_PARAMS = \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DTANGRAM_PLATFORM=osx \
-DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE \
${CMAKE_OPTIONS}
RPI_CMAKE_PARAMS = \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DTANGRAM_PLATFORM=rpi \
-DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE \
${CMAKE_OPTIONS}
LINUX_CMAKE_PARAMS = \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DTANGRAM_PLATFORM=linux \
-DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE \
${CMAKE_OPTIONS}
ifndef TIZEN_PROFILE
TIZEN_PROFILE=mobile
endif
ifndef TIZEN_VERSION
TIZEN_VERSION=3.0
endif
TIZEN_ARM_CMAKE_PARAMS = \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DTIZEN_SDK=$$TIZEN_SDK \
-DTIZEN_SYSROOT=$$TIZEN_SDK/platforms/tizen-${TIZEN_VERSION}/${TIZEN_PROFILE}/rootstraps/${TIZEN_PROFILE}-${TIZEN_VERSION}-device.core \
-DTIZEN_DEVICE=1 \
-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_DIR}/tizen.toolchain.cmake \
-DTANGRAM_PLATFORM=tizen \
-DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE \
${CMAKE_OPTIONS}
TIZEN_X86_CMAKE_PARAMS = \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DTIZEN_SDK=$$TIZEN_SDK \
-DTIZEN_SYSROOT=$$TIZEN_SDK/platforms/tizen-${TIZEN_VERSION}/${TIZEN_PROFILE}/rootstraps/${TIZEN_PROFILE}-${TIZEN_VERSION}-emulator.core \
-DTIZEN_DEVICE=0 \
-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_DIR}/tizen.toolchain.cmake \
-DTANGRAM_PLATFORM=tizen \
-DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE \
${CMAKE_OPTIONS}
clean: clean-android clean-osx clean-ios clean-rpi clean-tests clean-xcode clean-linux clean-shaders \
clean-tizen-arm clean-tizen-x86
clean-android:
rm -rf platforms/android/build
rm -rf platforms/android/tangram/build
rm -rf platforms/android/tangram/.externalNativeBuild
rm -rf platforms/android/demo/build
clean-osx:
rm -rf ${OSX_BUILD_DIR}
clean-ios:
rm -rf ${IOS_BUILD_DIR}
clean-rpi:
rm -rf ${RPI_BUILD_DIR}
clean-linux:
rm -rf ${LINUX_BUILD_DIR}
clean-xcode:
rm -rf ${OSX_XCODE_BUILD_DIR}
clean-tests:
rm -rf ${TESTS_BUILD_DIR}
clean-benchmark:
rm -rf ${BENCH_BUILD_DIR}
clean-shaders:
rm -rf core/generated/*.h
clean-tizen-arm:
rm -rf ${TIZEN_ARM_BUILD_DIR}
clean-tizen-x86:
rm -rf ${TIZEN_X86_BUILD_DIR}
android: android-demo
@echo "run: 'adb install -r platforms/android/demo/build/outputs/apk/debug/demo-debug.apk'"
android-sdk:
@cd platforms/android/ && \
./gradlew tangram:assembleRelease
android-demo:
@cd platforms/android/ && \
./gradlew demo:assembleDebug
osx: cmake-osx
cmake --build ${OSX_BUILD_DIR}
cmake-osx:
cmake -H. -B${OSX_BUILD_DIR} ${OSX_CMAKE_PARAMS}
xcode: cmake-xcode
xcodebuild -target ${OSX_TARGET} -project ${OSX_XCODE_BUILD_DIR}/${OSX_XCODE_PROJ} -configuration ${BUILD_TYPE} ${XCPRETTY}
cmake-xcode:
cmake -H. -B${OSX_XCODE_BUILD_DIR} ${OSX_XCODE_CMAKE_PARAMS}
ios: cmake-ios
xcodebuild -workspace platforms/ios/Tangram.xcworkspace -scheme TangramDemo -configuration ${BUILD_TYPE} -sdk iphoneos ${XCPRETTY}
ios-sim: cmake-ios
xcodebuild -workspace platforms/ios/Tangram.xcworkspace -scheme TangramDemo -configuration ${BUILD_TYPE} -sdk iphonesimulator ${XCPRETTY}
ios-xcode: cmake-ios
open platforms/ios/Tangram.xcworkspace
ios-docs:
ifeq (, $(shell which jazzy))
$(error "Please install jazzy by running 'gem install jazzy'")
endif
@mkdir -p ${IOS_DOCS_BUILD_DIR}
@cd platforms/ios && \
jazzy --config jazzy.yml
# This rule includes steps to copy necessary workspace settings into a user-specific location in the iOS workspace.
# See platforms/ios/DEVELOPING.md for details.
cmake-ios:
cmake -H. -B${IOS_BUILD_DIR} ${IOS_CMAKE_PARAMS}
@mkdir -p platforms/ios/Tangram.xcworkspace/xcuserdata/${USER}.xcuserdatad
@cp platforms/ios/WorkspaceSettings.xcsettings platforms/ios/Tangram.xcworkspace/xcuserdata/${USER}.xcuserdatad/WorkspaceSettings.xcsettings
ios-framework: cmake-ios
xcodebuild -workspace platforms/ios/Tangram.xcworkspace -scheme TangramMap -configuration ${BUILD_TYPE} -sdk iphoneos ${XCPRETTY}
ios-framework-sim: cmake-ios
xcodebuild -workspace platforms/ios/Tangram.xcworkspace -scheme TangramMap -configuration ${BUILD_TYPE} -sdk iphonesimulator ${XCPRETTY}
ios-framework-universal: ios-framework ios-framework-sim
@mkdir -p ${IOS_BUILD_DIR}/${BUILD_TYPE}-universal
@cp -r ${IOS_BUILD_DIR}/${BUILD_TYPE}-iphoneos/TangramMap.framework ${IOS_BUILD_DIR}/${BUILD_TYPE}-universal
lipo ${IOS_BUILD_DIR}/${BUILD_TYPE}-iphoneos/TangramMap.framework/TangramMap \
${IOS_BUILD_DIR}/${BUILD_TYPE}-iphonesimulator/TangramMap.framework/TangramMap \
-create -output ${IOS_BUILD_DIR}/${BUILD_TYPE}-universal/TangramMap.framework/TangramMap
ios-static: cmake-ios
xcodebuild -workspace platforms/ios/Tangram.xcworkspace -scheme TangramDemo-static -configuration ${BUILD_TYPE} -sdk iphoneos ${XCPRETTY}
ios-static-sim: cmake-ios
xcodebuild -workspace platforms/ios/Tangram.xcworkspace -scheme TangramDemo-static -configuration ${BUILD_TYPE} -sdk iphonesimulator ${XCPRETTY}
ios-static-lib: cmake-ios
xcodebuild -workspace platforms/ios/Tangram.xcworkspace -scheme tangram-static -configuration ${BUILD_TYPE} -sdk iphoneos ${XCPRETTY}
ios-static-lib-sim: cmake-ios
xcodebuild -workspace platforms/ios/Tangram.xcworkspace -scheme tangram-static -configuration ${BUILD_TYPE} -sdk iphonesimulator ${XCPRETTY}
ios-static-lib-universal: ios-static-lib ios-static-lib-sim
@mkdir -p ${IOS_BUILD_DIR}/${BUILD_TYPE}-universal
lipo ${IOS_BUILD_DIR}/${BUILD_TYPE}-iphoneos/libtangram-static.a \
${IOS_BUILD_DIR}/${BUILD_TYPE}-iphonesimulator/libtangram-static.a \
-create -output ${IOS_BUILD_DIR}/${BUILD_TYPE}-universal/libtangram-static.a
rpi: cmake-rpi
cmake --build ${RPI_BUILD_DIR}
cmake-rpi:
cmake -H. -B${RPI_BUILD_DIR} ${RPI_CMAKE_PARAMS}
linux: cmake-linux
cmake --build ${LINUX_BUILD_DIR}
cmake-linux:
cmake -H. -B${LINUX_BUILD_DIR} ${LINUX_CMAKE_PARAMS}
tizen-arm: cmake-tizen-arm
cmake --build ${TIZEN_ARM_BUILD_DIR}
cmake-tizen-arm:
cmake -H. -B${TIZEN_ARM_BUILD_DIR} ${TIZEN_ARM_CMAKE_PARAMS}
tizen-x86: cmake-tizen-x86
cmake --build ${TIZEN_X86_BUILD_DIR}
cmake-tizen-x86:
cmake -H. -B${TIZEN_X86_BUILD_DIR} ${TIZEN_X86_CMAKE_PARAMS}
tests:
cmake -H. -B${TESTS_BUILD_DIR} ${UNIT_TESTS_CMAKE_PARAMS}
cmake --build ${TESTS_BUILD_DIR}
benchmark:
cmake -H. -B${BENCH_BUILD_DIR} ${BENCH_CMAKE_PARAMS}
cmake --build ${BENCH_BUILD_DIR}
format:
@for file in `git diff --diff-filter=ACMRTUXB --name-only -- '*.cpp' '*.h'`; do \
if [[ -e $$file ]]; then clang-format -i $$file; fi \
done
@echo "format done on `git diff --diff-filter=ACMRTUXB --name-only -- '*.cpp' '*.h'`"
### Android Helpers
android-install:
@adb install -r platforms/android/demo/build/outputs/apk/demo-debug.apk