[email protected] | 2f80c31 | 2009-02-25 21:26:55 | [diff] [blame] | 1 | # Copyright (c) 2009 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 | { |
| 6 | 'variables': { |
[email protected] | b3fb809 | 2009-03-12 19:09:24 | [diff] [blame] | 7 | # .gyp files should set chromium_code to 1 if they build Chromium-specific |
| 8 | # code, as opposed to external code. This variable is used to control |
| 9 | # such things as the set of warnings to enable, and whether warnings are |
| 10 | # treated as errors. |
[email protected] | 2f80c31 | 2009-02-25 21:26:55 | [diff] [blame] | 11 | 'chromium_code%': 0, |
[email protected] | b3fb809 | 2009-03-12 19:09:24 | [diff] [blame] | 12 | |
| 13 | # Variables expected to be overriden on the GYP command line (-D) or by |
| 14 | # ~/.gyp/include.gypi. |
| 15 | |
| 16 | # Override chromium_mac_pch and set it to 0 to suppress the use of |
| 17 | # precompiled headers on the Mac. Prefix header injection may still be |
| 18 | # used, but prefix headers will not be precompiled. This is useful when |
| 19 | # using distcc to distribute a build to compile slaves that don't |
| 20 | # share the same compiler executable as the system driving the compilation, |
| 21 | # because precompiled headers rely on pointers into a specific compiler |
| 22 | # executable's image. Setting this to 0 is needed to use an experimental |
| 23 | # Linux-Mac cross compiler distcc farm. |
| 24 | 'chromium_mac_pch%': 1, |
| 25 | |
| 26 | # Override branding to select the desired branding flavor. |
[email protected] | 32aa8cc | 2009-03-04 21:36:39 | [diff] [blame] | 27 | 'branding%': 'Chromium', |
[email protected] | 2f80c31 | 2009-02-25 21:26:55 | [diff] [blame] | 28 | }, |
| 29 | 'target_defaults': { |
[email protected] | 32aa8cc | 2009-03-04 21:36:39 | [diff] [blame] | 30 | 'conditions': [ |
| 31 | ['branding=="Chrome"', { |
| 32 | 'defines': ['GOOGLE_CHROME_BUILD'], |
| 33 | }, { # else: branding!="Chrome" |
| 34 | 'defines': ['CHROMIUM_BUILD'], |
| 35 | }], |
| 36 | ], |
[email protected] | 2f80c31 | 2009-02-25 21:26:55 | [diff] [blame] | 37 | 'default_configuration': 'Debug', |
| 38 | 'configurations': { |
| 39 | 'Debug': { |
| 40 | 'conditions': [ |
| 41 | [ 'OS=="mac"', { |
| 42 | 'xcode_settings': { |
| 43 | 'COPY_PHASE_STRIP': 'NO', |
| 44 | 'GCC_OPTIMIZATION_LEVEL': '0', |
| 45 | } |
| 46 | }], |
| 47 | [ 'OS=="win"', { |
| 48 | 'configuration_platform': 'Win32', |
| 49 | 'msvs_configuration_attributes': { |
| 50 | 'OutputDirectory': '$(SolutionDir)$(ConfigurationName)', |
| 51 | 'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)', |
| 52 | 'CharacterSet': '1', |
| 53 | }, |
| 54 | 'msvs_settings': { |
| 55 | 'VCCLCompilerTool': { |
| 56 | 'Optimization': '0', |
| 57 | 'PreprocessorDefinitions': ['_DEBUG'], |
| 58 | 'BasicRuntimeChecks': '3', |
| 59 | 'RuntimeLibrary': '1', |
| 60 | }, |
| 61 | 'VCLinkerTool': { |
| 62 | 'LinkIncremental': '1', |
| 63 | }, |
| 64 | 'VCResourceCompilerTool': { |
| 65 | 'PreprocessorDefinitions': ['_DEBUG'], |
| 66 | }, |
| 67 | }, |
| 68 | }], |
| 69 | ], |
| 70 | }, |
| 71 | 'Release': { |
| 72 | 'defines': [ |
| 73 | 'NDEBUG', |
| 74 | ], |
| 75 | 'conditions': [ |
| 76 | [ 'OS=="mac"', { |
| 77 | 'xcode_settings': { |
| 78 | 'DEAD_CODE_STRIPPING': 'YES', |
| 79 | } |
| 80 | }], |
| 81 | [ 'OS=="win"', { |
| 82 | 'configuration_platform': 'Win32', |
| 83 | 'msvs_props': ['release.vsprops'], |
| 84 | }], |
| 85 | ], |
| 86 | }, |
| 87 | }, |
| 88 | }, |
| 89 | 'conditions': [ |
[email protected] | 9d38403 | 2009-03-20 23:13:26 | [diff] [blame] | 90 | [ 'OS=="linux"', { |
| 91 | 'target_defaults': { |
| 92 | 'asflags': [ |
| 93 | # Needed so that libs with .s files (e.g. libicudata.a) |
| 94 | # are compatible with the general 32-bit-ness. |
| 95 | '-32', |
| 96 | ], |
| 97 | # All floating-point computations on x87 happens in 80-bit |
| 98 | # precision. Because the C and C++ language standards allow |
| 99 | # the compiler to keep the floating-point values in higher |
| 100 | # precision than what's specified in the source and doing so |
| 101 | # is more efficient than constantly rounding up to 64-bit or |
| 102 | # 32-bit precision as specified in the source, the compiler, |
| 103 | # especially in the optimized mode, tries very hard to keep |
| 104 | # values in x87 floating-point stack (in 80-bit precision) |
| 105 | # as long as possible. This has important side effects, that |
| 106 | # the real value used in computation may change depending on |
| 107 | # how the compiler did the optimization - that is, the value |
| 108 | # kept in 80-bit is different than the value rounded down to |
| 109 | # 64-bit or 32-bit. There are possible compiler options to make |
| 110 | # this behavior consistent (e.g. -ffloat-store would keep all |
| 111 | # floating-values in the memory, thus force them to be rounded |
| 112 | # to its original precision) but they have significant runtime |
| 113 | # performance penalty. |
| 114 | # |
| 115 | # -mfpmath=sse -msse2 makes the compiler use SSE instructions |
| 116 | # which keep floating-point values in SSE registers in its |
| 117 | # native precision (32-bit for single precision, and 64-bit for |
| 118 | # double precision values). This means the floating-point value |
| 119 | # used during computation does not change depending on how the |
| 120 | # compiler optimized the code, since the value is always kept |
| 121 | # in its specified precision. |
| 122 | 'cflags': [ |
| 123 | '-m32', |
| 124 | '-pthread', |
| 125 | '-march=pentium4', |
| 126 | '-fno-exceptions', |
| 127 | '-msse2', |
| 128 | '-mfpmath=sse', |
| 129 | ], |
| 130 | 'linkflags': [ |
| 131 | '-m32', |
| 132 | '-pthread', |
| 133 | ], |
[email protected] | b5e46b9 | 2009-03-26 18:58:10 | [diff] [blame] | 134 | 'scons_variable_settings': { |
| 135 | 'LIBPATH': ['$LIB_DIR'], |
[email protected] | 9d38403 | 2009-03-20 23:13:26 | [diff] [blame] | 136 | # Linking of large files uses lots of RAM, so serialize links |
| 137 | # using the handy flock command from util-linux. |
[email protected] | c13fcbd | 2009-03-27 04:27:01 | [diff] [blame] | 138 | 'FLOCK_LINK': ['flock', '$TOP_BUILDDIR/linker.lock', '$LINK'], |
[email protected] | 9d38403 | 2009-03-20 23:13:26 | [diff] [blame] | 139 | |
| 140 | # We have several cases where archives depend on each other in |
| 141 | # a cyclic fashion. Since the GNU linker does only a single |
| 142 | # pass over the archives we surround the libraries with |
| 143 | # --start-group and --end-group (aka -( and -) ). That causes |
| 144 | # ld to loop over the group until no more undefined symbols |
| 145 | # are found. In an ideal world we would only make groups from |
| 146 | # those libraries which we knew to be in cycles. However, |
| 147 | # that's tough with SCons, so we bodge it by making all the |
| 148 | # archives a group by redefining the linking command here. |
| 149 | # |
| 150 | # TODO: investigate whether we still have cycles that |
| 151 | # require --{start,end}-group. There has been a lot of |
| 152 | # refactoring since this was first coded, which might have |
| 153 | # eliminated the circular dependencies. |
| 154 | 'LINKCOM': [['$FLOCK_LINK', '-o', '$TARGET', '$LINKFLAGS', '$SOURCES', '$_LIBDIRFLAGS', '-Wl,--start-group', '$_LIBFLAGS', '-Wl,--end-group']], |
[email protected] | 9e20ae0 | 2009-03-24 02:40:14 | [diff] [blame] | 155 | 'SHLINKCOM': [['$FLOCK_LINK', '-o', '$TARGET', '$SHLINFLAGS', '$SOURCES', '$_LIBDIRFLAGS', '-Wl,--start-group', '$_LIBFLAGS', '-Wl,--end-group']], |
[email protected] | 9d38403 | 2009-03-20 23:13:26 | [diff] [blame] | 156 | 'IMPLICIT_COMMAND_DEPENDENCIES': 0, |
| 157 | }, |
[email protected] | b5e46b9 | 2009-03-26 18:58:10 | [diff] [blame] | 158 | 'scons_import_variables': [ |
| 159 | 'CC', |
| 160 | 'CXX', |
| 161 | 'LINK', |
| 162 | ], |
| 163 | 'scons_propagate_variables': [ |
| 164 | 'CC', |
| 165 | 'CCACHE_DIR', |
| 166 | 'CXX', |
| 167 | 'DISTCC_DIR', |
| 168 | 'DISTCC_HOSTS', |
| 169 | 'HOME', |
| 170 | 'LINK', |
| 171 | ], |
[email protected] | 3aacaf95 | 2009-04-02 15:34:09 | [diff] [blame^] | 172 | 'configurations': { |
| 173 | 'Debug': { |
| 174 | 'defines': [ |
| 175 | '_DEBUG', |
| 176 | ], |
| 177 | 'cflags': [ |
| 178 | '-O0', |
| 179 | '-g', |
| 180 | ], |
| 181 | }, |
| 182 | 'Release': { |
| 183 | 'cflags': [ |
| 184 | '-O2', |
| 185 | ], |
| 186 | }, |
| 187 | }, |
[email protected] | 9d38403 | 2009-03-20 23:13:26 | [diff] [blame] | 188 | }, |
| 189 | }], |
[email protected] | 2f80c31 | 2009-02-25 21:26:55 | [diff] [blame] | 190 | ['OS=="mac"', { |
| 191 | 'target_defaults': { |
[email protected] | d92c7c01 | 2009-03-19 19:26:42 | [diff] [blame] | 192 | 'mac_bundle': 0, |
[email protected] | 2f80c31 | 2009-02-25 21:26:55 | [diff] [blame] | 193 | 'xcode_settings': { |
| 194 | 'ALWAYS_SEARCH_USER_PATHS': 'NO', |
| 195 | 'GCC_C_LANGUAGE_STANDARD': 'c99', |
| 196 | 'GCC_CW_ASM_SYNTAX': 'NO', |
| 197 | 'GCC_DYNAMIC_NO_PIC': 'YES', |
| 198 | 'GCC_ENABLE_PASCAL_STRINGS': 'NO', |
| 199 | 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES', |
[email protected] | 2f80c31 | 2009-02-25 21:26:55 | [diff] [blame] | 200 | 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', |
| 201 | 'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES', |
| 202 | 'GCC_VERSION': '4.2', |
| 203 | 'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES', |
| 204 | 'MACOSX_DEPLOYMENT_TARGET': '10.5', |
| 205 | 'PREBINDING': 'NO', |
| 206 | 'SDKROOT': 'macosx10.5', |
| 207 | 'USE_HEADERMAP': 'NO', |
| 208 | 'WARNING_CFLAGS': ['-Wall', '-Wendif-labels'], |
[email protected] | b3fb809 | 2009-03-12 19:09:24 | [diff] [blame] | 209 | 'conditions': [ |
| 210 | ['chromium_mac_pch', {'GCC_PRECOMPILE_PREFIX_HEADER': 'YES'}, |
| 211 | {'GCC_PRECOMPILE_PREFIX_HEADER': 'NO'}], |
| 212 | ], |
[email protected] | 2f80c31 | 2009-02-25 21:26:55 | [diff] [blame] | 213 | }, |
| 214 | 'target_conditions': [ |
[email protected] | 0e1b3fb | 2009-03-24 20:38:33 | [diff] [blame] | 215 | ['_type=="shared_library" or _type=="loadable_module"', { |
[email protected] | 2f80c31 | 2009-02-25 21:26:55 | [diff] [blame] | 216 | 'xcode_settings': {'GCC_DYNAMIC_NO_PIC': 'NO'}, |
| 217 | }], |
| 218 | ['_type!="static_library"', { |
| 219 | 'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']}, |
| 220 | }], |
[email protected] | dfa5c66 | 2009-03-20 17:55:26 | [diff] [blame] | 221 | ['_mac_bundle', { |
[email protected] | 87fde4a | 2009-02-28 00:50:08 | [diff] [blame] | 222 | 'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-ObjC']}, |
| 223 | }], |
[email protected] | d92c7c01 | 2009-03-19 19:26:42 | [diff] [blame] | 224 | ['_type=="executable"', { |
[email protected] | 2f80c31 | 2009-02-25 21:26:55 | [diff] [blame] | 225 | 'postbuilds': [ |
| 226 | { |
| 227 | 'variables': { |
| 228 | # Define strip_from_xcode in a variable ending in _path so |
| 229 | # that gyp understands it's a path and performs proper |
| 230 | # relativization during dict merging. |
| 231 | 'strip_from_xcode_path': 'mac/strip_from_xcode', |
| 232 | }, |
| 233 | 'postbuild_name': 'Strip If Needed', |
| 234 | 'action': ['<(strip_from_xcode_path)'], |
| 235 | }, |
| 236 | ], |
| 237 | }], |
| 238 | ], |
| 239 | }, |
| 240 | }], |
| 241 | ['OS=="win"', { |
| 242 | 'target_defaults': { |
| 243 | 'defines': [ |
| 244 | '_WIN32_WINNT=0x0600', |
| 245 | 'WINVER=0x0600', |
| 246 | 'WIN32', |
| 247 | '_WINDOWS', |
| 248 | '_HAS_EXCEPTIONS=0', |
| 249 | 'NOMINMAX', |
| 250 | '_CRT_RAND_S', |
| 251 | 'CERT_CHAIN_PARA_HAS_EXTRA_FIELDS', |
| 252 | 'WIN32_LEAN_AND_MEAN', |
| 253 | '_SECURE_ATL', |
| 254 | '_HAS_TR1=0', |
| 255 | ], |
| 256 | 'include_dirs': [ |
| 257 | '<(DEPTH)/third_party/platformsdk_win2008_6_1/files/Include', |
| 258 | '$(VSInstallDir)/VC/atlmfc/include', |
| 259 | ], |
| 260 | 'msvs_cygwin_dirs': ['../third_party/cygwin'], |
| 261 | 'msvs_disabled_warnings': [4503, 4819], |
| 262 | 'msvs_settings': { |
| 263 | 'VCCLCompilerTool': { |
| 264 | 'MinimalRebuild': 'false', |
| 265 | 'ExceptionHandling': '0', |
| 266 | 'BufferSecurityCheck': 'true', |
| 267 | 'EnableFunctionLevelLinking': 'true', |
| 268 | 'RuntimeTypeInfo': 'false', |
| 269 | 'WarningLevel': '3', |
| 270 | 'WarnAsError': 'true', |
| 271 | 'DebugInformationFormat': '3', |
| 272 | }, |
| 273 | 'VCLibrarianTool': { |
| 274 | 'AdditionalOptions': '/ignore:4221', |
| 275 | 'OutputFile': '$(OutDir)\\lib\\$(ProjectName).lib', |
| 276 | 'AdditionalLibraryDirectories': |
| 277 | '<(DEPTH)/third_party/platformsdk_win2008_6_1/files/Lib', |
| 278 | }, |
| 279 | 'VCLinkerTool': { |
| 280 | 'AdditionalOptions': |
| 281 | '/safeseh /dynamicbase /ignore:4199 /ignore:4221 /nxcompat', |
| 282 | 'AdditionalDependencies': [ |
| 283 | 'wininet.lib', |
| 284 | 'version.lib', |
| 285 | 'msimg32.lib', |
| 286 | 'ws2_32.lib', |
| 287 | 'usp10.lib', |
| 288 | 'psapi.lib', |
| 289 | ], |
| 290 | 'AdditionalLibraryDirectories': |
| 291 | '<(DEPTH)/third_party/platformsdk_win2008_6_1/files/Lib', |
| 292 | 'DelayLoadDLLs': 'dwmapi.dll,uxtheme.dll', |
| 293 | 'GenerateDebugInformation': 'true', |
| 294 | 'MapFileName': '$(OutDir)\\$(TargetName).map', |
| 295 | 'ImportLibrary': '$(OutDir)\\lib\\$(TargetName).lib', |
| 296 | 'TargetMachine': '1', |
| 297 | 'FixedBaseAddress': '1', |
| 298 | }, |
| 299 | 'VCMIDLTool': { |
| 300 | 'GenerateStublessProxies': 'true', |
| 301 | 'TypeLibraryName': '$(InputName).tlb', |
| 302 | 'OutputDirectory': '$(IntDir)', |
| 303 | 'HeaderFileName': '$(InputName).h', |
| 304 | 'DLLDataFileName': 'dlldata.c', |
| 305 | 'InterfaceIdentifierFileName': '$(InputName)_i.c', |
| 306 | 'ProxyFileName': '$(InputName)_p.c', |
| 307 | }, |
| 308 | 'VCResourceCompilerTool': { |
| 309 | 'Culture' : '1033', |
[email protected] | 245b3cd59 | 2009-03-31 01:12:14 | [diff] [blame] | 310 | 'AdditionalIncludeDirectories': ['<(DEPTH)'], |
[email protected] | 2f80c31 | 2009-02-25 21:26:55 | [diff] [blame] | 311 | }, |
| 312 | }, |
| 313 | }, |
| 314 | }], |
| 315 | ['chromium_code==0', { |
| 316 | # This section must follow the other conditon sections above because |
| 317 | # external_code.gypi expects to be merged into those settings. |
| 318 | 'includes': [ |
| 319 | 'external_code.gypi', |
| 320 | ], |
| 321 | }], |
| 322 | ], |
[email protected] | c13fcbd | 2009-03-27 04:27:01 | [diff] [blame] | 323 | 'scons_settings': { |
| 324 | 'sconsbuild_dir': '<(DEPTH)/sconsbuild', |
| 325 | }, |
[email protected] | 2f80c31 | 2009-02-25 21:26:55 | [diff] [blame] | 326 | 'xcode_settings': { |
| 327 | # The Xcode generator will look for an xcode_settings section at the root |
| 328 | # of each dict and use it to apply settings on a file-wide basis. Most |
| 329 | # settings should not be here, they should be in target-specific |
| 330 | # xcode_settings sections, or better yet, should use non-Xcode-specific |
| 331 | # settings in target dicts. SYMROOT is a special case, because many other |
| 332 | # Xcode variables depend on it, including variables such as |
| 333 | # PROJECT_DERIVED_FILE_DIR. When a source group corresponding to something |
| 334 | # like PROJECT_DERIVED_FILE_DIR is added to a project, in order for the |
| 335 | # files to appear (when present) in the UI as actual files and not red |
| 336 | # red "missing file" proxies, the correct path to PROJECT_DERIVED_FILE_DIR, |
| 337 | # and therefore SYMROOT, needs to be set at the project level. |
[email protected] | bfa24b96 | 2009-03-02 00:16:16 | [diff] [blame] | 338 | 'SYMROOT': '<(DEPTH)/xcodebuild', |
[email protected] | 2f80c31 | 2009-02-25 21:26:55 | [diff] [blame] | 339 | }, |
| 340 | } |