gyp_environment.py 1.1 KB

123456789101112131415161718192021222324252627
  1. # 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. Sets up various automatic gyp environment variables. These are used by
  6. gyp_chromium and landmines.py which run at different stages of runhooks. To
  7. make sure settings are consistent between them, all setup should happen here.
  8. """
  9. import os
  10. import sys
  11. import vs_toolchain
  12. def SetEnvironment():
  13. """Sets defaults for GYP_* variables."""
  14. # Default to ninja on linux and windows, but only if no generator has
  15. # explicitly been set.
  16. # Also default to ninja on mac, but only when not building chrome/ios.
  17. # . -f / --format has precedence over the env var, no need to check for it
  18. # . set the env var only if it hasn't been set yet
  19. # . chromium.gyp_env has been applied to os.environ at this point already
  20. if sys.platform.startswith(('linux', 'win', 'freebsd', 'darwin')) and \
  21. not os.environ.get('GYP_GENERATORS'):
  22. os.environ['GYP_GENERATORS'] = 'ninja'
  23. vs_toolchain.SetEnvironmentAndGetRuntimeDllDirs()