Skip to content

Commit 58d69d8

Browse files
change default build (in "make" wrapper) to ninja on all platforms
force-landed from https://codereview.chromium.org/206463007/ ; the CommitQueue couldn't handle the diff properly for some reason git-svn-id: http://skia.googlecode.com/svn/trunk@14003 2bbb7eff-a529-9590-31e7-b0007b416f81
1 parent 2c48ee8 commit 58d69d8

File tree

5 files changed

+38
-70
lines changed

5 files changed

+38
-70
lines changed

Diff for: Makefile

+8-42
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Makefile that wraps the Gyp and build steps for Unix and Mac (but not Windows)
2-
# Uses "make" to build on Unix, and "xcodebuild" to build on Mac.
2+
# Uses "ninja" to build the code.
33
#
44
# Some usage examples (tested on both Linux and Mac):
55
#
@@ -36,6 +36,9 @@ CWD := $(shell pwd)
3636
# But that will be a bit complicated, so let's keep it for a future CL.
3737
# Tracked as https://code.google.com/p/skia/issues/detail?id=947 ('eliminate
3838
# need for VALID_TARGETS in toplevel Makefile')
39+
#
40+
# TODO(epoger): I'm not sure if the above comment is still valid in a ninja
41+
# world.
3942
VALID_TARGETS := \
4043
bench \
4144
debugger \
@@ -59,9 +62,8 @@ default: most
5962

6063
# As noted in http://code.google.com/p/skia/issues/detail?id=330 , building
6164
# multiple targets in parallel was failing. The special .NOTPARALLEL target
62-
# tells gnu make not to run targets within _this_ Makefile in parallel, but the
63-
# recursively invoked Makefile within out/ _is_ allowed to run in parallel
64-
# (so you can still get some speedup that way).
65+
# tells gnu make not to run targets within this Makefile in parallel.
66+
# Targets that ninja builds at this Makefile's behest should not be affected.
6567
.NOTPARALLEL:
6668

6769
uname := $(shell uname)
@@ -87,44 +89,8 @@ endif
8789
gyp:
8890
$(CWD)/gyp_skia
8991

90-
# Run gyp if necessary.
91-
#
92-
# On Linux, only run gyp if we haven't already generated the platform-specific
93-
# Makefiles. If the underlying gyp configuration has changed since these
94-
# Makefiles were generated, they will rerun gyp on their own.
95-
#
96-
# This does not work for Mac, though... so for now, we ALWAYS rerun gyp on Mac.
97-
# TODO(epoger): Figure out a better solution for Mac... maybe compare the
98-
# gypfile timestamps to the xcodebuild project timestamps?
99-
.PHONY: gyp_if_needed
100-
gyp_if_needed:
101-
ifneq (,$(findstring Linux, $(uname)))
102-
$(MAKE) $(SKIA_OUT)/Makefile
103-
endif
104-
ifneq (,$(findstring Darwin, $(uname)))
105-
$(CWD)/gyp_skia
106-
endif
107-
108-
$(SKIA_OUT)/Makefile:
109-
$(CWD)/gyp_skia
110-
11192
# For all specific targets: run gyp if necessary, and then pass control to
11293
# the gyp-generated buildfiles.
113-
#
114-
# For the Mac, we create a convenience symlink to the generated binary.
11594
.PHONY: $(VALID_TARGETS)
116-
$(VALID_TARGETS):: gyp_if_needed
117-
ifneq (,$(findstring skia_os=android, $(GYP_DEFINES)))
118-
$(MAKE) -C $(SKIA_OUT) $@ BUILDTYPE=$(BUILDTYPE)
119-
else ifneq (,$(findstring Linux, $(uname)))
120-
$(MAKE) -C $(SKIA_OUT) $@ BUILDTYPE=$(BUILDTYPE)
121-
else ifneq (,$(findstring make, $(GYP_GENERATORS)))
122-
$(MAKE) -C $(SKIA_OUT) $@ BUILDTYPE=$(BUILDTYPE)
123-
else ifneq (,$(findstring Darwin, $(uname)))
124-
rm -f out/$(BUILDTYPE) || if test -d out/$(BUILDTYPE); then echo "run 'make clean' or otherwise delete out/$(BUILDTYPE)"; exit 1; fi
125-
xcodebuild -project out/gyp/[email protected] -configuration $(BUILDTYPE)
126-
ln -s $(CWD)/xcodebuild/$(BUILDTYPE) out/$(BUILDTYPE)
127-
else
128-
echo "unknown platform $(uname)"
129-
exit 1
130-
endif
95+
$(VALID_TARGETS):: gyp
96+
ninja -C $(SKIA_OUT)/$(BUILDTYPE) $@

Diff for: gyp/common_conditions.gypi

+16
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,22 @@
8585
},
8686
},
8787
},
88+
# Gyp's ninja generator depends on these specially named
89+
# configurations to build 64-bit on Windows.
90+
# See http://skbug.com/2348
91+
#
92+
# We handle the 64- vs 32-bit variations elsewhere, so I think it's
93+
# OK for us to just make these inherit non-archwidth-specific
94+
# configurations without modification.
95+
'Debug_x64': {
96+
'inherit_from': ['Debug'],
97+
},
98+
'Release_x64': {
99+
'inherit_from': ['Release'],
100+
},
101+
'Release_Developer_x64': {
102+
'inherit_from': ['Release_Developer'],
103+
},
88104
},
89105
'conditions' : [
90106
[ 'skia_arch_width == 64', {

Diff for: gyp_skia

+4-4
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,13 @@ if __name__ == '__main__':
8484
print ('%s environment variable not set, using default' %
8585
ENVVAR_GYP_GENERATORS)
8686
if sys.platform.startswith('darwin'):
87-
default_gyp_generators = 'xcode'
87+
default_gyp_generators = 'ninja,xcode'
8888
elif sys.platform.startswith('win'):
89-
default_gyp_generators = 'msvs'
89+
default_gyp_generators = 'ninja,msvs'
9090
elif sys.platform.startswith('cygwin'):
91-
default_gyp_generators = 'msvs'
91+
default_gyp_generators = 'ninja,msvs'
9292
else:
93-
default_gyp_generators = 'make'
93+
default_gyp_generators = 'ninja'
9494
os.environ[ENVVAR_GYP_GENERATORS] = default_gyp_generators
9595
print '%s is "%s"' % (ENVVAR_GYP_GENERATORS, os.getenv(ENVVAR_GYP_GENERATORS))
9696

Diff for: make.py

+9-23
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,6 @@ def rmtree(path):
4242
print '> rmtree %s' % path
4343
shutil.rmtree(path, ignore_errors=True)
4444

45-
def mkdirs(path):
46-
print '> mkdirs %s' % path
47-
if not os.path.isdir(path):
48-
os.makedirs(path)
49-
5045
def runcommand(command):
5146
print '> %s' % command
5247
if os.system(command):
@@ -99,30 +94,21 @@ def MakeWindows(targets):
9994
parameters:
10095
targets: build targets as a list of strings
10196
"""
97+
# TODO(epoger): I'm not sure if this is needed for ninja builds.
10298
CheckWindowsEnvironment()
10399

104100
# Run gyp_skia to prepare Visual Studio projects.
105101
cd(SCRIPT_DIR)
106102
runcommand('python gyp_skia')
107103

108-
# Prepare final output dir into which we will copy all binaries.
109-
msbuild_working_dir = os.path.join(SCRIPT_DIR, OUT_SUBDIR, GYP_SUBDIR)
110-
msbuild_output_dir = os.path.join(msbuild_working_dir, BUILDTYPE)
111-
final_output_dir = os.path.join(SCRIPT_DIR, OUT_SUBDIR, BUILDTYPE)
112-
mkdirs(final_output_dir)
113-
114-
for target in targets:
115-
# We already built the gypfiles...
116-
if target == TARGET_GYP:
117-
continue
118-
119-
cd(msbuild_working_dir)
120-
runcommand(
121-
('msbuild /nologo /property:Configuration=%s'
122-
' /target:%s /verbosity:minimal %s.sln') % (
123-
BUILDTYPE, target, target))
124-
runcommand('xcopy /y %s\* %s' % (
125-
msbuild_output_dir, final_output_dir))
104+
# We already built the gypfiles...
105+
while TARGET_GYP in targets:
106+
targets.remove(TARGET_GYP)
107+
108+
# And call ninja to do the work!
109+
if targets:
110+
runcommand('ninja -C %s %s' % (
111+
os.path.join(OUT_SUBDIR, BUILDTYPE), ' '.join(targets)))
126112

127113

128114
def Make(args):

Diff for: platform_tools/chromeos/bin/chromeos_setup.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ setup_device() {
4949

5050
exportVar GENERIC_BOARD_TYPE ${GENERIC_BOARD_TYPE}
5151
exportVar GYP_DEFINES "$DEFINES"
52-
exportVar GYP_GENERATORS "make"
52+
exportVar GYP_GENERATORS "ninja"
5353
exportVar GYP_GENERATOR_FLAGS ""
5454
exportVar SKIA_OUT "out/config/chromeos-${TARGET_DEVICE}"
5555
exportVar builddir_name "."

0 commit comments

Comments
 (0)