]> git.sesse.net Git - movit/blob - Makefile
In OverlayEffectTest, handle that RGB on zero alpha is undefined.
[movit] / Makefile
1 GTEST_DIR ?= /usr/src/gtest
2
3 EIGEN_CXXFLAGS := $(shell pkg-config --cflags eigen3)
4 ifeq ($(EIGEN_CXXFLAGS),)
5 $(error Empty EIGEN_CXXFLAGS. You probably need to install Eigen3)
6 endif
7
8 GLEW_CXXFLAGS := $(shell pkg-config --cflags glew)
9 ifeq ($(GLEW_CXXFLAGS),)
10 $(error Empty GLEW_CXXFLAGS. You probably need to install GLEW)
11 endif
12
13 GLEW_LIBS := $(shell pkg-config --libs glew)
14 ifeq ($(GLEW_LIBS),)
15 $(error Empty GLEW_LIBS. You probably need to install GLEW)
16 endif
17
18 SDL_CXXFLAGS := $(shell sdl-config --cflags)
19 ifeq ($(SDL_CXXFLAGS),)
20 $(error Empty SDL_CXXFLAGS. You probably need to install SDL)
21 endif
22
23 SDL_LIBS := $(shell sdl-config --libs)
24 ifeq ($(SDL_LIBS),)
25 $(error Empty SDL_LIBS. You probably need to install SDL)
26 endif
27
28 CC=gcc
29 CXX=g++
30 CXXFLAGS=-Wall -g -I$(GTEST_DIR)/include $(EIGEN_CXXFLAGS) $(GLEW_CXXFLAGS)
31 LDFLAGS=-lSDL -lSDL_image -lGL -lrt -lpthread -lpng $(GLEW_LIBS) $(SDL_LIBS)
32 RANLIB=ranlib
33
34 ifeq ($(COVERAGE),1)
35 CXXFLAGS += -fprofile-arcs -ftest-coverage
36 LDFLAGS += -fprofile-arcs -ftest-coverage
37 endif
38
39 DEMO_OBJS=demo.o
40
41 # Unit tests.
42 TESTS=effect_chain_test
43 TESTS += mix_effect_test
44 TESTS += overlay_effect_test
45 TESTS += gamma_expansion_effect_test
46 TESTS += gamma_compression_effect_test
47 TESTS += colorspace_conversion_effect_test
48 TESTS += alpha_multiplication_effect_test
49 TESTS += alpha_division_effect_test
50 TESTS += saturation_effect_test
51 TESTS += deconvolution_sharpen_effect_test
52 TESTS += blur_effect_test
53 TESTS += unsharp_mask_effect_test
54 TESTS += glow_effect_test
55 TESTS += diffusion_effect_test
56 TESTS += white_balance_effect_test
57 TESTS += lift_gamma_gain_effect_test
58 TESTS += resample_effect_test
59 TESTS += padding_effect_test
60 TESTS += dither_effect_test
61 TESTS += flat_input_test
62 TESTS += ycbcr_input_test
63
64 # Core.
65 LIB_OBJS=util.o widgets.o effect.o effect_chain.o init.o
66
67 # Inputs.
68 LIB_OBJS += flat_input.o
69 LIB_OBJS += ycbcr_input.o
70
71 # Effects.
72 LIB_OBJS += lift_gamma_gain_effect.o
73 LIB_OBJS += white_balance_effect.o
74 LIB_OBJS += gamma_expansion_effect.o
75 LIB_OBJS += gamma_compression_effect.o
76 LIB_OBJS += colorspace_conversion_effect.o
77 LIB_OBJS += alpha_multiplication_effect.o
78 LIB_OBJS += alpha_division_effect.o
79 LIB_OBJS += saturation_effect.o
80 LIB_OBJS += vignette_effect.o
81 LIB_OBJS += mirror_effect.o
82 LIB_OBJS += blur_effect.o
83 LIB_OBJS += diffusion_effect.o
84 LIB_OBJS += glow_effect.o
85 LIB_OBJS += unsharp_mask_effect.o
86 LIB_OBJS += mix_effect.o
87 LIB_OBJS += overlay_effect.o
88 LIB_OBJS += resize_effect.o
89 LIB_OBJS += padding_effect.o
90 LIB_OBJS += resample_effect.o
91 LIB_OBJS += dither_effect.o
92 LIB_OBJS += deconvolution_sharpen_effect.o
93 LIB_OBJS += sandbox_effect.o
94
95 # Default target:
96 all: $(TESTS) demo
97
98 # Google Test and other test library functions.
99 TEST_OBJS = gtest-all.o gtest_sdl_main.o test_util.o
100
101 gtest-all.o: $(GTEST_DIR)/src/gtest-all.cc
102         $(CXX) -MMD $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c $< -o $@
103 gtest_sdl_main.o: gtest_sdl_main.cpp
104         $(CXX) -MMD $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c $< -o $@
105
106 # Unit tests.
107 $(TESTS): %: %.o $(TEST_OBJS) libmovit.a
108         $(CXX) -o $@ $^ $(LDFLAGS)
109
110 OBJS=$(DEMO_OBJS) $(LIB_OBJS) $(TEST_OBJS) $(TESTS:=.o)
111
112 # A small demo program.
113 demo: libmovit.a $(DEMO_OBJS)
114         $(CXX) -o demo $(DEMO_OBJS) libmovit.a $(LDFLAGS)
115
116 # The library itself.
117 libmovit.a: $(LIB_OBJS)
118         $(AR) rc $@ $(LIB_OBJS)
119         $(RANLIB) $@
120
121 %.o: %.cpp
122         $(CXX) -MMD -MP $(CPPFLAGS) $(CXXFLAGS) -o $@ -c $<
123
124 DEPS=$(OBJS:.o=.d)
125 -include $(DEPS)
126
127 clean:
128         $(RM) demo $(TESTS) libmovit.a $(OBJS) $(OBJS:.o=.gcno) $(OBJS:.o=.gcda) $(DEPS) step-*.dot
129         $(RM) -r movit.info coverage/
130
131 check: $(TESTS)
132         FAILED_TESTS=""; \
133         for TEST in $(TESTS); do \
134             ./$$TEST || FAILED_TESTS="$$TEST $$FAILED_TESTS"; \
135         done; \
136         if [ "$$FAILED_TESTS" ]; then \
137                 echo Failed tests: $$FAILED_TESTS; \
138                 exit 1; \
139         fi
140
141 # You need to build with COVERAGE=1 to use this target.
142 coverage: check
143         lcov -d . -c -o movit.info
144         lcov --remove movit.info '*_test.cpp' '*/test_util.{cpp,h}' -o movit.info
145         genhtml -o coverage movit.info
146
147 .PHONY: coverage clean check all