forked from google/mozc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon_win.gypi
415 lines (410 loc) · 14.9 KB
/
common_win.gypi
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
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
# Copyright 2010-2021, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# This file is included by build_mozc.py for Windows.
# common_win.gypi and common.gypi are exclusive each other.
{
'includes': ['defines.gypi', 'directories.gypi'],
'variables': {
# Compiler to build binaries that run in the target environment.
# e.g. "clang", "gcc", "msvs".
'compiler_target%': '',
# Compiler to build binaries that run in the host environment.
# e.g. "clang", "gcc", "msvs".
'compiler_host%': '',
# Visual C++ Runtime Version.
'vcruntime_ver%': '',
# Extra headers and libraries for Visual C++.
'msvs_includes%': [],
'msvs_libs_x86%': [],
'msvs_libs_x64%': [],
'conditions': [
# https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros
['MSVS_VERSION=="2015"', {
'compiler_target': 'msvs',
'compiler_host': 'msvs',
'vcruntime_ver': '140',
}],
['MSVS_VERSION=="2017"', {
'compiler_target': 'msvs',
'compiler_host': 'msvs',
'vcruntime_ver': '141',
}],
['MSVS_VERSION=="2019"', {
'compiler_target': 'msvs',
'compiler_host': 'msvs',
'vcruntime_ver': '142',
}],
['MSVS_VERSION=="2022"', {
'compiler_target': 'msvs',
'compiler_host': 'msvs',
'vcruntime_ver': '143',
}],
],
'msvc_disabled_warnings': [
# 'expression' : signed/unsigned mismatch
# http://msdn.microsoft.com/en-us/library/y92ktdf2.aspx
'4018',
# 'argument' : conversion from 'type1' to 'type2', possible loss
# of data
# http://msdn.microsoft.com/en-us/library/2d7604yb.aspx
'4244',
# 'var' : conversion from 'size_t' to 'type', possible loss of
# data
# http://msdn.microsoft.com/en-us/library/6kck0s93.aspx
'4267',
# 'identifier' : truncation from 'type1' to 'type2'
# http://msdn.microsoft.com/en-us/library/0as1ke3f.aspx
'4305',
# The file contains a character that cannot be represented in the
# current code page (number). Save the file in Unicode format to
# prevent data loss.
# http://msdn.microsoft.com/en-us/library/ms173715.aspx
'4819',
# Suppress warning against functions marked as 'deprecated'.
# http://msdn.microsoft.com/en-us/library/vstudio/8wsycdzs.aspx
'4995',
# Suppress warning against functions marked as 'deprecated'.
# http://msdn.microsoft.com/en-us/library/vstudio/ttcz0bys.aspx
'4996',
],
},
'target_defaults': {
'variables': {
# https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.vcprojectengine.vcclcompilertool.optimization?view=visualstudiosdk-2017
# https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.vcprojectengine.optimizeoption?view=visualstudiosdk-2017
# https://docs.microsoft.com/en-us/cpp/build/reference/o1-o2-minimize-size-maximize-speed?view=msvc-150
'win_optimization_debug%': '0', # 0 = /Od
'win_optimization_release%': '2', # 2 = /O2 (maximize speed)
# = /Og /Oi /Ot /Oy /Ob2 /GF /Gy
'win_optimization_custom%': '4', # 4 = None but prevents vcbuild from
# inheriting default optimization.
# See http://msdn.microsoft.com/en-us/library/aa652367(VS.71).aspx
'win_release_static_crt%': '0', # 0 = /MT (nondebug static)
'win_debug_static_crt%': '1', # 1 = /MTd (debug static)
'win_release_dynamic_crt%': '2', # 2 = /MD (nondebug dynamic)
'win_debug_dynamic_crt%': '3', # 3 = /MDd (debug dynamic)
# See http://msdn.microsoft.com/en-us/library/aa652352(VS.71).aspx
'win_target_machine_x86%': '1',
'win_target_machine_x64%': '17',
# See http://msdn.microsoft.com/en-us/library/aa652256(VS.71).aspx
'win_char_set_not_set%': '0',
'win_char_set_unicode%': '1',
'win_char_set_mbcs%': '2',
},
'configurations': {
'x86_Base': {
'abstract': 1,
'msvs_settings': {
'VCCLCompilerTool': {
'AdditionalOptions': [
'/bigobj',
],
},
'VCLibrarianTool': {
'AdditionalLibraryDirectories': [
'<@(msvs_libs_x86)',
],
'AdditionalLibraryDirectories!': [
'<@(msvs_libs_x64)',
],
},
'VCLinkerTool': {
'TargetMachine': '<(win_target_machine_x86)',
'AdditionalOptions': [
'/SAFESEH',
],
'AdditionalLibraryDirectories': [
'<@(msvs_libs_x86)',
],
'AdditionalLibraryDirectories!': [
'<@(msvs_libs_x64)',
],
'EnableUAC': 'true',
'UACExecutionLevel': '0', # level="asInvoker"
'UACUIAccess': 'false', # uiAccess="false"
'MinimumRequiredVersion': '10.0',
},
},
'msvs_configuration_attributes': {
'OutputDirectory': '<(build_base)/$(ConfigurationName)',
'IntermediateDirectory': '<(build_base)/$(ConfigurationName)/obj/$(ProjectName)',
},
'msvs_configuration_platform': 'Win32',
},
'x64_Base': {
'abstract': 1,
'msvs_configuration_attributes': {
'OutputDirectory': '<(build_base)/$(ConfigurationName)_x64',
'IntermediateDirectory': '<(build_base)/$(ConfigurationName)_x64/obj/$(ProjectName)',
},
'msvs_configuration_platform': 'x64',
'msvs_settings': {
'VCCLCompilerTool': {
'AdditionalOptions': [
'/bigobj',
],
},
'VCLibrarianTool': {
'AdditionalLibraryDirectories': [
'<@(msvs_libs_x64)',
],
'AdditionalLibraryDirectories!': [
'<@(msvs_libs_x86)',
],
},
'VCLinkerTool': {
'TargetMachine': '<(win_target_machine_x64)',
'AdditionalLibraryDirectories': [
'<@(msvs_libs_x64)',
],
'AdditionalLibraryDirectories!': [
'<@(msvs_libs_x86)',
],
},
},
},
'Win_Static_Debug_CRT_Base': {
'abstract': 1,
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeLibrary': '<(win_debug_static_crt)',
},
},
},
'Win_Static_Release_CRT_Base': {
'abstract': 1,
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeLibrary': '<(win_release_static_crt)',
},
},
},
'Win_Dynamic_Debug_CRT_Base': {
'abstract': 1,
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeLibrary': '<(win_debug_dynamic_crt)',
},
},
},
'Win_Dynamic_Release_CRT_Base': {
'abstract': 1,
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeLibrary': '<(win_release_dynamic_crt)',
},
},
},
'Debug_Base': {
'abstract': 1,
'defines': [
'DEBUG',
],
'msvs_settings': {
'VCCLCompilerTool': {
'Optimization': '<(win_optimization_debug)',
'PreprocessorDefinitions': ['_DEBUG'],
'BasicRuntimeChecks': '3',
},
'VCResourceCompilerTool': {
'PreprocessorDefinitions': ['_DEBUG'],
},
},
},
'Release_Base': {
'abstract': 1,
'defines': [
'NDEBUG',
'QT_NO_DEBUG',
'MOZC_NO_LOGGING',
'ABSL_MIN_LOG_LEVEL=100',
'IGNORE_HELP_FLAG',
'IGNORE_INVALID_FLAG'
],
'msvs_settings': {
'VCCLCompilerTool': {
# '<(win_optimization_release)' (that is /O2) contains /Oy option,
# which makes debugging extremely difficult. (See b/1852473)
# http://msdn.microsoft.com/en-us/library/8f8h5cxt.aspx
# We can still disable FPO by using /Oy- option but the document
# says there is an order dependency, that is, the last /Oy or /Oy-
# is valid. See the following document for details.
# http://msdn.microsoft.com/en-us/library/2kxx5t2c.aspx
# As far as we observed, /Oy- adding in 'AdditionalOptions' always
# appears at the end of options so using
# '<(win_optimization_release) here is considered to be harmless.
# Another reason to use /O2 here is b/2822535, where we observed
# warning C4748 when we build mozc_tool with Qt libraries, which
# are built with /O2. We use the same optimization option between
# Mozc and Qt just in case warning C4748 is true.
'Optimization': '<(win_optimization_release)',
'WholeProgramOptimization': 'true',
},
'VCLibrarianTool': {
'LinkTimeCodeGeneration': 'true',
},
'VCLinkerTool': {
# 1 = 'LinkTimeCodeGenerationOptionUse'
'LinkTimeCodeGeneration': '1',
# /PDBALTPATH is documented in Visual C++ 2010
# http://msdn.microsoft.com/en-us/library/dd998269(VS.100).aspx
'AdditionalOptions': ['/PDBALTPATH:%_PDB%'],
},
},
},
#
# Concrete configurations
#
'Debug': {
'inherit_from': ['x86_Base', 'Debug_Base', 'Win_Static_Debug_CRT_Base'],
},
'Release': {
'inherit_from': ['x86_Base', 'Release_Base', 'Win_Static_Release_CRT_Base'],
},
'DebugDynamic_x64': {
'inherit_from': ['x64_Base', 'Debug_Base', 'Win_Dynamic_Debug_CRT_Base'],
},
'ReleaseDynamic_x64': {
'inherit_from': ['x64_Base', 'Release_Base', 'Win_Dynamic_Release_CRT_Base'],
},
'Debug_x64': {
'inherit_from': ['x64_Base', 'Debug_Base', 'Win_Static_Debug_CRT_Base'],
},
'Release_x64': {
'inherit_from': ['x64_Base', 'Release_Base', 'Win_Static_Release_CRT_Base'],
},
},
'default_configuration': 'Debug',
'defines': [
'COMPILER_MSVC',
'BUILD_MOZC', # for ime_shared library
'ID_TRACE_LEVEL=1',
'NOMINMAX',
'PSAPI_VERSION=2',
'UNICODE',
'WIN32',
'WIN32_LEAN_AND_MEAN',
'WINVER=0x0A00',
'_ATL_ALL_WARNINGS',
'_ATL_ALLOW_CHAR_UNSIGNED',
'_ATL_CSTRING_EXPLICIT_CONSTRUCTORS',
'_ATL_NO_HOSTING',
'_ATL_NO_AUTOMATIC_NAMESPACE',
'_CRT_SECURE_NO_DEPRECATE',
'_MIDL_USE_GUIDDEF_',
'_STL_MSVC',
'_UNICODE',
'_WIN32',
'_WIN32_WINNT=0x0A00',
'_WINDOWS',
],
'include_dirs': [
'<@(absl_include_dirs)',
'<(abs_depth)',
'<(SHARED_INTERMEDIATE_DIR)',
'<@(msvs_includes)',
'<(third_party_dir)/wil/include',
],
'msvs_configuration_attributes': {
'CharacterSet': '<(win_char_set_unicode)',
},
'msvs_cygwin_shell': 0,
'msvs_disabled_warnings': ['<@(msvc_disabled_warnings)'], # /wdXXXX
'msvs_settings': {
'VCCLCompilerTool': {
'BufferSecurityCheck': 'true', # /GS
'DebugInformationFormat': '3', # /Zi
'DefaultCharIsUnsigned': 'true', # /J
'EnableFunctionLevelLinking': 'true', # /Gy
'EnableIntrinsicFunctions': 'true', # /Oi
'ExceptionHandling': '2', # /EHs
'SuppressStartupBanner': 'true', # /nologo
'WarningLevel': '3', # /W3
'OmitFramePointers': 'false', # /Oy-
'AdditionalOptions': [
'/Zc:strictStrings',
'/utf-8',
'/std:c++20',
'/Zc:__cplusplus',
],
},
'VCLinkerTool': {
'AdditionalDependencies': [
'advapi32.lib',
'comdlg32.lib',
'delayimp.lib',
'gdi32.lib',
'imm32.lib',
'kernel32.lib',
'ole32.lib',
'oleaut32.lib',
'shell32.lib',
'user32.lib',
'uuid.lib',
],
'AdditionalOptions': [
'/CETCOMPAT',
],
'DataExecutionPrevention': '2', # /NXCOMPAT
'EnableCOMDATFolding': '2', # /OPT:ICF
'GenerateDebugInformation': 'true', # /DEBUG
'LinkIncremental': '1', # /INCREMENTAL:NO
'OptimizeReferences': '2', # /OPT:REF
'RandomizedBaseAddress': '2', # /DYNAMICBASE
'target_conditions': [
['_type=="executable"', {
# /TSAWARE is valid only on executable target.
'TerminalServerAware': '2', # /TSAWARE
'AdditionalOptions': [
# We build *.exe with dynamic CRT and deploy CRT DLLs into the
# application dir. Thus LOAD_LIBRARY_SEARCH_APPLICATION_DIR is
# also necessary.
# 0x200: LOAD_LIBRARY_SEARCH_APPLICATION_DIR
# 0x800: LOAD_LIBRARY_SEARCH_SYSTEM32
'/DEPENDENTLOADFLAG:0xA00',
],
}, '_type=="shared_library"', {
'AdditionalOptions': [
# We build *.dll with staticd CRT. Thus
# LOAD_LIBRARY_SEARCH_APPLICATION_DIR is not necessary.
# 0x800: LOAD_LIBRARY_SEARCH_SYSTEM32
'/DEPENDENTLOADFLAG:0x800',
],
}],
],
},
'VCResourceCompilerTool': {
'AdditionalIncludeDirectories': [
'<(SHARED_INTERMEDIATE_DIR)/',
'<(DEPTH)/',
],
},
},
},
}