enable "make XXX" command-line builds on Windows

http://codereview.appspot.com/4717044/



git-svn-id: http://skia.googlecode.com/svn/trunk@1853 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
epoger@google.com 2011-07-13 21:30:14 +00:00
parent ba7983e55c
commit 0fb2125814
4 changed files with 39 additions and 11 deletions

2
DEPS
View File

@ -8,7 +8,7 @@ use_relative_paths = True
# See third_party/externals/README
#
deps = {
"third_party/externals/gyp" : "http://gyp.googlecode.com/svn/trunk@907",
"third_party/externals/gyp" : "http://gyp.googlecode.com/svn/trunk@940",
}
#hooks = [

View File

@ -80,6 +80,14 @@ if __name__ == '__main__':
# Tell make to write its output into the same dir
args.extend(['-Goutput_dir=.'])
# Special arguments for generating Visual Studio projects:
# - msvs_version forces generation of Visual Studio 2010 project so that we
# can use msbuild.exe
# - msvs_abspath_output is a workaround for
# http://code.google.com/p/gyp/issues/detail?id=201
args.extend(['-Gmsvs_version=2010'])
args.extend(['-Gmsvs_abspath_output'])
print 'Updating projects from gyp files...'
sys.stdout.flush()

View File

@ -15,9 +15,6 @@
@rem Launches make.py on Windows, after setting Visual Studio environment variables.
@rem See http://code.google.com/p/skia/wiki/GettingStartedOnWindows
@rem Force gyp to generate .vcxproj files, as needed for msbuild.exe
set GYP_MSVS_VERSION=2010
@if "%DevEnvDir%"=="" goto setup_env_vars
:run_python

37
make.py
View File

@ -19,6 +19,9 @@ import os
import shutil
import sys
# TODO(epoger): allow caller to override BUILDTYPE
BUILDTYPE = 'Debug'
# TODO(epoger): add special 'all' target
TARGET_CLEAN = 'clean'
@ -30,8 +33,8 @@ GYP_SUBDIR = 'gyp'
# Simple functions that report what they are doing, and exit(1) on failure.
def cd(path):
print '> cd %s' % path
if not os.path.exists(path):
print 'path %s does not exist' % path
if not os.path.isdir(path):
print 'directory %s does not exist' % path
sys.exit(1)
os.chdir(path)
@ -39,6 +42,11 @@ def rmtree(path):
print '> rmtree %s' % path
shutil.rmtree(path, ignore_errors=True)
def mkdirs(path):
print '> mkdirs %s' % path
if not os.path.isdir(path):
os.makedirs(path)
def runcommand(command):
print '> %s' % command
if os.system(command):
@ -92,21 +100,32 @@ def MakeWindows(args):
args: command line arguments as a list of strings
"""
CheckWindowsEnvironment()
# TODO(epoger): what about parameters? (fixed vs float, debug vs release)
# TODO(epoger): what about fixed vs float?
# TODO(epoger): what about "make" flags (like -j) that Windows doesn't support?
# Run gyp_skia to prepare Visual Studio projects.
cd(SCRIPT_DIR)
runcommand('python gyp_skia')
# Prepare final output dir into which we will copy all binaries.
msbuild_working_dir = os.path.join(SCRIPT_DIR, OUT_SUBDIR, GYP_SUBDIR)
msbuild_output_dir = os.path.join(msbuild_working_dir, BUILDTYPE)
final_output_dir = os.path.join(SCRIPT_DIR, OUT_SUBDIR, BUILDTYPE)
mkdirs(final_output_dir)
for target in args:
# Check for special-case targets
if target == TARGET_CLEAN:
MakeClean()
else:
cd(os.path.join(SCRIPT_DIR, OUT_SUBDIR, GYP_SUBDIR))
runcommand('msbuild /target:%s %s.sln' % (target, target))
cd(msbuild_working_dir)
runcommand(
('msbuild /nologo /property:Configuration=%s'
' /target:%s /verbosity:minimal %s.sln') % (
BUILDTYPE, target, target))
runcommand('xcopy /y %s\* %s' % (
msbuild_output_dir, final_output_dir))
# main:
# dispatch to appropriate Make<Platform>() variant.
@ -118,6 +137,10 @@ elif os.name == 'posix':
print 'Mac developers should not run this script; see ' \
'http://code.google.com/p/skia/wiki/GettingStartedOnMac'
sys.exit(1)
elif sys.platform == 'cygwin':
print 'Windows development on Cygwin is not currently supported; see ' \
'http://code.google.com/p/skia/wiki/GettingStartedOnWindows'
sys.exit(1)
else:
print 'Unix developers should not run this script; see ' \
'http://code.google.com/p/skia/wiki/GettingStartedOnLinux'