player2d building on osx
authorBenoit Girard <b56girard@gmail.com>
Tue, 07 May 2013 22:20:48 -0400
changeset 14 ad9ab3898fd42e999e91da24c21825cca6b2fbae
parent 13 06b489d6203525f06f1cf0a889e7cfd0edd71287
child 15 c337c5ceef4ab61717c329aad932194fc14a2b88
push id14
push userb56girard@gmail.com
push dateWed, 08 May 2013 02:20:54 +0000
player2d building on osx
Makefile.cairo
Makefile.standalone
player2d/player2d.pro
--- a/Makefile.cairo
+++ b/Makefile.cairo
@@ -1,16 +1,17 @@
 # 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`
+MOZ2D_PLAYER2D_LIBS += $(shell pkg-config --libs cairo)
 DEFINES  += USE_CAIRO
 
 MOZ2D_CPPSRCS += \
   DrawTargetCairo.cpp \
   PathCairo.cpp \
   SourceSurfaceCairo.cpp \
   $(NULL)
 
--- a/Makefile.standalone
+++ b/Makefile.standalone
@@ -83,40 +83,46 @@ DEBUG_PERFTEST_CPPSRCS = $(addprefix $(O
 RELEASE_UNITTEST_CPPSRCS = $(addprefix $(OBJDIR_RELEASE)/,$(PRE_UNITTEST_CPPSRCS))
 DEBUG_UNITTEST_CPPSRCS = $(addprefix $(OBJDIR_DEBUG)/,$(PRE_UNITTEST_CPPSRCS))
 COMPILER_DEFINES = $(addprefix -D,$(DEFINES))
 
 -include $(RELEASE_CPPSRCS:.cpp=.d)
 -include $(DEBUG_CPPSRCS:.cpp=.d)
 
 release: \
-  $(RELEASE_CPPSRCS:.cpp=.o) \
+  $(OBJDIR_RELEASE)/libmoz2d.a \
   $(OBJDIR_RELEASE)/unittest/unittest \
   $(OBJDIR_RELEASE)/perftest/perftest \
   $(OBJDIR_RELEASE)/.mkdir.done \
 	$(NULL)
 
 debug: \
-  $(DEBUG_CPPSRCS:.cpp=.o) \
+  $(OBJDIR_DEBUG)/libmoz2d.a \
   $(OBJDIR_DEBUG)/unittest/unittest \
   $(OBJDIR_DEBUG)/perftest/perftest \
   $(OBJDIR_DEBUG)/.mkdir.done \
 	$(NULL)
 
 player2d: $(OBJDIR_RELEASE)/player2d/player2d $(OBJDIR_DEBUG)/player2d/player2d
 
 $(OBJDIR_RELEASE)/unittest/unittest: $(RELEASE_UNITTEST_CPPSRCS:.cpp=.o)
 	$(CXX) $(RELEASE_UNITTEST_CPPSRCS:.cpp=.o) $(LIBS) -o $(OBJDIR_RELEASE)/unittest/unittest
 
 $(OBJDIR_RELEASE)/perftest/perftest: $(RELEASE_PERFTEST_CPPSRCS:.cpp=.o)
 	$(CXX) $(RELEASE_PERFTEST_CPPSRCS:.cpp=.o) $(LIBS) -o $(OBJDIR_RELEASE)/perftest/perftest
 
-$(OBJDIR_RELEASE)/player2d/player2d: $(OBJDIR_RELEASE)/.mkdir.done
+$(OBJDIR_RELEASE)/libmoz2d.a: $(RELEASE_CPPSRCS:.cpp=.o)
+	libtool -static -o $(OBJDIR_RELEASE)/libmoz2d.a $(RELEASE_CPPSRCS:.cpp=.o) #`pkg-config --libs cairo`
+
+$(OBJDIR_DEBUG)/libmoz2d.a: $(DEBUG_CPPSRCS:.cpp=.o)
+	ar rcs $(OBJDIR_RELEASE)/libmoz2d.a $(DEBUG_CPPSRCS:.cpp=.o)
+
+$(OBJDIR_RELEASE)/player2d/player2d: $(OBJDIR_RELEASE)/.mkdir.done $(OBJDIR_RELEASE)/libmoz2d.a
 	@hash qmake || "echo Please install Qt for your platform: http://qt-project.org/"
-	cd $(OBJDIR_RELEASE)/player2d && qmake ../../player2d && make
+	export MOZ2D_PLAYER2D_LIBS="$(MOZ2D_PLAYER2D_LIBS)" && cd $(OBJDIR_RELEASE)/player2d && qmake ../../player2d && make
 
 $(OBJDIR_DEBUG)/player2d/player2d: $(OBJDIR_RELEASE)/.mkdir.done
 
 clean:
 	rm -rf $(OBJDIR_RELEASE) $(OBJDIR_DEBUG)
 
 
 
--- a/player2d/player2d.pro
+++ b/player2d/player2d.pro
@@ -36,17 +36,17 @@ FORMS    += mainwindow.ui \
     drawtargetview.ui \
     sourcesurfaceview.ui \
     gradientstopsview.ui \
     redundancyanalysis.ui
 
 win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../release/ -lgfx2d
 else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../debug/ -lgfx2d
 else:symbian: LIBS += -lgfx2d
-else:unix: LIBS += -L$$PWD/../ -lgfx2d
+else:unix: LIBS += -L`echo \$$PWD`/../ `echo \$$MOZ2D_PLAYER2D_LIBS` -lmoz2d
 
 INCLUDEPATH += $$PWD/../
 DEPENDPATH += $$PWD/../
 
 static: QTPLUGIN += qico
 static: DEFINES += QT_STATIC
 
 win32:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../release/gfx2d.lib