Add a standalone build system
authorBenoit Girard <b56girard@gmail.com>
Tue, 07 May 2013 17:32:44 -0400
changeset 4 0f43ac82cf19a420848d872fa0c388adb46684b4
parent 3 72bdccbbbb05bfd50a0c0f7d8a303f7c0f6951c9
child 5 32cc80c5fdba9a9d2612fbbaea8eddc0b3b23a2a
push id4
push userb56girard@gmail.com
push dateTue, 07 May 2013 21:33:06 +0000
Add a standalone build system
DrawTargetCG.h
Makefile.cairo
Makefile.cg
Makefile.d2d
Makefile.skia
Makefile.standalone
--- a/DrawTargetCG.h
+++ b/DrawTargetCG.h
@@ -4,17 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include <ApplicationServices/ApplicationServices.h>
 
 #include "2D.h"
 #include "Rect.h"
 #include "PathCG.h"
 #include "SourceSurfaceCG.h"
-#include "GLDefs.h"
+#include "QuartzSupport.h"
 
 namespace mozilla {
 namespace gfx {
 
 static inline CGAffineTransform
 GfxMatrixToCGAffineTransform(Matrix m)
 {
   CGAffineTransform t;
new file mode 100644
--- /dev/null
+++ b/Makefile.cairo
@@ -0,0 +1,16 @@
+# Simple checks
+HAS_CAIRO=$(shell pkg-config cairo && echo YES)
+ifneq ($(HAS_CAIRO),YES)
+$(error Cairo package not found)
+endif
+
+CXXFLAGS += `pkg-config --cflags cairo`
+LIBS += `pkg-config --libs cairo`
+DEFINES  += USE_CAIRO
+
+MOZ2D_CPPSRCS += \
+  DrawTargetCairo.cpp \
+  PathCairo.cpp \
+  SourceSurfaceCairo.cpp \
+  $(NULL)
+
new file mode 100644
--- /dev/null
+++ b/Makefile.cg
@@ -0,0 +1,10 @@
+# XP_MACOSX is analogous for CG
+DEFINES += XP_MACOSX
+
+MOZ2D_CPPSRCS += \
+  DrawTargetCG.cpp \
+  SourceSurfaceCG.cpp \
+  ScaledFontMac.cpp \
+  PathCG.cpp \
+  $(NULL)
+
new file mode 100644
--- /dev/null
+++ b/Makefile.d2d
@@ -0,0 +1,16 @@
+
+# TODO FontWin belong here?
+
+MOZ2D_CPPSRCS +=
+  DrawTargetD2D.cpp \
+  PathD2D.cpp \
+  SourceSurfaceD2D.cpp \
+  SourceSurfaceD2DTarget.cpp \
+  ScaledFontDWrite.cpp \
+  ScaledFontWin.cpp \
+  $(NULL)
+
+TESTING_CPPSRS += \
+  unittest/TestDrawTargetD2D.cpp \
+  $(NULL)
+
new file mode 100644
--- /dev/null
+++ b/Makefile.skia
@@ -0,0 +1,6 @@
+MOZ2D_CPPSRCS += \
+  DrawTargetSkia.cpp \
+  PathSkia.cpp \
+  SourceSurfaceSkia.cpp \
+  $(NULL)
+
new file mode 100644
--- /dev/null
+++ b/Makefile.standalone
@@ -0,0 +1,105 @@
+# High level targets
+.PHONY: release debug clean
+
+OBJDIR_RELEASE=release
+OBJDIR_DEBUG=debug
+INCLUDES=.
+CXXFLAGS=$(addprefix -I,$(INCLUDES)) -std=gnu++0x
+DEFINES=
+
+# TODO: Files that depends on mozilla:
+#./gfx/thebes/gfxFont.h
+#convolver.cpp
+#image_operations.cpp
+
+MOZ2D_CPPSRCS_ALLPLATFORMS = \
+  Blur.cpp \
+  BlurSSE2.cpp \
+  DrawEventRecorder.cpp \
+  DrawTargetDual.cpp \
+  DrawTargetRecording.cpp \
+  Factory.cpp \
+  ImageScaling.cpp \
+  ImageScalingSSE2.cpp \
+  Matrix.cpp \
+  PathRecording.cpp \
+  RecordedEvent.cpp \
+  Rect.cpp \
+  Scale.cpp \
+  ScaledFontBase.cpp \
+  SourceSurfaceRawData.cpp \
+  $(NULL)
+
+# TODO:
+#unittest/TestDrawTargetBase.cpp
+
+TESTING_CPPSRS_ALLPLATFORMS = \
+  unittest/SanityChecks.cpp \
+  unittest/TestBase.cpp \
+  unittest/TestPoint.cpp \
+  unittest/TestScaling.cpp \
+  unittest/Main.cpp \
+  $(NULL)
+
+MOZ2D_CPPSRCS = $(MOZ2D_CPPSRCS_ALLPLATFORMS)
+TESTING_CPPSRS = $(TESTING_CPPSRS_ALLPLATFORMS)
+
+# ================ OS FEATURES ================
+UNAME = $(shell uname)
+ifeq ($(UNAME),Darwin)
+LIBS += -framework CoreFoundation
+endif
+
+# ================ INCLUDE FEATURE SPECIFIC MAKEFILES =================
+# These will modify the following variables:
+#   TESTING_CPPSRS
+#   MOZ2D_CPPSRCS
+#   DEFINES
+#
+ifdef MOZ2D_D2D
+ -include Makefile.d2d
+endif
+ifdef MOZ2D_CG
+ -include Makefile.cg
+endif
+ifdef MOZ2D_CAIRO
+ -include Makefile.cairo
+endif
+  
+CPPSRCS = $(MOZ2D_CPPSRCS) $(TESTING_CPPSRS)
+
+RELEASE_CPPSRCS = $(addprefix $(OBJDIR_RELEASE)/,$(CPPSRCS))
+DEBUG_CPPSRCS = $(addprefix $(OBJDIR_DEBUG)/,$(CPPSRCS))
+COMPILER_DEFINES = $(addprefix -D,$(DEFINES))
+
+-include $(RELEASE_CPPSRCS:.cpp=.d)
+-include $(DEBUG_CPPSRCS:.cpp=.d)
+
+release: $(RELEASE_CPPSRCS:.cpp=.o) $(OBJDIR_RELEASE)/unittest/unittest $(OBJDIR_RELEASE)/.mkdir.done
+
+debug: $(DEBUG_CPPSRCS:.cpp=.o) $(OBJDIR_DEBUG)/unittest/unittest $(OBJDIR_DEBUG)/.mkdir.done
+
+$(OBJDIR_RELEASE)/unittest/unittest: $(RELEASE_CPPSRCS:.cpp=.o)
+	echo $(UNAME)
+	$(CXX) $(LIBS) $(RELEASE_CPPSRCS:.cpp=.o) -o release/unittest/unittest
+
+clean:
+	rm -rf $(OBJDIR_RELEASE) $(OBJDIR_DEBUG)
+
+
+
+
+# ================== IMPLICIT RULES ===========================
+
+%/.mkdir.done:
+	mkdir -p $(dir $@)/unittest
+	mkdir -p $@
+
+$(OBJDIR_RELEASE)/%.o: %.cpp $(OBJDIR_RELEASE)/.mkdir.done
+	$(CXX) -c $(COMPILER_DEFINES) $(CXXFLAGS) -o $@ $<
+	$(CXX) -MM $(COMPILER_DEFINES) $(CXXFLAGS) -o $(@:.o=.d) $<
+
+$(OBJDIR_DEBUG)/%.o: %.cpp $(OBJDIR_DEBUG)/.mkdir.done
+	$(CXX) $(COMPILER_DEFINES) $(CXXFLAGS) -c -o $@ $<
+	$(CXX) -MM $(COMPILER_DEFINES) $(CXXFLAGS) -o $(@:.o=.d) $<
+