blob: 87e3ea8680f0778afa37fb4143b9143751441a85 [file] [log] [blame]
[email protected]9372bec2014-08-14 14:03:301# Copyright 2014 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"""
6Sets up various automatic gyp environment variables. These are used by
7gyp_chromium and landmines.py which run at different stages of runhooks. To
8make sure settings are consistent between them, all setup should happen here.
9"""
10
11import gyp_helper
justincohene0f8ddf2016-03-28 15:48:0912import mac_toolchain
[email protected]9372bec2014-08-14 14:03:3013import os
14import sys
15import vs_toolchain
16
17def SetEnvironment():
18 """Sets defaults for GYP_* variables."""
19 gyp_helper.apply_chromium_gyp_env()
20
21 # Default to ninja on linux and windows, but only if no generator has
22 # explicitly been set.
23 # Also default to ninja on mac, but only when not building chrome/ios.
24 # . -f / --format has precedence over the env var, no need to check for it
25 # . set the env var only if it hasn't been set yet
26 # . chromium.gyp_env has been applied to os.environ at this point already
thakisf588eed2016-06-08 19:46:3827 if sys.platform.startswith(('linux', 'win', 'freebsd', 'darwin')) and \
[email protected]9372bec2014-08-14 14:03:3028 not os.environ.get('GYP_GENERATORS'):
29 os.environ['GYP_GENERATORS'] = 'ninja'
[email protected]9372bec2014-08-14 14:03:3030
31 vs_toolchain.SetEnvironmentAndGetRuntimeDllDirs()
justincohene47e4cb2016-03-30 22:08:0532 mac_toolchain.SetToolchainEnvironment()