goat3d

view goatview/Makefile @ 103:45a9d493e98c

fixed the input latency issue by calling QWidget::update() instead of QGLWidget::updateGL() update schedules an update instead of redrawing immediately.
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 12 Sep 2015 17:40:02 +0300
parents ae6c5941faac
children
line source
1 PREFIX = /usr/local
3 src = $(wildcard src/*.cc)
4 csrc = $(wildcard src/*.c)
5 mochdr = src/goatview.h src/scenemodel.h
6 mocsrc = $(patsubst src/%.h,src/moc_%.cc,$(mochdr))
7 obj = $(sort $(csrc:.c=.o) $(src:.cc=.o) $(mocsrc:.cc=.o))
8 dep = $(obj:.o=.d)
9 bin = goatview
11 goat_root = ..
13 warn = -Wall
15 CFLAGS = $(warn) -g $(pic) -I$(goat_root)/src $(qtinc)
16 CXXFLAGS = -std=c++11 $(CFLAGS)
17 LDFLAGS = $(libgoat) $(libgl) $(qtlib) -lvmath -lanim
18 MOC = moc
20 qtinc = `pkg-config --cflags Qt5Gui Qt5Core Qt5OpenGL`
21 qtlib = `pkg-config --libs Qt5Gui Qt5Core Qt5OpenGL`
23 ifeq ($(compiler), clang)
24 CXXFLAGS += -stdlib=libc++
25 warn += '-Wno-\#warnings'
26 else
27 warn += -Wno-cpp
28 endif
30 ifeq ($(shell uname -s), Darwin)
31 libgl = -framework OpenGL -framework GLUT -lGLEW
32 libgoat = $(goat_root)/libgoat3d.dylib
33 warn += -Wno-deprecated-declarations
34 bundle = $(bin).app
35 dmg = $(bin).dmg
36 else
37 pic = -fPIC
38 libgl = -lGL -lGLU -lglut -lGLEW
39 libgoat = $(goat_root)/libgoat3d.so.0.1
40 endif
42 $(bin): $(obj) $(libgoat)
43 $(CXX) -o $@ $(obj) $(LDFLAGS)
45 # rule for running moc on ui header files
46 moc_%.cc: %.h
47 $(MOC) -o $@ $<
49 -include $(dep)
51 %.d: %.c
52 @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
54 %.d: %.cc
55 @$(CPP) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@
57 .PHONY: clean
58 clean:
59 rm -f $(obj) $(bin)
60 [ -n "$(bundle)" ] && rm -rf $(bundle) || true
61 [ -n "$(dmg)" ] && rm -rf $(dmg) || true
63 .PHONY: cleandep
64 cleandep:
65 rm -f $(dep)
67 .PHONY: install
68 install: $(bin)
69 cp $(bin) $(DESTDIR)$(PREFIX)/bin/$(bin)
71 .PHONY: uninstall
72 uninstall:
73 rm -f $(DESTDIR)$(PREFIX)/bin/$(bin)
75 .PHONY: echo
76 echo:
77 @echo $(var)=\"$($(var))\"
79 .PHONY: bundle
80 bundle: $(bundle)
82 .PHONY: dmg
83 dmg: $(dmg)
85 $(bundle): $(bin) $(libgoat)
86 rm -rf $(bundle)
87 mkdir -p $(bundle)/Contents/MacOS
88 mkdir -p $(bundle)/Contents/Frameworks
89 cp $(bin) $(bundle)/Contents/MacOS/$(bin)
90 macdeployqt $(bundle)
91 cp $(libgoat) $(bundle)/Contents/Frameworks
92 cp /usr/local/lib/libvmath.dylib $(bundle)/Contents/Frameworks
93 cp /usr/local/lib/libanim.dylib $(bundle)/Contents/Frameworks
95 $(dmg): $(bundle)
96 rm -f $@
97 hdiutil create -format UDBZ -quiet -srcfolder $< $@
99 .PHONY: run
100 ifeq ($(shell uname -s), Darwin)
101 run: $(bundle)
102 ./$(bundle)/Contents/MacOS/$(bin)
103 else
104 run: $(bin)
105 ./$(bin)
106 endif
108 ccver = $(shell $(CC) --version)
109 ifneq (,$(findstring LLVM,$(ccver)))
110 # clang/llvm
111 compiler = clang
112 else
113 # other, assume gcc
114 compiler = gcc
115 endif