Files
sdk/tools/generate_projects.py
T
jackpal@google.com d51cff04c0 Update gyp, keep VS 2008 default for Windows builds.
Use the environment variable GYP_MSVS_VERSION to override
the default.

all.deps/DEPS now calls tools/gyp_dart.py to generate
the build files. (Previously it called gyp directly.)

tools/gyp_dart.py adds the logic to make VS 2008 the
default build file format on Win32 systems.

The same logic was added to tools/generate_projects.py
which is called by all-deps/DEPS to generate build files
for dart vm sub-projects. These sub-project build files
aren't used in official builds, but apparenlty are used
by some engineers. I don't know how many of those engineers
are building on Windows, but we might as well keep the
two build systems compatible.
Review URL: https://chromiumcodereview.appspot.com//10836101

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10299 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-06 18:56:48 +00:00

84 lines
2.8 KiB
Python
Executable File

#!/usr/bin/env python
#
# Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
import os
import sys
import platform
def NormJoin(path1, path2):
return os.path.normpath(os.path.join(path1, path2))
def GetProjectGypFile(project_name):
project_file = os.path.join(project_name, 'dart-%s.gyp' % project_name)
if not os.path.exists(project_file):
sys.stderr.write('%s does not exist\n' % project_file)
project_file = os.path.join(project_name, 'dart.gyp')
return project_file
dart_src = NormJoin(os.path.dirname(sys.argv[0]), os.pardir)
project_src = sys.argv[1]
gyp_pylib = os.path.join(dart_src, 'third_party', 'gyp', 'pylib')
if __name__ == '__main__':
# If this script is invoked with the -fmake option, we assume that
# it is being run automatically via a project Makefile. That can be
# problematic (because GYP is really bad at setting up the paths
# correctly), so we try to run "gclient runhooks" instead.
if '-fmake' in sys.argv:
try:
sys.exit(os.execvp("gclient", ["gclient", "runhooks"]))
except OSError:
# Sometimes gclient is not on the PATH. Let the user know that
# he must run "gclient runhooks" manually.
sys.stderr.write('Error: GYP files are out of date.\n')
sys.stderr.write('\n\n*** Please run "gclient runhooks" ***\n\n\n')
sys.exit(1)
# Add gyp to the imports and if needed get it from the third_party location
# inside the standalone dart gclient checkout.
try:
import gyp
except ImportError, e:
sys.path.append(os.path.abspath(gyp_pylib))
import gyp
if __name__ == '__main__':
# Make our own location absolute as it is stored in Makefiles.
sys.argv[0] = os.path.abspath(sys.argv[0])
# Add any extra arguments. Needed by compiler/dart.gyp to build v8.
args = sys.argv[2:]
args += ['--depth', project_src]
args += ['-I', './tools/gyp/common.gypi']
if platform.system() == 'Linux':
# We need to fiddle with toplevel-dir to work around a GYP bug
# that breaks building v8 from compiler/dart.gyp.
args += ['--toplevel-dir', os.curdir]
args += ['--generator-output', project_src]
else:
# On at least the Mac, the toplevel-dir should be where the
# sources are. Otherwise, Xcode won't show sources correctly.
args += ['--toplevel-dir', project_src]
if sys.platform == 'win32':
# Generate Visual Studio 2008 compatible files by default.
if not os.environ.get('GYP_MSVS_VERSION'):
args.extend(['-G', 'msvs_version=2008'])
# Change into the dart directory as we want the project to be rooted here.
# Also, GYP is very sensitive to exacly from where it is being run.
os.chdir(dart_src)
args += [GetProjectGypFile(project_src)]
# Generate the projects.
sys.exit(gyp.main(args))