Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / build / config / win / BUILD.gn
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
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/win/visual_studio_version.gni")
6
7 declare_args() {
8   # Full path to the Windows SDK, not including a backslash at the end.
9   # This value is the default location, override if you have a different
10   # installation location.
11   windows_sdk_path = "C:\Program Files (x86)\Windows Kits\8.0"
12 }
13
14 # Compiler setup for the Windows SDK. Applied to all targets.
15 config("sdk") {
16   # The include path is the stuff returned by the script.
17   #include_dirs = msvc_config[0]  TODO(brettw) make this work.
18
19   defines = [
20     "_ATL_NO_OPENGL",
21     "_SECURE_ATL",
22     "_WIN32_WINNT=0x0602",
23     "_WINDOWS",
24     "CERT_CHAIN_PARA_HAS_EXTRA_FIELDS",
25     "NOMINMAX",
26     "NTDDI_VERSION=0x06020000",
27     "PSAPI_VERSION=1",
28     "WIN32",
29     "WIN32_LEAN_AND_MEAN",
30     "WINVER=0x0602",
31   ]
32
33   # The Windows SDK include directories must be first. They both have a sal.h,
34   # and the SDK one is newer and the SDK uses some newer features from it not
35   # present in the Visual Studio one.
36   include_dirs = [
37     "$windows_sdk_path\Include\shared",
38     "$windows_sdk_path\Include\um",
39     "$windows_sdk_path\Include\winrt",
40     "$visual_studio_path\VC\include",
41     "$visual_studio_path\VC\atlmfc\include",
42   ]
43 }
44
45 # Linker flags for Windows SDK setup, this is applied only to EXEs and DLLs.
46 config("sdk_link") {
47   if (cpu_arch == "x64") {
48     ldflags = [ "/MACHINE:X64" ]
49     lib_dirs = [
50       "$windows_sdk_path\Lib\win8\um\x64",
51       "$visual_studio_path\VC\lib\amd64",
52       "$visual_studio_path\VC\atlmfc\lib\amd64",
53     ]
54   } else {
55     ldflags = [
56       "/MACHINE:X86",
57       "/SAFESEH",  # Not compatible with x64 so use only for x86.
58     ]
59     lib_dirs = [
60       "$windows_sdk_path\Lib\win8\um\x86",
61       "$visual_studio_path\VC\lib",
62       "$visual_studio_path\VC\atlmfc\lib",
63     ]
64     if (!is_asan) {
65       ldflags += [ "/largeaddressaware" ]
66     }
67   }
68 }
69
70 # This default linker setup is provided separately from the SDK setup so
71 # targets who want different library configurations can remove this and specify
72 # their own.
73 config("common_linker_setup") {
74   ldflags = [
75     "/FIXED:NO",
76     "/ignore:4199",
77     "/ignore:4221",
78     "/NXCOMPAT",
79   ]
80
81   # ASLR makes debugging with windbg difficult because Chrome.exe and
82   # Chrome.dll share the same base name. As result, windbg will name the
83   # Chrome.dll module like chrome_<base address>, where <base address>
84   # typically changes with each launch. This in turn means that breakpoints in
85   # Chrome.dll don't stick from one launch to the next. For this reason, we
86   # turn ASLR off in debug builds.
87   if (is_debug) {
88     ldflags += [ "/DYNAMICBASE:NO" ]
89   } else {
90     ldflags += [ "/DYNAMICBASE" ]
91   }
92
93   # Delay loaded DLLs.
94   ldflags += [
95     "/DELAYLOAD:dbghelp.dll",
96     "/DELAYLOAD:dwmapi.dll",
97     "/DELAYLOAD:shell32.dll",
98     "/DELAYLOAD:uxtheme.dll",
99   ]
100 }
101
102 # Subsystem --------------------------------------------------------------------
103
104 config("console") {
105   ldflags = [ "/SUBSYSTEM:CONSOLE" ]
106 }
107 config("windowed") {
108   ldflags = [ "/SUBSYSTEM:WINDOWS" ]
109 }
110
111 # Incremental linking ----------------------------------------------------------
112
113 config("incremental_linking") {
114   ldflags = [ "/INCREMENTAL" ]
115 }
116 config("no_incremental_linking") {
117   ldflags = [ "/INCREMENTAL:NO" ]
118 }