Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / build / toolchain / 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 import("//build/toolchain/goma.gni")
7
8 # Should only be running on Windows.
9 assert(is_win)
10
11 # Setup the Visual Studio state.
12 #
13 # Its arguments are the VS path and the compiler wrapper tool. It will write
14 # "environment.x86" and "environment.x64" to the build directory and return a
15 # list to us.
16 gyp_win_tool_path = rebase_path("//tools/gyp/pylib/gyp/win_tool.py",
17                                 root_build_dir)
18 exec_script("setup_toolchain.py",
19             [ visual_studio_path, gyp_win_tool_path, windows_sdk_path ],
20             "string")
21
22 stamp_command = "$python_path gyp-win-tool stamp \$out"
23 copy_command = "$python_path gyp-win-tool recursive-mirror \$in \$out"
24
25 # 32-bit toolchain -------------------------------------------------------------
26
27 toolchain("32") {
28   # Make these apply to all tools below.
29   lib_prefix = ""
30   lib_dir_prefix="/LIBPATH:"
31
32   cc_command = "ninja -t msvc -e environment.x86 -- cl.exe /nologo /showIncludes /FC @\$out.rsp /c \$in /Fo\$out /Fd\$pdbname"
33   tool("cc") {
34     command = cc_command
35     description = "CC \$out"
36     rspfile = "\$out.rsp"
37     rspfile_content = "\$defines \$includes \$cflags \$cflags_c"
38     deps = "msvc"
39   }
40   tool("cxx") {
41     command = cc_command  # Same as above
42     description = "CXX \$out"
43     rspfile = "\$out.rsp"
44     rspfile_content = "\$defines \$includes \$cflags \$cflags_cc"
45     deps = "msvc"
46   }
47   tool("rc") {
48     command = "$python_path gyp-win-tool rc-wrapper environment.x86 rc.exe \$defines \$includes \$rcflags /fo\$out \$in"
49     description = "RC \$in"
50   }
51   tool("asm") {
52     command = "$python_path gyp-win-tool asm-wrapper environment.x86 ml.exe \$defines \$includes /c /Fo \$out \$in"
53     description = "ASM \$in"
54   }
55   tool("alink") {
56     command = "$python_path gyp-win-tool link-wrapper environment.x86 False lib.exe /nologo /ignore:4221 /OUT:\$out @\$out.rsp"
57     description = "LIB \$out"
58     rspfile = "\$out.rsp"
59     rspfile_content = "\$in_newline \$libflags"
60   }
61   tool("solink") {
62     command = "cmd /c $python_path gyp-win-tool link-wrapper environment.x86 False link.exe /nologo \$implibflag /DLL /OUT:\$dll /PDB:\$dll.pdb @\$dll.rsp && $python_path gyp-win-tool manifest-wrapper environment.x86 cmd /c if exist \$dll.manifest del \$dll.manifest && $python_path gyp-win-tool manifest-wrapper environment.x86 mt.exe -nologo -manifest \$manifests -out:\$dll.manifest"
63     description = "LINK(DLL) \$dll"
64     restat = "1"
65     rspfile = "\$dll.rsp"
66     rspfile_content = "\$libs \$in_newline \$ldflags"
67   }
68   tool("link") {
69     command = "cmd /c $python_path gyp-win-tool link-wrapper environment.x86 False link.exe /nologo /OUT:\$out /PDB:\$out.pdb @\$out.rsp && $python_path gyp-win-tool manifest-wrapper environment.x86 cmd /c if exist \$out.manifest del \$out.manifest && $python_path gyp-win-tool manifest-wrapper environment.x86 mt.exe -nologo -manifest \$manifests -out:\$out.manifest"
70     description = "LINK \$out"
71     rspfile = "\$out.rsp"
72     rspfile_content = "\$in_newline \$libs \$ldflags"
73   }
74   tool("stamp") {
75     command = stamp_command
76     description = "STAMP \$out"
77   }
78   tool("copy") {
79     command = copy_command
80     description = "COPY \$in \$out"
81   }
82 }
83
84 # 64-bit toolchain -------------------------------------------------------------
85
86 toolchain("64") {
87   # Make these apply to all tools below.
88   lib_prefix = ""
89   lib_dir_prefix="/LIBPATH:"
90
91   cc_command = "ninja -t msvc -e environment.x64 -- cl.exe /nologo /showIncludes /FC @\$out.rsp /c \$in /Fo\$out /Fd\$pdbname"
92   tool("cc") {
93     command = cc_command
94     description = "CC \$out"
95     rspfile = "\$out.rsp"
96     rspfile_content = "\$defines \$includes \$cflags \$cflags_c"
97     deps = "msvc"
98   }
99   tool("cxx") {
100     command = cc_command  # Same as above
101     description = "CXX \$out"
102     rspfile = "\$out.rsp"
103     rspfile_content = "\$defines \$includes \$cflags \$cflags_cc"
104     deps = "msvc"
105   }
106   tool("rc") {
107     command = "$python_path gyp-win-tool rc-wrapper environment.x64 rc.exe \$defines \$includes \$rcflags /fo\$out \$in"
108     description = "RC \$in"
109   }
110   tool("asm") {
111     command = "$python_path gyp-win-tool asm-wrapper environment.x64 ml.exe \$defines \$includes /c /Fo \$out \$in"
112     description = "ASM \$in"
113   }
114   tool("alink") {
115     command = "$python_path gyp-win-tool link-wrapper environment.x64 False lib.exe /nologo /ignore:4221 /OUT:\$out @\$out.rsp"
116     description = "LIB \$out"
117     rspfile = "\$out.rsp"
118     rspfile_content = "\$in_newline \$libflags"
119   }
120   tool("solink") {
121     command = "cmd /c $python_path gyp-win-tool link-wrapper environment.x64 False link.exe /nologo \$implibflag /DLL /OUT:\$dll /PDB:\$dll.pdb @\$dll.rsp && $python_path gyp-win-tool manifest-wrapper environment.x64 cmd /c if exist \$dll.manifest del \$dll.manifest && $python_path gyp-win-tool manifest-wrapper environment.x64 mt.exe -nologo -manifest \$manifests -out:\$dll.manifest"
122     description = "LINK(DLL) \$dll"
123     restat = "1"
124     rspfile = "\$dll.rsp"
125     rspfile_content = "\$libs \$in_newline \$ldflags"
126   }
127   tool("link") {
128     command = "cmd /c $python_path gyp-win-tool link-wrapper environment.x64 False link.exe /nologo /OUT:\$out /PDB:\$out.pdb @\$out.rsp && $python_path gyp-win-tool manifest-wrapper environment.x64 cmd /c if exist \$out.manifest del \$out.manifest && $python_path gyp-win-tool manifest-wrapper environment.x64 mt.exe -nologo -manifest \$manifests -out:\$out.manifest"
129     description = "LINK \$out"
130     rspfile = "\$out.rsp"
131     rspfile_content = "\$in_newline \$libs \$ldflags"
132   }
133   tool("stamp") {
134     command = stamp_command
135     description = "STAMP \$out"
136   }
137   tool("copy") {
138     command = copy_command
139     description = "COPY \$in \$out"
140   }
141
142   # When invoking this toolchain not as the default one, these args will be
143   # passed to the build. They are ignored when this is the default toolchain.
144   toolchain_args() {
145     cpu_arch = "x64"
146     # Normally the build config resets the CPU architecture to 32-bits. Setting
147     # this flag overrides that behavior.
148     force_win64 = true
149   }
150 }