Built UserAgent according to OS And Product.
[platform/framework/web/crosswalk-tizen.git] / toolchain.gypi
1 {
2   'variables': {
3     # Clang stuff.
4     'make_clang_dir%': 'vendor/llvm-build/Release+Asserts',
5     # Set this to true when building with Clang.
6     'clang%': 1,
7
8     'variables': {
9       # The minimum macOS SDK version to use.
10       'mac_sdk_min%': '10.10',
11
12       # Set ARM architecture version.
13       'arm_version%': 7,
14
15       # Set NEON compilation flags.
16       'arm_neon%': 1,
17
18       # Abosulte path to source root.
19       'source_root%': '<!(node <(DEPTH)/tools/atom_source_root.js)',
20     },
21
22     # Copy conditionally-set variables out one scope.
23     'mac_sdk_min%': '<(mac_sdk_min)',
24     'arm_version%': '<(arm_version)',
25     'arm_neon%': '<(arm_neon)',
26     'source_root%': '<(source_root)',
27
28     # Variables to control Link-Time Optimization (LTO).
29     'use_lto%': 0,
30     'use_lto_o2%': 0,
31
32     'conditions': [
33       # Do not use Clang on Windows.
34       ['OS=="win"', {
35         'clang%': 0,
36       }],  # OS=="win"
37
38       # Search for the available version of SDK.
39       ['OS=="mac"', {
40         'mac_sdk%': '<!(python <(DEPTH)/tools/mac/find_sdk.py <(mac_sdk_min))',
41       }],
42
43       ['OS=="linux"', {
44         'variables': {
45           # The system libdir used for this ABI.
46           'system_libdir%': 'lib',
47
48           # Setting the path to sysroot.
49           'conditions': [
50             ['target_arch=="arm"', {
51               # sysroot needs to be an absolute path otherwise it generates
52               # incorrect results when passed to pkg-config
53               'sysroot%': '<(source_root)/vendor/debian_wheezy_arm-sysroot',
54             }],
55             ['target_arch=="ia32"', {
56               'sysroot%': '<(source_root)/vendor/debian_wheezy_i386-sysroot',
57             }],
58             ['target_arch=="x64"', {
59               'sysroot%': '<(source_root)/vendor/debian_wheezy_amd64-sysroot',
60             }],
61           ],
62         },
63         # Copy conditionally-set variables out one scope.
64         'sysroot%': '<(sysroot)',
65         'system_libdir%': '<(system_libdir)',
66
67         # Redirect pkg-config to search from sysroot.
68         'pkg-config%': '<(source_root)/tools/linux/pkg-config-wrapper "<(sysroot)" "<(target_arch)" "<(system_libdir)"',
69       }],
70
71       # Set default compiler flags depending on ARM version.
72       ['arm_version==6', {
73         'arm_arch%': 'armv6',
74         'arm_tune%': '',
75         'arm_fpu%': 'vfp',
76         'arm_float_abi%': 'softfp',
77         'arm_thumb%': 0,
78       }],  # arm_version==6
79       ['arm_version==7', {
80         'arm_arch%': 'armv7-a',
81         'arm_tune%': 'generic-armv7-a',
82         'conditions': [
83           ['arm_neon==1', {
84             'arm_fpu%': 'neon',
85           }, {
86             'arm_fpu%': 'vfpv3-d16',
87           }],
88         ],
89         'arm_float_abi%': 'hard',
90         'arm_thumb%': 1,
91       }],  # arm_version==7
92     ],
93   },
94   'conditions': [
95     # Setup building with clang.
96     ['clang==1', {
97       'make_global_settings': [
98         ['CC', '<(make_clang_dir)/bin/clang'],
99         ['CXX', '<(make_clang_dir)/bin/clang++'],
100         ['CC.host', '$(CC)'],
101         ['CXX.host', '$(CXX)'],
102       ],
103       'target_defaults': {
104         'cflags_cc': [
105           '-std=c++11',
106         ],
107         'xcode_settings': {
108           'CC': '<(make_clang_dir)/bin/clang',
109           'LDPLUSPLUS': '<(make_clang_dir)/bin/clang++',
110           'OTHER_CFLAGS': [
111             '-fcolor-diagnostics',
112           ],
113
114           'GCC_C_LANGUAGE_STANDARD': 'c99',  # -std=c99
115           'CLANG_CXX_LIBRARY': 'libc++',  # -stdlib=libc++
116           'CLANG_CXX_LANGUAGE_STANDARD': 'c++11',  # -std=c++11
117         },
118         'target_conditions': [
119           ['_type in ["executable", "shared_library"]', {
120             'xcode_settings': {
121               # On some machines setting CLANG_CXX_LIBRARY doesn't work for
122               # linker.
123               'OTHER_LDFLAGS': [ '-stdlib=libc++' ],
124             },
125           }],
126         ],
127       },
128     }],  # clang==1
129
130     # Specify the SDKROOT.
131     ['OS=="mac"', {
132       'target_defaults': {
133         'xcode_settings': {
134           'SDKROOT': 'macosx<(mac_sdk)',  # -isysroot
135         },
136       },
137     }],
138
139     # Setup sysroot environment.
140     ['OS=="linux" and target_arch in ["arm", "ia32", "x64"]', {
141       'target_defaults': {
142         'target_conditions': [
143           ['_toolset=="target"', {
144             'cflags': [
145               '--sysroot=<(sysroot)',
146             ],
147             'ldflags': [
148               '--sysroot=<(sysroot)',
149               '<!(<(source_root)/tools/linux/sysroot_ld_path.sh <(sysroot))',
150             ],
151           }]
152         ],
153       },
154     }],  # sysroot
155
156     # Setup cross-compilation on Linux.
157     ['OS=="linux"', {
158       'target_defaults': {
159         'target_conditions': [
160           ['target_arch=="ia32" and _toolset=="target"', {
161             'asflags': [
162               '-32',
163             ],
164             'cflags': [
165               '-msse2',
166               '-mfpmath=sse',
167               '-mmmx',  # Allows mmintrin.h for MMX intrinsics.
168               '-m32',
169             ],
170             'ldflags': [
171               '-m32',
172             ],
173           }],  # target_arch=="ia32" and _toolset=="target"
174           ['target_arch=="x64" and _toolset=="target"', {
175             'cflags': [
176               '-m64',
177               '-march=x86-64',
178             ],
179             'ldflags': [
180               '-m64',
181             ],
182           }],  # target_arch=="x64" and _toolset=="target"
183           ['target_arch=="arm" and _toolset=="target"', {
184             'conditions': [
185               ['clang==0', {
186                 'cflags_cc': [
187                   '-Wno-abi',
188                 ],
189               }],
190               ['clang==1 and arm_arch!=""', {
191                 'cflags': [
192                   '-target arm-linux-gnueabihf',
193                 ],
194                 'ldflags': [
195                   '-target arm-linux-gnueabihf',
196                 ],
197               }],
198               ['arm_arch!=""', {
199                 'cflags': [
200                   '-march=<(arm_arch)',
201                 ],
202                 'conditions': [
203                   ['use_lto==1 or use_lto_o2==1', {
204                     'ldflags': [
205                       '-march=<(arm_arch)',
206                     ],
207                   }],
208                 ],
209               }],
210               ['arm_tune!=""', {
211                 'cflags': [
212                   '-mtune=<(arm_tune)',
213                 ],
214                 'conditions': [
215                   ['use_lto==1 or use_lto_o2==1', {
216                     'ldflags': [
217                       '-mtune=<(arm_tune)',
218                     ],
219                   }],
220                 ],
221               }],
222               ['arm_fpu!=""', {
223                 'cflags': [
224                   '-mfpu=<(arm_fpu)',
225                 ],
226                 'conditions': [
227                   ['use_lto==1 or use_lto_o2==1', {
228                     'ldflags': [
229                       '-mfpu=<(arm_fpu)',
230                     ],
231                   }],
232                 ],
233               }],
234               ['arm_float_abi!=""', {
235                 'cflags': [
236                   '-mfloat-abi=<(arm_float_abi)',
237                 ],
238                 'conditions': [
239                   ['use_lto==1 or use_lto_o2==1', {
240                     'ldflags': [
241                       '-mfloat-abi=<(arm_float_abi)',
242                     ],
243                   }],
244                 ],
245               }],
246               ['arm_thumb==1', {
247                 'cflags': [
248                   '-mthumb',
249                 ],
250                 'conditions': [
251                   ['use_lto==1 or use_lto_o2==1', {
252                     'ldflags': [
253                       '-mthumb',
254                     ],
255                   }],
256                 ],
257               }],
258             ],
259           }],  # target_arch=="arm" and _toolset=="target"
260         ],
261       },
262     }],  # OS=="linux"
263   ],
264 }