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
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
|
MAPKIT_IDL_INCLUDES=
macro MAPKIT_ADDINCL(Dirs...) {
ADDINCL(${pre=FOR idl :Dirs})
SET_APPEND(MAPKIT_IDL_INCLUDES $Dirs)
}
### @usage: MAPS_IDL_ADDINCL(dirnames...) # internal
###
### Warpper for MAPKIT_ADDINCL macro which is used for mobile mapkit build
macro MAPS_IDL_ADDINCL(Dirs...) {
MAPKIT_ADDINCL($Dirs)
}
### @usage: _MAPKITIDL_PROXY(args...) # internal
###
### Proxy macro for maps_mobile_idl plugin
macro _MAPKITIDL_PROXY(Args...) {
_PROCESS_MAPS_MOBILE_IDL($Args)
SET_APPEND(_MAKEFILE_INCLUDE_LIKE_TEXT_DEPS ${ext=idl:Args})
}
MAPS_IDL_FILTER=
### @usage: MAPS_IDL_SRCS(filenames...) # internal
###
### Warpper for MAPKITIDL macro which is used for mobile mapkit build
macro MAPS_IDL_SRCS(Srcs...) {
_MAPKITIDL_PROXY($Srcs ${MAPS_IDL_FILTER})
}
### @usage: MAPS_IDL_GLOBAL_SRCS(filenames...) # internal
###
### Warpper for MAPKITIDL macro which is used for mobile mapkit build
macro MAPS_IDL_GLOBAL_SRCS(Srcs...) {
_MAPKITIDL_PROXY(GLOBAL_OUTPUTS $Srcs ${MAPS_IDL_FILTER})
}
### @usage: MAPSMOBI_SRCS(filenames...) # internal
###
### Make all source files listed as GLOBAL or not (depending on the value of
### MAPSMOBI_USE_SRCS_GLOBAL). Be careful since the value of
### MAPSMOBI_USE_SRCS_GLOBAL matters! If the value of this variable is equal to
### GLOBAL then call to MAPSMOBI_SRCS() macro behaves like call to
### GLOBAL_SRCS() macro otherwise the value of MAPSMOBI_USE_SRCS_GLOBAL is
### treated as a file name and a call to MAPSMOBI_SRCS() macro behaves like a
### call to SRCS() macro with additional argument which is the value of
### MAPSMOBI_USE_SRCS_GLOBAL variable
macro MAPSMOBI_SRCS(FILES...) {
ALL_SRCS(${MAPSMOBI_USE_SRCS_GLOBAL} $FILES)
}
BEFORE_PEERS=
AFTER_PEERS=
when ($MAPKIT_WHOLE_ARCHIVE == "yes") {
when($OS_LINUX) {
BEFORE_PEERS += $START_WHOLE_ARCHIVE_VALUE
AFTER_PEERS += $END_WHOLE_ARCHIVE_VALUE
}
elsewhen($OS_DARWIN) {
LDFLAGS+=-Wl,-all_load
}
}
### @usage: MAPKIT_ENABLE_WHOLE_ARCHIVE() # internal deprecated
###
### This macro is strictly prohibited to use outside of mapsmobi project
macro MAPKIT_ENABLE_WHOLE_ARCHIVE() {
ENABLE(MAPKIT_WHOLE_ARCHIVE)
}
### @usage: USE_IDL_CPP()
###
### This macro forces to use H_CPP_IDL (implementation library) variant of
### MAPS_IDL_LIBRARY multimodule instead of H_IDL (header only library) variant
### which is used by default
macro USE_IDL_CPP() {
SET(PEERDIR_TAGS __EMPTY__ CPP_PROTO H_CPP_IDL)
}
_LINK_JSRC=${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON3 ${input:"build/scripts/link_jsrc.py"} --input $AUTO_INPUT --output $TARGET ${kv;hide:"p JL"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
_LINK_JSRC_MF=$_LINK_JSRC && $GENERATE_MF
### @usage: MAPS_IDL_JSRC_LIBRARY
###
### Create .jsrc output - archive of megred .jsrc inputs
module MAPS_IDL_JSRC_LIBRARY: JSRC_LIBRARY {
.CMD=_LINK_JSRC_MF
.EXTS=.jsrc
}
### _MAPS_IDL_LIBRARY_EPILOGUE() #internal
###
### This macro executes macros which should be invoked after all user specified macros in the ya.make file
macro _MAPS_IDL_LIBRARY_EPILOGUE() {
_GLOB(MAPKIT_IDL_FRAMEWORK_FILES ${ARCADIA_ROOT}/${MAPKIT_IDL_FRAMEWORK}/*.framework)
SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS $MAPKIT_IDL_FRAMEWORK_FILES)
}
### @usage: MAPS_IDL_LIBRARY()
###
### Definition of multimodule that builds various variants of libraries.
### The particular variant is selected based on where PEERDIR to IDL_LIBRARY comes from.
### Now supported 2 variants: C++, Java
### Java version is not really a library but an archive of generated Java sources
multimodule MAPS_IDL_LIBRARY {
module H_IDL: LIBRARY {
.ALIASES=SRCS=MAPS_IDL_SRCS GLOBAL_SRCS=MAPS_IDL_GLOBAL_SRCS ADDINCL=MAPKIT_ADDINCL MAPSMOBI_SRCS=MAPS_IDL_SRCS
.EPILOGUE=_MAPS_IDL_LIBRARY_EPILOGUE
ENABLE(H_IDL)
ENABLE(CPP_IDL)
SET(PEERDIR_TAGS H_IDL CPP_PROTO __EMPTY__)
SET(MAPS_IDL_FILTER FILTER .h)
NO_UTIL()
PROTO_ADDINCL(${MAPKIT_PROTO_ROOT})
}
module H_CPP_IDL: LIBRARY {
.ALIASES=SRCS=MAPS_IDL_SRCS GLOBAL_SRCS=MAPS_IDL_GLOBAL_SRCS ADDINCL=MAPKIT_ADDINCL MAPSMOBI_SRCS=MAPS_IDL_SRCS
.DEFAULT_NAME_GENERATOR=DirName
.PEERDIRSELF=H_IDL
.EPILOGUE=_MAPS_IDL_LIBRARY_EPILOGUE
ENABLE(H_CPP_IDL)
ENABLE(CPP_IDL)
SET(PEERDIR_TAGS H_IDL CPP_PROTO __EMPTY__)
SET(MAPS_IDL_FILTER FILTER .cpp .m .mm .dart)
DISABLE(START_TARGET)
NO_UTIL()
}
module JAVA_IDL: MAPS_IDL_JSRC_LIBRARY {
.ALIASES=SRCS=MAPS_IDL_SRCS GLOBAL_SRCS=MAPS_IDL_SRCS ADDINCL=MAPKIT_ADDINCL MAPSMOBI_SRCS=MAPS_IDL_SRCS
.IGNORED=CPP_ADDINCL
.EPILOGUE=_MAPS_IDL_LIBRARY_EPILOGUE
SET(PEERDIR_TAGS JAVA_IDL JAVA_PROTO)
SET(MAPS_IDL_FILTER FILTER .java)
ENABLE(JAVA_IDL)
PROTO_ADDINCL(${MAPKIT_PROTO_ROOT})
}
}
_IDL_TOOL_EXTRA_ARGS=
when ($MAPS_MOBILE_USE_STD_VARIANT == "yes") {
_IDL_TOOL_EXTRA_ARGS+=--use-std-variant
}
when ($MAPS_MOBILE_PUBLIC_API == "yes") {
_IDL_TOOL_EXTRA_ARGS+=--public
}
when ($MAPS_MOBILE_ENABLE_NAVI_SERIALIZATION == "yes") {
_IDL_TOOL_EXTRA_ARGS+=--enable-navi-serialization
}
_IDL_TOOL_CMDLINE=$GENERATE_MF && ${cwd:ARCADIA_ROOT} ${tool:"tools/idl/bin"} --in-proto-root maps/doc/proto --base-proto-package yandex.maps.proto ${pre=--out-base-root :OUT_BASE_ROOT} ${pre=--out-android-root :OUT_ANDROID_ROOT} ${pre=--out-ios-root :OUT_IOS_ROOT} ${pre=--out-dart-root :OUT_BASE_ROOT} ${pre=--out-dart-cpp-root :OUT_BASE_ROOT} ${pre=-F :FRAMEWORK_DIRS} ${pre=-I :INCLUDES} ${_IDL_TOOL_EXTRA_ARGS} ${hide;input:IN} ${hide;output:OUT} ${hide;output;noauto:OUT_NOAUTO} ${hide;output_include:OUTPUT_INCLUDES} ${IDLS} ${kv;hide:"p ID"} ${kv;hide:"pc white"} ${hide:MAPSMOBI_FAKEID} ${hide;suf=filter_in;join=|:FILTER_IN} ${hide;suf=filter_out;join=|:FILTER_OUT} ${kv;hide:"show_out"}
### @usage: _RUN_IDL_TOOL(...) # internal
###
### Run idl tool within non-JAVA_IDL submodule. This macro is called from _PROCESS_MAPS_MOBILE_IDL macro.
macro _RUN_IDL_TOOL(OUT_BASE_ROOT="", OUT_ANDROID_ROOT="", OUT_IOS_ROOT="", IN[], OUT[], OUT_NOAUTO[], OUTPUT_INCLUDES[], INCLUDES[], FRAMEWORK_DIRS[], IDLS[], FILTER_IN[], FILTER_OUT[]) {
.CMD=$_IDL_TOOL_CMDLINE
}
### @usage: _RUN_IDL_TOOL(...) # internal
###
### Run idl tool within JAVA_IDL submodule. This macro is called from _PROCESS_MAPS_MOBILE_IDL macro.
macro _RUN_IDL_TOOL_JAVA(OUT_BASE_ROOT="", OUT_ANDROID_ROOT="", OUT_IOS_ROOT="", IN[], OUT[], OUT_NOAUTO[], OUTPUT_INCLUDES[], INCLUDES[], FRAMEWORK_DIRS[], IDLS[], FILTER_IN[], FILTER_OUT[]) {
.CMD=$_IDL_TOOL_CMDLINE && $YMAKE_PYTHON3 ${input:"build/scripts/tar_sources.py"} --output ${output;suf=$_HASH_HELPER($IDLS).jsrc:"_"} --input $OUT_ANDROID_ROOT --exts .java
}
### @usage: MAPSMOBI_COLLECT_ASSETS_FILES(varname [dir]) # internal
###
### This macro is strictly prohibited to use outside of mapsmobi project
macro MAPSMOBI_COLLECT_ASSETS_FILES(VAR, DIR="") {
_GLOB($VAR ${suf=/:DIR}**/*)
RESTRICT_PATH(maps/mobile maps/automotive MSG This macro is for use in mapsmobi projects)
}
### @usage: MAPSMOBI_COLLECT_AIDL_FILES(varname [dir]) # internal
###
### This macro is strictly prohibited to use outside of mapsmobi project
macro MAPSMOBI_COLLECT_AIDL_FILES(VAR, DIR="") {
_GLOB($VAR ${suf=/:DIR}**/*.aidl)
RESTRICT_PATH(maps/mobile maps/automotive MSG This macro is for use in mapsmobi projects)
}
### @usage: MAPSMOBI_COLLECT_JAVA_FILES(varname [dir]) # internal
###
### This macro is strictly prohibited to use outside of mapsmobi project
macro MAPSMOBI_COLLECT_JAVA_FILES(VAR, DIR="") {
_GLOB($VAR ${suf=/:DIR}**/*.java)
RESTRICT_PATH(maps/mobile maps/automotive MSG This macro is for use in mapsmobi projects)
}
### @usage: MAPSMOBI_COLLECT_JNI_LIBS_FILES(varname [dir]) # internal
###
### This macro is strictly prohibited to use outside of mapsmobi project
macro MAPSMOBI_COLLECT_JNI_LIBS_FILES(VAR, DIR="") {
_GLOB($VAR ${suf=/:DIR}**/*.so)
RESTRICT_PATH(maps/mobile maps/automotive MSG This macro is for use in mapsmobi projects)
}
### @usage: MAPSMOBI_COLLECT_RES_FILES(varname [dir]) # internal
###
### This macro is strictly prohibited to use outside of mapsmobi project
macro MAPSMOBI_COLLECT_RES_FILES(VAR, DIR="") {
_GLOB($VAR ${suf=/:DIR}**/*.(xml|png))
RESTRICT_PATH(maps/mobile maps/automotive MSG This macro is for use in mapsmobi projects)
}
### @usage: MAPSMOBI_COLLECT_TPL_FILES(varname [dir]) # internal
###
### This macro is strictly prohibited to use outside of mapsmobi project
macro MAPSMOBI_COLLECT_TPL_FILES(VAR, DIR="") {
_GLOB($VAR ${suf=/:DIR}**/*.tpl)
RESTRICT_PATH(tools/idl MSG This macro is for use in mapsmobi projects)
}
### @usage: MAPS_GARDEN_COLLECT_MODULE_TRAITS(varnamei dir) # internal
###
### This macro is strictly prohibited to use outside of maps/garden project
macro MAPS_GARDEN_COLLECT_MODULE_TRAITS(VAR, DIR) {
_GLOB($VAR $DIR/*/module_traits.json)
RESTRICT_PATH(maps/garden/sdk/module_traits/tests/module_traits_bundle MSG This macro is for use in maps/garden project)
}
# mapsmobi build configuration
MAPSMOBI_FAKEID=${FAKEID}_r9927169
MAPSMOBI_BUILD=
YANDEX_EXPORT=
MAPSMOBI_CPP_PROTO_PLUGINS=
STATIC_STL=
EXPORT_ALL_SYMBOLS=
when ($MAPSMOBI_BUILD_HOST || $MAPSMOBI_BUILD_TARGET) {
MAPSMOBI_BUILD=yes
}
when ($MAPSMOBI_BUILD) {
CFLAGS+=-DMOBILE_BUILD ${hide:MAPSMOBI_FAKEID}
MAPKIT_BASE_PROTO_PACKAGE=yandex.maps.proto
MAPKIT_PROTO_ROOT=maps/doc/proto
MAPKIT_IDL_FRAMEWORK=maps/mobile/libs/idl_frameworks
}
when ($MAPSMOBI_BUILD_TARGET) {
ALLOCATOR=FAKE
USE_VANILLA_PROTOC=yes
PROTOBUF_LITE=yes
CPP_PROTO_PLUGINS=lite${pre=,:MAPSMOBI_CPP_PROTO_PLUGINS}:
when ($OPENSOURCE != "yes") {
SYSINCL+=build/yandex_specific/sysincl/mapsmobi.yml
}
CFLAGS+=-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DBOOST_CB_DISABLE_DEBUG -DBOOST_COROUTINES_NO_DEPRECATION_WARNING -DYANDEX_EXPORT=${YANDEX_EXPORT}
}
when ($MAPSMOBI_BUILD_TARGET && $OS_ANDROID) {
JDK_REAL_VERSION=11
MAPSMOBI_CPP_PROTO_PLUGINS="dllexport_decl=YANDEX_EXPORT"
YANDEX_EXPORT=__attribute__((visibility(\"default\")))
CFLAGS+=-fvisibility=hidden
when ($MAPS_MOBILE_EXPORT_CPP_API) {
LDFLAGS+=-lc++_shared
CFLAGS+=-DZLIB_DLL
CFLAGS+=-DPROTOBUF_USE_DLLS -DLIBPROTOBUF_EXPORTS
CFLAGS+=-DPNG_IMPEXP=${YANDEX_EXPORT}
CFLAGS+=-DBOOST_ALL_DYN_LINK
CFLAGS+=-DBOOST_SYMBOL_EXPORT=${YANDEX_EXPORT}
DYNAMIC_BOOST=yes
}
otherwise {
STATIC_STL=yes
YANDEX_EXPORT=
CFLAGS+=-DBOOST_SYMBOL_EXPORT=
CFLAGS+=-DBOOST_SYMBOL_VISIBLE=
LDFLAGS+=-lc++_static -Wl,--exclude-libs,ALL -static-libstdc++
USE_GLOBAL_CMD=no
}
when ($EXPORT_ALL_SYMBOLS) {
CFLAGS+=-fvisibility=default
}
when ($NO_DEBUGINFO != "yes" && $REDUCED_DEBUGINFO) {
CFLAGS+=-g1
}
CFLAGS+=-DANDROID -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -Wa,--noexecstack
CFLAGS+=-Qunused-arguments -Wno-unused-function -Wno-pessimizing-move -Wno-missing-field-initializers -Wno-missing-braces -Wno-unused-parameter -Wno-vexing-parse -Wno-sign-compare -Wno-deprecated-declarations
LDFLAGS+=-lc -lm -llog -Bsymbolic -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now -Wl,--no-undefined
when ($BT_RELEASE || $BT_RELWITHDEBINFO) {
CFLAGS+=-fomit-frame-pointer -fvisibility-inlines-hidden -ffunction-sections -fdata-sections
LDFLAGS+=-Wl,--gc-sections -Wl,--build-id
}
when ($ARCH_ARM7) {
CFLAGS+=-mfloat-abi=softfp
#Android clang overaligns some float types which causes NEON programs to fail on old Android versions. So we disable NEON.
#See https://github.com/android/ndk/issues/640 for more information
CFLAGS+=-mfpu=vfpv3-d16
}
elsewhen ($ARCH_ARM64) {
}
elsewhen ($ARCH_I386) {
CFLAGS+=-fstrict-aliasing -mstackrealign -DBOOST_CONTEXT_TLS_STACK_PROTECTOR
}
elsewhen ($ARCH_X86_64) {
CFLAGS+=-fstrict-aliasing -mstackrealign -march=x86-64 -msse4.2 -mpopcnt -m64 -DBOOST_CONTEXT_TLS_STACK_PROTECTOR
}
otherwise {
PEERDIR+=__unsupported_architecture_for_android__
}
}
when ($MAPSMOBI_BUILD_TARGET && $OS_DARWIN) {
QT_REQUIRED=yes
LDFLAGS+=-lc++
CFLAGS+=-DBOOST_SYMBOL_EXPORT=
CFLAGS+=-DBOOST_SYMBOL_VISIBLE=
}
when ($MAPSMOBI_BUILD_TARGET && $OS_IOS) {
CFLAGS+=-DIOS -stdlib=libc++ -fvisibility=hidden
CFLAGS+=-DBOOST_SYMBOL_EXPORT=
CFLAGS+=-DBOOST_SYMBOL_VISIBLE=
when(!$MAPS_MOBILE_PUBLIC_API || $OS_IOSSIM) {
CFLAGS+=-DBUILDING_WITH_VULKAN_IOS
BUILDING_WITH_VULKAN_IOS=yes
}
}
when ($MAPSMOBI_BUILD_TARGET && $OS_LINUX) {
when ($NO_GRAPHICS != "yes") {
QT_REQUIRED=yes
OPENGL_REQUIRED=yes
}
OS_SDK=ubuntu-16
PIC=yes
LDFLAGS+=-lstdc++ -lgcc_s
CFLAGS+=-DBOOST_SYMBOL_EXPORT=
CFLAGS+=-DBOOST_SYMBOL_VISIBLE=
}
when ($MAPSMOBI_BUILD_TARGET && $OS_YOCTO) {
QT_REQUIRED=yes
PIC=yes
CFLAGS+=-DBOOST_SYMBOL_EXPORT=
CFLAGS+=-DBOOST_SYMBOL_VISIBLE=
}
|