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
diff --git a/DEPS b/DEPS
index 771119a..f5dcd70 100644
--- a/DEPS
+++ b/DEPS
@@ -8,7 +8,7 @@
# 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 = [
diff --git a/gyp_skia b/gyp_skia
index ee8c17c..8554412 100755
--- a/gyp_skia
+++ b/gyp_skia
@@ -80,6 +80,14 @@
# 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()
diff --git a/make.bat b/make.bat
index 5ae7898..a2c1664 100644
--- a/make.bat
+++ b/make.bat
@@ -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
diff --git a/make.py b/make.py
index b1deaab..346dd6c 100644
--- a/make.py
+++ b/make.py
@@ -19,6 +19,9 @@
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 @@
# 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 @@
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 @@
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 @@
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'