aboutsummaryrefslogtreecommitdiff
path: root/make.py
diff options
context:
space:
mode:
authorepoger@google.com <epoger@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-07-15 13:23:22 +0000
committerepoger@google.com <epoger@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-07-15 13:23:22 +0000
commit7815e73c65a12541c31bd2e630a2d6549744181c (patch)
tree3ac028d46913b25d7a415784264a0035a9afb0c9 /make.py
parent39b6efa1b257870bc10bfb616c606b76f292ce04 (diff)
downloadskia-7815e73c65a12541c31bd2e630a2d6549744181c.tar.gz
Implement remaining options in Windows command-line build
(float vs fixed, Debug vs Release, "all" target, etc.) Review URL: http://codereview.appspot.com/4740041 git-svn-id: http://skia.googlecode.com/svn/trunk@1868 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'make.py')
-rw-r--r--make.py109
1 files changed, 70 insertions, 39 deletions
diff --git a/make.py b/make.py
index 346dd6c92..fd05a8245 100644
--- a/make.py
+++ b/make.py
@@ -14,16 +14,24 @@
# "Makefile" replacement to build skia for Windows.
# More info at http://code.google.com/p/skia/wiki/DocRoot
+#
+# Some usage examples:
+# make clean
+# make tests
+# make bench BUILDTYPE=Release
+# make gm GYP_DEFINES=skia_scalar=fixed BUILDTYPE=Release
+# make all
import os
import shutil
import sys
-# TODO(epoger): allow caller to override BUILDTYPE
BUILDTYPE = 'Debug'
-# TODO(epoger): add special 'all' target
+# special targets
+TARGET_ALL = 'all'
TARGET_CLEAN = 'clean'
+LIST_OF_ALL_TARGETS = ['SampleApp', 'bench', 'gm', 'tests', 'tools']
SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__))
OUT_SUBDIR = 'out'
@@ -93,17 +101,14 @@ def CheckWindowsEnvironment():
sys.exit(1)
-def MakeWindows(args):
+def MakeWindows(targets):
"""For Windows: build as appropriate for the command line arguments.
parameters:
- args: command line arguments as a list of strings
+ targets: build targets as a list of strings
"""
CheckWindowsEnvironment()
- # 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')
@@ -114,41 +119,67 @@ def MakeWindows(args):
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:
+ for target in targets:
+ 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))
+
+
+def Make(args):
+ """Main function.
+
+ parameters:
+ args: command line arguments as a list of strings
+ """
+ # handle any variable-setting parameters or special targets
+ global BUILDTYPE
+ targets = []
+ for arg in args:
+ if arg == TARGET_ALL:
+ targets.extend(LIST_OF_ALL_TARGETS)
+ elif arg == TARGET_CLEAN:
MakeClean()
+ elif arg.startswith('BUILDTYPE='):
+ BUILDTYPE = arg[10:]
+ elif arg.startswith('GYP_DEFINES='):
+ os.environ['GYP_DEFINES'] = arg[12:]
else:
- 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.
-if os.name == 'nt':
- MakeWindows(sys.argv[1:])
- sys.exit(0)
-elif os.name == 'posix':
- if sys.platform == 'darwin':
- 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)
+ targets.append(arg)
+
+ # if there are no remaining targets, we're done
+ if not targets:
+ sys.exit(0)
+
+ # dispatch to appropriate Make<Platform>() variant.
+ if os.name == 'nt':
+ MakeWindows(targets)
+ sys.exit(0)
+ elif os.name == 'posix':
+ if sys.platform == 'darwin':
+ 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'
+ sys.exit(1)
else:
- print 'Unix developers should not run this script; see ' \
- 'http://code.google.com/p/skia/wiki/GettingStartedOnLinux'
+ print 'unknown platform (os.name=%s, sys.platform=%s); see %s' % (
+ os.name, sys.platform, 'http://code.google.com/p/skia/wiki/DocRoot')
sys.exit(1)
-else:
- print 'unknown platform (os.name=%s, sys.platform=%s); see %s' % (
- os.name, sys.platform, 'http://code.google.com/p/skia/wiki/DocRoot')
- sys.exit(1)
-sys.exit(0)
+ sys.exit(0)
+
+
+# main()
+Make(sys.argv[1:])
+