Advertisement
Guest User

chromium/src/build/config/win/BUILD.gn

a guest
Oct 1st, 2022
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.79 KB | None | 0 0
  1. # Copyright 2013 The Chromium Authors
  2. # Use of this source code is governed by a BSD-style license that can be
  3. # found in the LICENSE file.
  4.  
  5. import("//build/config/c++/c++.gni")
  6. import("//build/config/chrome_build.gni")
  7. import("//build/config/clang/clang.gni")
  8. import("//build/config/compiler/compiler.gni")
  9. import("//build/config/sanitizers/sanitizers.gni")
  10. import("//build/config/win/control_flow_guard.gni")
  11. import("//build/config/win/visual_studio_version.gni")
  12. import("//build/timestamp.gni")
  13. import("//build/toolchain/goma.gni")
  14. import("//build/toolchain/toolchain.gni")
  15.  
  16. assert(is_win)
  17.  
  18. declare_args() {
  19. # Turn this on to have the linker output extra timing information.
  20. win_linker_timing = false
  21.  
  22. # possible values for target_winuwp_version:
  23. # "10" - Windows UWP 10
  24. # "8.1" - Windows RT 8.1
  25. # "8.0" - Windows RT 8.0
  26. target_winuwp_version = "10"
  27.  
  28. # possible values:
  29. # "app" - Windows Store Applications
  30. # "phone" - Windows Phone Applications
  31. # "system" - Windows Drivers and Tools
  32. # "server" - Windows Server Applications
  33. # "desktop" - Windows Desktop Applications
  34. target_winuwp_family = "app"
  35.  
  36. # Set this to use clang-style diagnostics format instead of MSVC-style, which
  37. # is useful in e.g. Emacs compilation mode.
  38. # E.g.:
  39. # Without this, clang emits a diagnostic message like this:
  40. # foo/bar.cc(12,34): error: something went wrong
  41. # and with this switch, clang emits it like this:
  42. # foo/bar.cc:12:34: error: something went wrong
  43. use_clang_diagnostics_format = false
  44.  
  45. # Indicates whether to use /pdbpagesize:8192 to allow PDBs larger than 4 GiB.
  46. # This requires updated debugging and profiling tools which are not widely
  47. # distributed yet which is why it is currently opt-in.
  48. use_large_pdbs = false
  49. }
  50.  
  51. # This is included by reference in the //build/config/compiler config that
  52. # is applied to all targets. It is here to separate out the logic that is
  53. # Windows-only.
  54. config("compiler") {
  55. if (current_cpu == "x86") {
  56. asmflags = [
  57. # When /safeseh is specified, the linker will only produce an image if it
  58. # can also produce a table of the image's safe exception handlers. This
  59. # table specifies for the operating system which exception handlers are
  60. # valid for the image. Note that /SAFESEH isn't accepted on the command
  61. # line, only /safeseh. This is only accepted by ml.exe, not ml64.exe.
  62. "/safeseh",
  63. ]
  64. }
  65.  
  66. cflags = [
  67. "/Gy", # Enable function-level linking.
  68. "/FS", # Preserve previous PDB behavior.
  69. "/bigobj", # Some of our files are bigger than the regular limits.
  70. "/utf-8", # Assume UTF-8 by default to avoid code page dependencies.
  71. ]
  72.  
  73. if (is_clang) {
  74. cflags += [
  75. "/Zc:twoPhase",
  76.  
  77. # Consistently use backslash as the path separator when expanding the
  78. # __FILE__ macro when targeting Windows regardless of the build
  79. # environment.
  80. "-ffile-reproducible",
  81. ]
  82. }
  83.  
  84. # Force C/C++ mode for the given GN detected file type. This is necessary
  85. # for precompiled headers where the same source file is compiled in both
  86. # modes.
  87. cflags_c = [ "/TC" ]
  88. cflags_cc = [ "/TP" ]
  89.  
  90. cflags += [
  91. # Work around crbug.com/526851, bug in VS 2015 RTM compiler.
  92. # "/Zc:sizedDealloc-",
  93. ]
  94.  
  95. if (is_clang) {
  96. # Required to make the 19041 SDK compatible with clang-cl.
  97. # See https://crbug.com/1089996 issue #2 for details.
  98. cflags += [ "/D__WRL_ENABLE_FUNCTION_STATICS__" ]
  99.  
  100. # Tell clang which version of MSVC to emulate.
  101. cflags += [ "-fmsc-version=1916" ]
  102.  
  103. if (is_component_build) {
  104. cflags += [
  105. # Do not export inline member functions. This makes component builds
  106. # faster. This is similar to -fvisibility-inlines-hidden.
  107. "/Zc:dllexportInlines-",
  108. ]
  109. }
  110.  
  111. if (current_cpu == "x86") {
  112. if (host_cpu == "x86" || host_cpu == "x64") {
  113. cflags += [ "-m32" ]
  114. } else {
  115. cflags += [ "--target=i386-windows" ]
  116. }
  117. } else if (current_cpu == "x64") {
  118. if (host_cpu == "x86" || host_cpu == "x64") {
  119. cflags += [ "-m64" ]
  120. } else {
  121. cflags += [ "--target=x86_64-windows" ]
  122. }
  123. } else if (current_cpu == "arm64") {
  124. cflags += [ "--target=arm64-windows" ]
  125. } else {
  126. assert(false, "unknown current_cpu " + current_cpu)
  127. }
  128.  
  129. # Chrome currently requires SSE3. Clang supports targeting any Intel
  130. # microarchitecture. MSVC only supports a subset of architectures, and the
  131. # next step after SSE2 will be AVX.
  132. if (current_cpu == "x86" || current_cpu == "x64") {
  133. # cflags += [ "-msse3" ]
  134. cflags += [ "/arch:AVX2", "-maes", "-mvaes", ]
  135. }
  136.  
  137. if (exec_script("//build/win/use_ansi_codes.py", [], "trim string") ==
  138. "True") {
  139. cflags += [
  140. # cmd.exe doesn't understand ANSI escape codes by default,
  141. # so only enable them if something emulating them is around.
  142. "-fansi-escape-codes",
  143. ]
  144. }
  145.  
  146. if (use_clang_diagnostics_format) {
  147. cflags += [ "/clang:-fdiagnostics-format=clang" ]
  148. }
  149. }
  150.  
  151. # Disabled with cc_wrapper because of https://github.com/mozilla/sccache/issues/264
  152. if (use_lld && !use_thin_lto && (is_clang || !use_goma) && cc_wrapper == "") {
  153. # /Brepro lets the compiler not write the mtime field in the .obj output.
  154. # link.exe /incremental relies on this field to work correctly, but lld
  155. # never looks at this timestamp, so it's safe to pass this flag with
  156. # lld and get more deterministic compiler output in return.
  157. # In LTO builds, the compiler doesn't write .obj files containing mtimes,
  158. # so /Brepro is ignored there.
  159. cflags += [ "/Brepro" ]
  160. }
  161.  
  162. ldflags = []
  163.  
  164. if (use_lld) {
  165. # lld defaults to writing the current time in the pe/coff header.
  166. # For build reproducibility, pass an explicit timestamp. See
  167. # build/compute_build_timestamp.py for how the timestamp is chosen.
  168. # (link.exe also writes the current time, but it doesn't have a flag to
  169. # override that behavior.)
  170. ldflags += [ "/TIMESTAMP:" + build_timestamp ]
  171.  
  172. # Don't look for libpaths in %LIB%, similar to /X in cflags above.
  173. ldflags += [ "/lldignoreenv" ]
  174. }
  175.  
  176. if (use_large_pdbs) {
  177. # This allows PDBs up to 8 GiB in size. This requires lld-link.exe or
  178. # link.exe from VS 2022 or later.
  179. ldflags += [ "/pdbpagesize:8192" ]
  180. }
  181.  
  182. if (!is_debug && !is_component_build) {
  183. # Enable standard linker optimizations like GC (/OPT:REF) and ICF in static
  184. # release builds.
  185. # Release builds always want these optimizations, so enable them explicitly.
  186. ldflags += [
  187. "/OPT:REF",
  188. "/OPT:ICF",
  189. "/INCREMENTAL:NO",
  190. "/FIXED:NO",
  191. ]
  192.  
  193. if (use_lld) {
  194. # String tail merging leads to smaller binaries, but they don't compress
  195. # as well, leading to increased mini_installer size (crbug.com/838449).
  196. ldflags += [ "/OPT:NOLLDTAILMERGE" ]
  197. }
  198.  
  199. # TODO(siggi): Is this of any use anymore?
  200. # /PROFILE ensures that the PDB file contains FIXUP information (growing the
  201. # PDB file by about 5%) but does not otherwise alter the output binary. It
  202. # is enabled opportunistically for builds where it is not prohibited (not
  203. # supported when incrementally linking, or using /debug:fastlink).
  204. # ldflags += [ "/PROFILE" ]
  205. }
  206.  
  207. # arflags apply only to static_libraries. The normal linker configs are only
  208. # set for executable and shared library targets so arflags must be set
  209. # elsewhere. Since this is relatively contained, we just apply them in this
  210. # more general config and they will only have an effect on static libraries.
  211. arflags = [
  212. # "No public symbols found; archive member will be inaccessible." This
  213. # means that one or more object files in the library can never be
  214. # pulled in to targets that link to this library. It's just a warning that
  215. # the source file is a no-op.
  216. "/ignore:4221",
  217. ]
  218. }
  219.  
  220. # This is included by reference in the //build/config/compiler:runtime_library
  221. # config that is applied to all targets. It is here to separate out the logic
  222. # that is Windows-only. Please see that target for advice on what should go in
  223. # :runtime_library vs. :compiler.
  224. config("runtime_library") {
  225. cflags = []
  226. cflags_cc = []
  227.  
  228. # Defines that set up the CRT.
  229. defines = [
  230. "__STD_C",
  231. "_CRT_RAND_S",
  232. "_CRT_SECURE_NO_DEPRECATE",
  233. "_SCL_SECURE_NO_DEPRECATE",
  234. ]
  235.  
  236. # Defines that set up the Windows SDK.
  237. defines += [
  238. "_ATL_NO_OPENGL",
  239. "_WINDOWS",
  240. "CERT_CHAIN_PARA_HAS_EXTRA_FIELDS",
  241. "PSAPI_VERSION=2",
  242. "WIN32",
  243. "_SECURE_ATL",
  244. ]
  245.  
  246. if (current_os == "winuwp") {
  247. # When targeting Windows Runtime, certain compiler/linker flags are
  248. # necessary.
  249. defines += [
  250. "WINUWP",
  251. "__WRL_NO_DEFAULT_LIB__",
  252. ]
  253. if (target_winuwp_family == "app") {
  254. defines += [ "WINAPI_FAMILY=WINAPI_FAMILY_PC_APP" ]
  255. } else if (target_winuwp_family == "phone") {
  256. defines += [ "WINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP" ]
  257. } else if (target_winuwp_family == "system") {
  258. defines += [ "WINAPI_FAMILY=WINAPI_FAMILY_SYSTEM" ]
  259. } else if (target_winuwp_family == "server") {
  260. defines += [ "WINAPI_FAMILY=WINAPI_FAMILY_SERVER" ]
  261. } else {
  262. defines += [ "WINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP" ]
  263. }
  264. cflags_cc += [ "/EHsc" ]
  265.  
  266. # This warning is given because the linker cannot tell the difference
  267. # between consuming WinRT APIs versus authoring WinRT within static
  268. # libraries as such this warning is always given by the linker. Since
  269. # consuming WinRT APIs within a library is legitimate but authoring
  270. # WinRT APis is not allowed, this warning is disabled to ignore the
  271. # legitimate consumption of WinRT APIs within static library builds.
  272. arflags = [ "/IGNORE:4264" ]
  273.  
  274. if (target_winuwp_version == "10") {
  275. defines += [ "WIN10=_WIN32_WINNT_WIN10" ]
  276. } else if (target_winuwp_version == "8.1") {
  277. defines += [ "WIN8_1=_WIN32_WINNT_WINBLUE" ]
  278. } else if (target_winuwp_version == "8.0") {
  279. defines += [ "WIN8=_WIN32_WINNT_WIN8" ]
  280. }
  281. } else {
  282. # When not targeting Windows Runtime, make sure the WINAPI family is set
  283. # to desktop.
  284. defines += [ "WINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP" ]
  285. }
  286. }
  287.  
  288. # Chromium supports running on Windows 7, but if these constants are set to
  289. # Windows 7, then newer APIs aren't made available by the Windows SDK.
  290. # So we set this to Windows 10 and then are careful to check at runtime
  291. # to only call newer APIs when they're available.
  292. # Some third-party libraries assume that these defines set what version of
  293. # Windows is available at runtime. Targets using these libraries need to
  294. # manually override this config for their compiles.
  295. config("winver") {
  296. defines = [
  297. "NTDDI_VERSION=NTDDI_WIN10_FE",
  298.  
  299. # We can't say `=_WIN32_WINNT_WIN10` here because some files do
  300. # `#if WINVER < 0x0600` without including windows.h before,
  301. # and then _WIN32_WINNT_WIN10 isn't yet known to be 0x0A00.
  302. "_WIN32_WINNT=0x0A00",
  303. "WINVER=0x0A00",
  304. ]
  305. }
  306.  
  307. # Linker flags for Windows SDK setup, this is applied only to EXEs and DLLs.
  308. config("sdk_link") {
  309. if (current_cpu == "x86") {
  310. ldflags = [
  311. "/SAFESEH", # Not compatible with x64 so use only for x86.
  312. "/largeaddressaware",
  313. ]
  314. }
  315. }
  316.  
  317. # This default linker setup is provided separately from the SDK setup so
  318. # targets who want different library configurations can remove this and specify
  319. # their own.
  320. config("common_linker_setup") {
  321. ldflags = [
  322. "/FIXED:NO",
  323. "/ignore:4199",
  324. "/ignore:4221",
  325. "/NXCOMPAT",
  326. "/DYNAMICBASE",
  327. ]
  328.  
  329. if (win_linker_timing) {
  330. ldflags += [
  331. "/time",
  332. "/verbose:incr",
  333. ]
  334. }
  335. }
  336.  
  337. config("default_cfg_compiler") {
  338. # Emit table of address-taken functions for Control-Flow Guard (CFG).
  339. # This is needed to allow functions to be called by code that is built
  340. # with CFG enabled, such as system libraries.
  341. # The CFG guards are only emitted if |win_enable_cfg_guards| is enabled.
  342. if (is_clang) {
  343. if (win_enable_cfg_guards) {
  344. cflags = [ "/guard:cf" ]
  345. } else {
  346. cflags = [ "/guard:cf,nochecks" ]
  347. }
  348. }
  349. }
  350.  
  351. # To disable CFG guards for a target, remove the "default_cfg_compiler"
  352. # config, and add "disable_guards_cfg_compiler" config.
  353. config("disable_guards_cfg_compiler") {
  354. # Emit table of address-taken functions for Control-Flow Guard (CFG).
  355. # This is needed to allow functions to be called by code that is built
  356. # with CFG enabled, such as system libraries.
  357. if (is_clang) {
  358. cflags = [ "/guard:cf,nochecks" ]
  359. }
  360. }
  361.  
  362. config("cfi_linker") {
  363. # Control Flow Guard (CFG)
  364. # https://msdn.microsoft.com/en-us/library/windows/desktop/mt637065.aspx
  365. # /DYNAMICBASE (ASLR) is turned off in debug builds, therefore CFG cannot be
  366. # turned on either.
  367. # ASan and CFG leads to slow process startup. Chromium's test runner uses
  368. # lots of child processes, so this means things are really slow. Disable CFG
  369. # for now. https://crbug.com/846966
  370. if (!is_debug && !is_asan) {
  371. # Turn on CFG bitmap generation and CFG load config.
  372. ldflags = [ "/guard:cf" ]
  373. }
  374. }
  375.  
  376. # This is a superset of all the delayloads needed for chrome.exe, chrome.dll,
  377. # chrome_child.dll, and chrome_elf.dll. The linker will automatically ignore
  378. # anything which is not linked to the binary at all.
  379. # Most of the dlls are simply not required at startup (or at all, depending
  380. # on how the browser is used). The following dlls are interconnected and need to
  381. # be delayloaded together to ensure user32 does not load too early or at all,
  382. # depending on the process type: user32, gdi32, comctl32, comdlg32, cryptui,
  383. # d3d9, dwmapi, imm32, msi, ole32, oleacc, rstrtmgr, shell32, shlwapi, and
  384. # uxtheme.
  385. # There are some exceptions to this list which need to be declared separately.
  386. # Some dlls cannot be delayloaded by chrome_child.dll due to the sandbox
  387. # restrictions that prevent them from being loaded properly. Those dlls are
  388. # specified in the separate config below.
  389. # This config should also be used for any test binary whose goal is to run
  390. # tests with the full browser.
  391. config("delayloads") {
  392. ldflags = [
  393. "/DELAYLOAD:api-ms-win-core-winrt-error-l1-1-0.dll",
  394. "/DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll",
  395. "/DELAYLOAD:api-ms-win-core-winrt-string-l1-1-0.dll",
  396. "/DELAYLOAD:comctl32.dll",
  397. "/DELAYLOAD:comdlg32.dll",
  398. "/DELAYLOAD:credui.dll",
  399. "/DELAYLOAD:cryptui.dll",
  400. "/DELAYLOAD:d3d11.dll",
  401. "/DELAYLOAD:d3d9.dll",
  402. "/DELAYLOAD:dwmapi.dll",
  403. "/DELAYLOAD:dxgi.dll",
  404. "/DELAYLOAD:dxva2.dll",
  405. "/DELAYLOAD:esent.dll",
  406. "/DELAYLOAD:gdi32.dll",
  407. "/DELAYLOAD:hid.dll",
  408. "/DELAYLOAD:imagehlp.dll",
  409. "/DELAYLOAD:imm32.dll",
  410. "/DELAYLOAD:msi.dll",
  411. "/DELAYLOAD:netapi32.dll",
  412. "/DELAYLOAD:ncrypt.dll",
  413. "/DELAYLOAD:ole32.dll",
  414. "/DELAYLOAD:oleacc.dll",
  415. "/DELAYLOAD:propsys.dll",
  416. "/DELAYLOAD:psapi.dll",
  417. "/DELAYLOAD:rpcrt4.dll",
  418. "/DELAYLOAD:rstrtmgr.dll",
  419. "/DELAYLOAD:setupapi.dll",
  420. "/DELAYLOAD:shell32.dll",
  421. "/DELAYLOAD:shlwapi.dll",
  422. "/DELAYLOAD:urlmon.dll",
  423. "/DELAYLOAD:user32.dll",
  424. "/DELAYLOAD:usp10.dll",
  425. "/DELAYLOAD:uxtheme.dll",
  426. "/DELAYLOAD:wer.dll",
  427. "/DELAYLOAD:wevtapi.dll",
  428. "/DELAYLOAD:wininet.dll",
  429. "/DELAYLOAD:winusb.dll",
  430. "/DELAYLOAD:wsock32.dll",
  431. "/DELAYLOAD:wtsapi32.dll",
  432. ]
  433. }
  434.  
  435. config("delayloads_not_for_child_dll") {
  436. ldflags = [
  437. "/DELAYLOAD:advapi32.dll",
  438. "/DELAYLOAD:crypt32.dll",
  439. "/DELAYLOAD:dbghelp.dll",
  440. "/DELAYLOAD:dhcpcsvc.dll",
  441. "/DELAYLOAD:dwrite.dll",
  442. "/DELAYLOAD:iphlpapi.dll",
  443. "/DELAYLOAD:oleaut32.dll",
  444. "/DELAYLOAD:secur32.dll",
  445. "/DELAYLOAD:uiautomationcore.dll",
  446. "/DELAYLOAD:userenv.dll",
  447. "/DELAYLOAD:winhttp.dll",
  448. "/DELAYLOAD:winmm.dll",
  449. "/DELAYLOAD:winspool.drv",
  450. "/DELAYLOAD:wintrust.dll",
  451. "/DELAYLOAD:ws2_32.dll",
  452. ]
  453. }
  454.  
  455. # CRT --------------------------------------------------------------------------
  456.  
  457. # Configures how the runtime library (CRT) is going to be used.
  458. # See https://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx for a reference of
  459. # what each value does.
  460. config("default_crt") {
  461. if (is_component_build) {
  462. # Component mode: dynamic CRT. Since the library is shared, it requires
  463. # exceptions or will give errors about things not matching, so keep
  464. # exceptions on.
  465. configs = [ ":dynamic_crt" ]
  466. } else {
  467. if (current_os == "winuwp") {
  468. # https://blogs.msdn.microsoft.com/vcblog/2014/06/10/the-great-c-runtime-crt-refactoring/
  469. # contains a details explanation of what is happening with the Windows
  470. # CRT in Visual Studio releases related to Windows store applications.
  471. configs = [ ":dynamic_crt" ]
  472. } else {
  473. # Desktop Windows: static CRT.
  474. configs = [ ":static_crt" ]
  475. }
  476. }
  477. }
  478.  
  479. # Use this to force use of the release CRT when building perf-critical build
  480. # tools that need to be fully optimized even in debug builds, for those times
  481. # when the debug CRT is part of the bottleneck. This also avoids *implicitly*
  482. # defining _DEBUG.
  483. config("release_crt") {
  484. if (is_component_build) {
  485. cflags = [ "/MD" ]
  486.  
  487. if (use_custom_libcxx) {
  488. # On Windows, including libcpmt[d]/msvcprt[d] explicitly links the C++
  489. # standard library, which libc++ needs for exception_ptr internals.
  490. ldflags = [ "/DEFAULTLIB:msvcprt.lib" ]
  491. }
  492. } else {
  493. cflags = [ "/MT" ]
  494. if (use_custom_libcxx) {
  495. ldflags = [ "/DEFAULTLIB:libcpmt.lib" ]
  496. }
  497. }
  498. }
  499.  
  500. config("dynamic_crt") {
  501. if (is_debug) {
  502. # This pulls in the DLL debug CRT and defines _DEBUG
  503. cflags = [ "/MDd" ]
  504. if (use_custom_libcxx) {
  505. ldflags = [ "/DEFAULTLIB:msvcprtd.lib" ]
  506. }
  507. } else {
  508. cflags = [ "/MD" ]
  509. if (use_custom_libcxx) {
  510. ldflags = [ "/DEFAULTLIB:msvcprt.lib" ]
  511. }
  512. }
  513. }
  514.  
  515. config("static_crt") {
  516. if (is_debug) {
  517. # This pulls in the static debug CRT and defines _DEBUG
  518. cflags = [ "/MTd" ]
  519. if (use_custom_libcxx) {
  520. ldflags = [ "/DEFAULTLIB:libcpmtd.lib" ]
  521. }
  522. } else {
  523. cflags = [ "/MT" ]
  524. if (use_custom_libcxx) {
  525. ldflags = [ "/DEFAULTLIB:libcpmt.lib" ]
  526. }
  527. }
  528. }
  529.  
  530. # Subsystem --------------------------------------------------------------------
  531.  
  532. # This is appended to the subsystem to specify a minimum version.
  533. if (current_cpu == "x64") {
  534. # The number after the comma is the minimum required OS version.
  535. # 5.02 = Windows Server 2003.
  536. subsystem_version_suffix = ",5.02"
  537. } else if (current_cpu == "arm64") {
  538. # Windows ARM64 requires Windows 10.
  539. subsystem_version_suffix = ",10.0"
  540. } else {
  541. # 5.01 = Windows XP.
  542. subsystem_version_suffix = ",5.01"
  543. }
  544.  
  545. config("console") {
  546. ldflags = [ "/SUBSYSTEM:CONSOLE$subsystem_version_suffix" ]
  547. }
  548. config("windowed") {
  549. ldflags = [ "/SUBSYSTEM:WINDOWS$subsystem_version_suffix" ]
  550. }
  551.  
  552. # Incremental linking ----------------------------------------------------------
  553.  
  554. # Applies incremental linking or not depending on the current configuration.
  555. config("default_incremental_linking") {
  556. # Enable incremental linking for debug builds and all component builds - any
  557. # builds where performance is not job one.
  558. # TODO(thakis): Always turn this on with lld, no reason not to.
  559. if (is_debug || is_component_build) {
  560. ldflags = [ "/INCREMENTAL" ]
  561. if (use_lld) {
  562. # lld doesn't use ilk files and doesn't really have an incremental link
  563. # mode; the only effect of the flag is that the .lib file timestamp isn't
  564. # updated if the .lib doesn't change.
  565. # TODO(thakis): Why pass /OPT:NOREF for lld, but not otherwise?
  566. # TODO(thakis): /INCREMENTAL is on by default in link.exe, but not in
  567. # lld.
  568. ldflags += [ "/OPT:NOREF" ]
  569. }
  570. } else {
  571. ldflags = [ "/INCREMENTAL:NO" ]
  572. }
  573. }
  574.  
  575. # Character set ----------------------------------------------------------------
  576.  
  577. # Not including this config means "ansi" (8-bit system codepage).
  578. config("unicode") {
  579. defines = [
  580. "_UNICODE",
  581. "UNICODE",
  582. ]
  583. }
  584.  
  585. # Lean and mean ----------------------------------------------------------------
  586.  
  587. # Some third party code might not compile with WIN32_LEAN_AND_MEAN so we have
  588. # to have a separate config for it. Remove this config from your target to
  589. # get the "bloaty and accommodating" version of windows.h.
  590. config("lean_and_mean") {
  591. defines = [ "WIN32_LEAN_AND_MEAN" ]
  592. }
  593.  
  594. # Nominmax --------------------------------------------------------------------
  595.  
  596. # Some third party code defines NOMINMAX before including windows.h, which
  597. # then causes warnings when it's been previously defined on the command line.
  598. # For such targets, this config can be removed.
  599.  
  600. config("nominmax") {
  601. defines = [ "NOMINMAX" ]
  602. }
  603.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement