aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar epoger@google.com <epoger@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-04-01 07:02:41 +0000
committerGravatar epoger@google.com <epoger@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-04-01 07:02:41 +0000
commit58d69d846071ff9a84e879041f2f092006bfcd14 (patch)
treeff89f73f603bed7b242ee260f09aba19f563d0b7
parent2c48ee83c824964fbcb3dc4733055da0e75e154f (diff)
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
-rw-r--r--Makefile50
-rw-r--r--gyp/common_conditions.gypi16
-rwxr-xr-xgyp_skia8
-rw-r--r--make.py32
-rwxr-xr-xplatform_tools/chromeos/bin/chromeos_setup.sh2
5 files changed, 38 insertions, 70 deletions
diff --git a/Makefile b/Makefile
index 9b98edcad3..a51d6da14a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
# Makefile that wraps the Gyp and build steps for Unix and Mac (but not Windows)
-# Uses "make" to build on Unix, and "xcodebuild" to build on Mac.
+# Uses "ninja" to build the code.
#
# Some usage examples (tested on both Linux and Mac):
#
@@ -36,6 +36,9 @@ CWD := $(shell pwd)
# But that will be a bit complicated, so let's keep it for a future CL.
# Tracked as https://code.google.com/p/skia/issues/detail?id=947 ('eliminate
# need for VALID_TARGETS in toplevel Makefile')
+#
+# TODO(epoger): I'm not sure if the above comment is still valid in a ninja
+# world.
VALID_TARGETS := \
bench \
debugger \
@@ -59,9 +62,8 @@ default: most
# As noted in http://code.google.com/p/skia/issues/detail?id=330 , building
# multiple targets in parallel was failing. The special .NOTPARALLEL target
-# tells gnu make not to run targets within _this_ Makefile in parallel, but the
-# recursively invoked Makefile within out/ _is_ allowed to run in parallel
-# (so you can still get some speedup that way).
+# tells gnu make not to run targets within this Makefile in parallel.
+# Targets that ninja builds at this Makefile's behest should not be affected.
.NOTPARALLEL:
uname := $(shell uname)
@@ -87,44 +89,8 @@ endif
gyp:
$(CWD)/gyp_skia
-# Run gyp if necessary.
-#
-# On Linux, only run gyp if we haven't already generated the platform-specific
-# Makefiles. If the underlying gyp configuration has changed since these
-# Makefiles were generated, they will rerun gyp on their own.
-#
-# This does not work for Mac, though... so for now, we ALWAYS rerun gyp on Mac.
-# TODO(epoger): Figure out a better solution for Mac... maybe compare the
-# gypfile timestamps to the xcodebuild project timestamps?
-.PHONY: gyp_if_needed
-gyp_if_needed:
-ifneq (,$(findstring Linux, $(uname)))
- $(MAKE) $(SKIA_OUT)/Makefile
-endif
-ifneq (,$(findstring Darwin, $(uname)))
- $(CWD)/gyp_skia
-endif
-
-$(SKIA_OUT)/Makefile:
- $(CWD)/gyp_skia
-
# For all specific targets: run gyp if necessary, and then pass control to
# the gyp-generated buildfiles.
-#
-# For the Mac, we create a convenience symlink to the generated binary.
.PHONY: $(VALID_TARGETS)
-$(VALID_TARGETS):: gyp_if_needed
-ifneq (,$(findstring skia_os=android, $(GYP_DEFINES)))
- $(MAKE) -C $(SKIA_OUT) $@ BUILDTYPE=$(BUILDTYPE)
-else ifneq (,$(findstring Linux, $(uname)))
- $(MAKE) -C $(SKIA_OUT) $@ BUILDTYPE=$(BUILDTYPE)
-else ifneq (,$(findstring make, $(GYP_GENERATORS)))
- $(MAKE) -C $(SKIA_OUT) $@ BUILDTYPE=$(BUILDTYPE)
-else ifneq (,$(findstring Darwin, $(uname)))
- rm -f out/$(BUILDTYPE) || if test -d out/$(BUILDTYPE); then echo "run 'make clean' or otherwise delete out/$(BUILDTYPE)"; exit 1; fi
- xcodebuild -project out/gyp/$@.xcodeproj -configuration $(BUILDTYPE)
- ln -s $(CWD)/xcodebuild/$(BUILDTYPE) out/$(BUILDTYPE)
-else
- echo "unknown platform $(uname)"
- exit 1
-endif
+$(VALID_TARGETS):: gyp
+ ninja -C $(SKIA_OUT)/$(BUILDTYPE) $@
diff --git a/gyp/common_conditions.gypi b/gyp/common_conditions.gypi
index 82f63f375b..70effa1723 100644
--- a/gyp/common_conditions.gypi
+++ b/gyp/common_conditions.gypi
@@ -85,6 +85,22 @@
},
},
},
+ # Gyp's ninja generator depends on these specially named
+ # configurations to build 64-bit on Windows.
+ # See http://skbug.com/2348
+ #
+ # We handle the 64- vs 32-bit variations elsewhere, so I think it's
+ # OK for us to just make these inherit non-archwidth-specific
+ # configurations without modification.
+ 'Debug_x64': {
+ 'inherit_from': ['Debug'],
+ },
+ 'Release_x64': {
+ 'inherit_from': ['Release'],
+ },
+ 'Release_Developer_x64': {
+ 'inherit_from': ['Release_Developer'],
+ },
},
'conditions' : [
[ 'skia_arch_width == 64', {
diff --git a/gyp_skia b/gyp_skia
index 1ba6fc78e8..7a4502684f 100755
--- a/gyp_skia
+++ b/gyp_skia
@@ -84,13 +84,13 @@ if __name__ == '__main__':
print ('%s environment variable not set, using default' %
ENVVAR_GYP_GENERATORS)
if sys.platform.startswith('darwin'):
- default_gyp_generators = 'xcode'
+ default_gyp_generators = 'ninja,xcode'
elif sys.platform.startswith('win'):
- default_gyp_generators = 'msvs'
+ default_gyp_generators = 'ninja,msvs'
elif sys.platform.startswith('cygwin'):
- default_gyp_generators = 'msvs'
+ default_gyp_generators = 'ninja,msvs'
else:
- default_gyp_generators = 'make'
+ default_gyp_generators = 'ninja'
os.environ[ENVVAR_GYP_GENERATORS] = default_gyp_generators
print '%s is "%s"' % (ENVVAR_GYP_GENERATORS, os.getenv(ENVVAR_GYP_GENERATORS))
diff --git a/make.py b/make.py
index 28f3554a49..f6f9f11e25 100644
--- a/make.py
+++ b/make.py
@@ -42,11 +42,6 @@ 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):
@@ -99,30 +94,21 @@ def MakeWindows(targets):
parameters:
targets: build targets as a list of strings
"""
+ # TODO(epoger): I'm not sure if this is needed for ninja builds.
CheckWindowsEnvironment()
# 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 targets:
- # We already built the gypfiles...
- if target == TARGET_GYP:
- continue
-
- 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))
+ # We already built the gypfiles...
+ while TARGET_GYP in targets:
+ targets.remove(TARGET_GYP)
+
+ # And call ninja to do the work!
+ if targets:
+ runcommand('ninja -C %s %s' % (
+ os.path.join(OUT_SUBDIR, BUILDTYPE), ' '.join(targets)))
def Make(args):
diff --git a/platform_tools/chromeos/bin/chromeos_setup.sh b/platform_tools/chromeos/bin/chromeos_setup.sh
index be8b5cbc84..e2dc32b34e 100755
--- a/platform_tools/chromeos/bin/chromeos_setup.sh
+++ b/platform_tools/chromeos/bin/chromeos_setup.sh
@@ -49,7 +49,7 @@ setup_device() {
exportVar GENERIC_BOARD_TYPE ${GENERIC_BOARD_TYPE}
exportVar GYP_DEFINES "$DEFINES"
- exportVar GYP_GENERATORS "make"
+ exportVar GYP_GENERATORS "ninja"
exportVar GYP_GENERATOR_FLAGS ""
exportVar SKIA_OUT "out/config/chromeos-${TARGET_DEVICE}"
exportVar builddir_name "."