lok: vcl: fix multiple floatwin removal case more robustly.
[LibreOffice.git] / solenv / gbuild / platform / com_MSC_defs.mk
blobe6afe0b5ad2a50bff9d289d5844270846cdbfe56
1 # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 # This file incorporates work covered by the following license notice:
11 # Licensed to the Apache Software Foundation (ASF) under one or more
12 # contributor license agreements. See the NOTICE file distributed
13 # with this work for additional information regarding copyright
14 # ownership. The ASF licenses this file to you under the Apache
15 # License, Version 2.0 (the "License"); you may not use this file
16 # except in compliance with the License. You may obtain a copy of
17 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 # set tmpdir to some mixed case path, suitable for native tools
21 gb_TMPDIR:=$(if $(TMPDIR),$(shell cygpath -m $(TMPDIR)),$(shell cygpath -m /tmp))
23 # please make generic Windows modifications to windows.mk
24 include $(GBUILDDIR)/platform/windows.mk
26 gb_CC := cl
27 gb_CXX := cl
28 gb_LINK := link
29 gb_AWK := awk
30 gb_CLASSPATHSEP := ;
31 gb_RC := rc
32 gb_YACC := bison
34 # use CC/CXX if they are nondefaults
35 ifneq ($(origin CC),default)
36 gb_CC := $(CC)
37 gb_GCCP := $(CC)
38 endif
39 ifneq ($(origin CXX),default)
40 gb_CXX := $(CXX)
41 endif
43 # _SCL_SECURE_NO_WARNINGS avoids deprecation warnings for STL algorithms
44 # like std::copy, std::transform (when MSVC_USE_DEBUG_RUNTIME is enabled)
46 gb_COMPILERDEFS := \
47 -DBOOST_ERROR_CODE_HEADER_ONLY \
48 -DBOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE \
49 -DBOOST_SYSTEM_NO_DEPRECATED \
50 -D_HAS_AUTO_PTR_ETC \
51 -D_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING \
52 -D_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING \
53 -D_SILENCE_CXX17_RESULT_OF_DEPRECATION_WARNING \
54 -D_CRT_NON_CONFORMING_SWPRINTFS \
55 -D_CRT_NONSTDC_NO_DEPRECATE \
56 -D_CRT_SECURE_NO_DEPRECATE \
57 -D_SCL_SECURE_NO_WARNINGS \
58 -D_MT \
59 -D_DLL \
60 -DCPPU_ENV=$(gb_CPPU_ENV) \
62 ifeq ($(CPUNAME),INTEL)
63 gb_COMPILERDEFS += \
64 -DBOOST_MEM_FN_ENABLE_CDECL \
66 endif
68 gb_RCDEFS := \
69 $(gb_WIN_VERSION_DEFS) \
71 gb_RCFLAGS :=
73 gb_AFLAGS := $(AFLAGS)
75 # Do we really need to disable this many warnings? It seems to me that
76 # many of these warnings are for constructs that we have been actively
77 # cleaning away from the code, to avoid warnings when building with
78 # gcc or Clang and -Wall -Werror.
80 # C4091: 'typedef ': ignored on left of '' when no variable is declared
82 # C4100: 'identifier' : unreferenced formal parameter
84 # C4127: conditional expression is constant
86 # C4189: 'identifier' : local variable is initialized but not referenced
88 # C4200: nonstandard extension used : zero-sized array in struct/union
90 # C4201: nonstandard extension used : nameless struct/union
92 # C4244: nonstandard extension used : formal parameter 'identifier'
93 # was previously defined as a type
95 # C4250: 'class1' : inherits 'class2::member' via dominance
97 # C4251: 'identifier' : class 'type' needs to have dll-interface to be
98 # used by clients of class 'type2'
100 # C4267: conversion from 'size_t' to 'type', possible loss of data
102 # C4275: non-DLL-interface classkey 'identifier' used as base for
103 # DLL-interface classkey 'identifier'
105 # C4290: C++ exception specification ignored except to indicate a
106 # function is not __declspec(nothrow)
108 # C4351: new behavior: elements of array 'array' will be default
109 # initialized
110 # (an issue with MSVC 2013 that appears to be gone with MSVC 2015)
112 # C4373: '%$S': virtual function overrides '%$pS', previous versions
113 # of the compiler did not override when parameters only differed by
114 # const/volatile qualifiers.
115 # [translation: ancient compilers that don't actually support C++ do
116 # stupid things]
118 # C4505: 'function' : unreferenced local function has been removed
120 # C4510: 'class' : default constructor could not be generated
122 # C4512: 'class' : assignment operator could not be generated
123 # (an issue with MSVC 2013 that appears to be gone with MSVC 2015)
125 # C4610: 'class' can never be instantiated - user defined constructor required
127 # C4611: interaction between 'function' and C++ object destruction is
128 # non-portable
130 # C4702: unreachable code
132 # C4706: assignment within conditional expression
134 # C4800: 'type' : forcing value to bool 'true' or 'false' (performance
135 # warning)
137 gb_CFLAGS := \
138 -utf-8 \
139 -Gd \
140 -GR \
141 -Gs \
142 -GS \
143 $(if $(MSVC_USE_DEBUG_RUNTIME),-MDd,-MD) \
144 -nologo \
145 -W4 \
146 -wd4091 \
147 $(if $(filter 0,$(gb_DEBUGLEVEL)),-wd4100) \
148 -wd4127 \
149 $(if $(filter 0,$(gb_DEBUGLEVEL)),-wd4189) \
150 -wd4200 \
151 -wd4244 \
152 -wd4251 \
153 -wd4505 \
154 -wd4512 \
155 -wd4706 \
156 -wd4800 \
157 -wd4267 \
159 ifneq ($(COM_IS_CLANG),TRUE)
161 # clang-cl doesn't support -Wv:18 for now
162 gb_CFLAGS += \
163 -Wv:18 \
165 endif
167 gb_CXXFLAGS := \
168 -utf-8 \
169 $(CXXFLAGS_CXX11) \
170 -Gd \
171 -GR \
172 -Gs \
173 -GS \
174 -Gy \
175 $(if $(MSVC_USE_DEBUG_RUNTIME),-MDd,-MD) \
176 -nologo \
177 -W4 \
178 -wd4091 \
179 $(if $(filter 0,$(gb_DEBUGLEVEL)),-wd4100) \
180 -wd4127 \
181 $(if $(filter 0,$(gb_DEBUGLEVEL)),-wd4189) \
182 -wd4201 \
183 -wd4244 \
184 -wd4250 \
185 -wd4251 \
186 -wd4267 \
187 -wd4275 \
188 -wd4290 \
189 -wd4351 \
190 -wd4373 \
191 -wd4505 \
192 -wd4510 \
193 -wd4512 \
194 -wd4610 \
195 -wd4611 \
196 -wd4706 \
197 -wd4800 \
199 ifeq ($(CPUNAME),INTEL)
201 gb_CXXFLAGS += \
202 -Zm500 \
204 gb_CFLAGS += \
205 -Zm500 \
207 endif
209 ifneq ($(COM_IS_CLANG),TRUE)
211 # clang-cl doesn't support -Wv:18 for now
212 # Work around MSVC 2017 C4702 compiler bug with release builds
213 # http://document-foundation-mail-archive.969070.n3.nabble.com/Windows-32-bit-build-failure-unreachable-code-tp4243848.html
214 # http://document-foundation-mail-archive.969070.n3.nabble.com/64-bit-Windows-build-failure-after-MSVC-Update-tp4246816.html
215 gb_CXXFLAGS += \
216 -Wv:18 \
217 $(if $(filter 0,$(gb_DEBUGLEVEL)),-wd4702) \
219 endif
221 # rc.exe does not support -nologo in 6.1.6723.1 that is in the Windows SDK 6.0A
222 gb_RCFLAGS += -nologo
224 # C4005: 'identifier' : macro redefinition
226 gb_PCHWARNINGS = \
227 -we4650 \
228 -we4651 \
229 -we4652 \
230 -we4653 \
231 -we4005 \
233 gb_STDLIBS := \
234 advapi32.lib \
236 gb_CFLAGS_WERROR = $(if $(ENABLE_WERROR),-WX)
238 # there does not seem to be a way to force C++03 with MSVC
239 gb_CXX03FLAGS :=
241 gb_LinkTarget_EXCEPTIONFLAGS := \
242 -DEXCEPTIONS_ON \
243 -EHs \
245 gb_PrecompiledHeader_EXCEPTIONFLAGS := $(gb_LinkTarget_EXCEPTIONFLAGS)
247 gb_LinkTarget_LDFLAGS := \
248 $(if $(findstring s,$(filter-out --%,$(MAKEFLAGS))),-nologo,) \
249 $(patsubst %,-LIBPATH:%,$(filter-out .,$(subst ;, ,$(subst \,/,$(ILIB))))) \
251 # Prevent warning spamming
252 # Happens because of the way we link our unit tests with our libraries.
253 # LNK4049: locally defined symbol
254 gb_LinkTarget_LDFLAGS += \
255 /ignore:4217 /ignore:4049
258 gb_DEBUGINFO_FLAGS := \
259 -FS \
260 -Zi \
262 gb_DEBUG_CFLAGS :=
264 gb_COMPILEROPTFLAGS := -O2 -Oy-
265 gb_COMPILERNOOPTFLAGS := -Od
267 ifeq ($(gb_FULLDEPS),$(true))
268 gb_COMPILERDEPFLAGS := -showIncludes
269 define gb_create_deps
270 | $(GBUILDDIR)/platform/filter-showIncludes.awk -vdepfile=$(1) -vobjectfile=$(2) -vsourcefile=$(3); exit $${PIPESTATUS[0]}
271 endef
272 else
273 gb_COMPILERDEPFLAGS :=
274 define gb_create_deps
275 endef
276 endif
278 gb_LTOFLAGS := $(if $(filter TRUE,$(ENABLE_LTO)),-GL)
280 # When compiling for CLR, disable "warning C4339: use of undefined type detected
281 # in CLR meta-data - use of this type may lead to a runtime exception":
282 gb_CXXCLRFLAGS := $(gb_CXXFLAGS) $(gb_LinkTarget_EXCEPTIONFLAGS) \
283 -AI $(INSTDIR)/$(LIBO_URE_LIB_FOLDER) \
284 -EHa \
285 -clr \
286 -wd4339 \
287 -Wv:18 \
288 -wd4267 \
290 ifeq ($(COM_IS_CLANG),TRUE)
292 gb_CFLAGS += \
293 -Wdeclaration-after-statement \
294 -Wendif-labels \
295 -Wshadow \
296 -Wstrict-prototypes \
297 -Wundef \
298 -Wunused-macros \
300 gb_CXXFLAGS += \
301 -Wendif-labels \
302 -Wimplicit-fallthrough \
303 -Wno-missing-braces \
304 -Wno-missing-braces \
305 -Wnon-virtual-dtor \
306 -Woverloaded-virtual \
307 -Wshadow \
308 -Wundef \
309 -Wunused-macros \
311 endif
313 ifeq ($(COM_IS_CLANG),TRUE)
314 gb_COMPILER_TEST_FLAGS := -Xclang -plugin-arg-loplugin -Xclang --unit-test-mode
315 ifeq ($(COMPILER_PLUGIN_TOOL),)
316 gb_COMPILER_PLUGINS := -Xclang -load -Xclang $(BUILDDIR)/compilerplugins/obj/plugin.dll -Xclang -add-plugin -Xclang loplugin
317 ifneq ($(COMPILER_PLUGIN_WARNINGS_ONLY),)
318 gb_COMPILER_PLUGINS += -Xclang -plugin-arg-loplugin -Xclang \
319 --warnings-only='$(COMPILER_PLUGIN_WARNINGS_ONLY)'
320 endif
321 else
322 gb_COMPILER_PLUGINS := -Xclang -load -Xclang $(BUILDDIR)/compilerplugins/obj/plugin.dll -Xclang -plugin -Xclang loplugin $(foreach plugin,$(COMPILER_PLUGIN_TOOL), -Xclang -plugin-arg-loplugin -Xclang $(plugin))
323 ifneq ($(UPDATE_FILES),)
324 gb_COMPILER_PLUGINS += -Xclang -plugin-arg-loplugin -Xclang --scope=$(UPDATE_FILES)
325 endif
326 endif
327 ifeq ($(COMPILER_PLUGINS_DEBUG),TRUE)
328 gb_COMPILER_PLUGINS += -Xclang -plugin-arg-loplugin -Xclang --debug
329 endif
330 gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS := \
331 -Xclang -plugin-arg-loplugin -Xclang --warnings-as-errors
332 else
333 gb_COMPILER_TEST_FLAGS :=
334 gb_COMPILER_PLUGINS :=
335 gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS :=
336 endif
338 # Helper class
340 ifeq ($(GNUMAKE_WIN_NATIVE),TRUE)
341 gb_Helper_set_ld_path := PATH="$(shell cygpath -w $(INSTDIR)/$(LIBO_URE_LIB_FOLDER));$(shell cygpath -w $(INSTDIR)/$(LIBO_BIN_FOLDER));$$PATH"
343 define gb_Helper_prepend_ld_path
344 PATH="$(shell cygpath -w $(INSTDIR)/$(LIBO_URE_LIB_FOLDER));$(shell cygpath -w $(INSTDIR)/$(LIBO_BIN_FOLDER));$(1);$$PATH"
345 endef
347 # $(1): one directory pathname to append to the ld path
348 define gb_Helper_extend_ld_path
349 $(gb_Helper_set_ld_path)';$(shell cygpath -w $(1))'
350 endef
352 else
353 gb_Helper_set_ld_path := PATH="$(shell cygpath -u $(INSTDIR)/$(LIBO_URE_LIB_FOLDER)):$(shell cygpath -u $(INSTDIR)/$(LIBO_BIN_FOLDER)):$$PATH"
355 define gb_Helper_prepend_ld_path
356 PATH="$(shell cygpath -u $(INSTDIR)/$(LIBO_URE_LIB_FOLDER)):$(shell cygpath -u $(INSTDIR)/$(LIBO_BIN_FOLDER)):$(1):$$PATH"
357 endef
359 # $(1): one directory pathname to append to the ld path
360 define gb_Helper_extend_ld_path
361 $(gb_Helper_set_ld_path):$(shell cygpath -u $(1))
362 endef
364 endif
366 # vim: set noet sw=4: