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
This commit is contained in:
parent
39b6efa1b2
commit
7815e73c65
111
make.py
111
make.py
@ -14,16 +14,24 @@
|
|||||||
|
|
||||||
# "Makefile" replacement to build skia for Windows.
|
# "Makefile" replacement to build skia for Windows.
|
||||||
# More info at http://code.google.com/p/skia/wiki/DocRoot
|
# 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 os
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
# TODO(epoger): allow caller to override BUILDTYPE
|
|
||||||
BUILDTYPE = 'Debug'
|
BUILDTYPE = 'Debug'
|
||||||
|
|
||||||
# TODO(epoger): add special 'all' target
|
# special targets
|
||||||
|
TARGET_ALL = 'all'
|
||||||
TARGET_CLEAN = 'clean'
|
TARGET_CLEAN = 'clean'
|
||||||
|
LIST_OF_ALL_TARGETS = ['SampleApp', 'bench', 'gm', 'tests', 'tools']
|
||||||
|
|
||||||
SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__))
|
SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__))
|
||||||
OUT_SUBDIR = 'out'
|
OUT_SUBDIR = 'out'
|
||||||
@ -93,17 +101,14 @@ def CheckWindowsEnvironment():
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
def MakeWindows(args):
|
def MakeWindows(targets):
|
||||||
"""For Windows: build as appropriate for the command line arguments.
|
"""For Windows: build as appropriate for the command line arguments.
|
||||||
|
|
||||||
parameters:
|
parameters:
|
||||||
args: command line arguments as a list of strings
|
targets: build targets as a list of strings
|
||||||
"""
|
"""
|
||||||
CheckWindowsEnvironment()
|
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.
|
# Run gyp_skia to prepare Visual Studio projects.
|
||||||
cd(SCRIPT_DIR)
|
cd(SCRIPT_DIR)
|
||||||
runcommand('python gyp_skia')
|
runcommand('python gyp_skia')
|
||||||
@ -114,41 +119,67 @@ def MakeWindows(args):
|
|||||||
final_output_dir = os.path.join(SCRIPT_DIR, OUT_SUBDIR, BUILDTYPE)
|
final_output_dir = os.path.join(SCRIPT_DIR, OUT_SUBDIR, BUILDTYPE)
|
||||||
mkdirs(final_output_dir)
|
mkdirs(final_output_dir)
|
||||||
|
|
||||||
for target in args:
|
for target in targets:
|
||||||
# Check for special-case targets
|
cd(msbuild_working_dir)
|
||||||
if target == TARGET_CLEAN:
|
runcommand(
|
||||||
MakeClean()
|
('msbuild /nologo /property:Configuration=%s'
|
||||||
else:
|
' /target:%s /verbosity:minimal %s.sln') % (
|
||||||
cd(msbuild_working_dir)
|
BUILDTYPE, target, target))
|
||||||
runcommand(
|
runcommand('xcopy /y %s\* %s' % (
|
||||||
('msbuild /nologo /property:Configuration=%s'
|
msbuild_output_dir, final_output_dir))
|
||||||
' /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.
|
def Make(args):
|
||||||
if os.name == 'nt':
|
"""Main function.
|
||||||
MakeWindows(sys.argv[1:])
|
|
||||||
sys.exit(0)
|
parameters:
|
||||||
elif os.name == 'posix':
|
args: command line arguments as a list of strings
|
||||||
if sys.platform == 'darwin':
|
"""
|
||||||
print 'Mac developers should not run this script; see ' \
|
# handle any variable-setting parameters or special targets
|
||||||
'http://code.google.com/p/skia/wiki/GettingStartedOnMac'
|
global BUILDTYPE
|
||||||
sys.exit(1)
|
targets = []
|
||||||
elif sys.platform == 'cygwin':
|
for arg in args:
|
||||||
print 'Windows development on Cygwin is not currently supported; see ' \
|
if arg == TARGET_ALL:
|
||||||
'http://code.google.com/p/skia/wiki/GettingStartedOnWindows'
|
targets.extend(LIST_OF_ALL_TARGETS)
|
||||||
sys.exit(1)
|
elif arg == TARGET_CLEAN:
|
||||||
|
MakeClean()
|
||||||
|
elif arg.startswith('BUILDTYPE='):
|
||||||
|
BUILDTYPE = arg[10:]
|
||||||
|
elif arg.startswith('GYP_DEFINES='):
|
||||||
|
os.environ['GYP_DEFINES'] = arg[12:]
|
||||||
|
else:
|
||||||
|
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:
|
else:
|
||||||
print 'Unix developers should not run this script; see ' \
|
print 'unknown platform (os.name=%s, sys.platform=%s); see %s' % (
|
||||||
'http://code.google.com/p/skia/wiki/GettingStartedOnLinux'
|
os.name, sys.platform, 'http://code.google.com/p/skia/wiki/DocRoot')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
sys.exit(0)
|
||||||
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)
|
# main()
|
||||||
sys.exit(0)
|
Make(sys.argv[1:])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user