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