Skip to content

Commit 8b92724

Browse files
1 parent 1886d22 commit 8b92724

28 files changed

+7006
-0
lines changed

c_mpos/quirc/.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
*.o
2+
*.lo
3+
quirc-demo
4+
quirc-scanner
5+
qrtest
6+
inspect
7+
libquirc.a
8+
libquirc.so*
9+
.*.swp
10+
*~
11+
.DS_Store
12+
.idea

c_mpos/quirc/LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
quirc -- QR-code recognition library
2+
Copyright (C) 2010-2012 Daniel Beer <dlbeer@gmail.com>
3+
4+
ISC License
5+
===========
6+
7+
Permission to use, copy, modify, and/or distribute this software for
8+
any purpose with or without fee is hereby granted, provided that the
9+
above copyright notice and this permission notice appear in all
10+
copies.
11+
12+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13+
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14+
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15+
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16+
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17+
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19+
PERFORMANCE OF THIS SOFTWARE.

c_mpos/quirc/Makefile

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# quirc -- QR-code recognition library
2+
# Copyright (C) 2010-2012 Daniel Beer <dlbeer@gmail.com>
3+
#
4+
# Permission to use, copy, modify, and/or distribute this software for any
5+
# purpose with or without fee is hereby granted, provided that the above
6+
# copyright notice and this permission notice appear in all copies.
7+
#
8+
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9+
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10+
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11+
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12+
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13+
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14+
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15+
16+
CC ?= gcc
17+
PREFIX ?= /usr/local
18+
SDL_CFLAGS := $(shell pkg-config --cflags sdl 2>&1)
19+
SDL_LIBS = $(shell pkg-config --libs sdl)
20+
21+
LIB_VERSION = 1.2
22+
23+
ifeq ($(shell uname), Darwin)
24+
LIB_SUFFIX := dylib
25+
VERSIONED_LIB_SUFFIX := $(LIB_VERSION).$(LIB_SUFFIX)
26+
else
27+
LIB_SUFFIX := so
28+
VERSIONED_LIB_SUFFIX := $(LIB_SUFFIX).$(LIB_VERSION)
29+
endif
30+
31+
CFLAGS ?= -O3 -Wall -fPIC
32+
QUIRC_CFLAGS = -Ilib $(CFLAGS) $(SDL_CFLAGS)
33+
LIB_OBJ = \
34+
lib/decode.o \
35+
lib/identify.o \
36+
lib/quirc.o \
37+
lib/version_db.o
38+
DEMO_OBJ = \
39+
demo/camera.o \
40+
demo/mjpeg.o \
41+
demo/convert.o
42+
DEMO_UTIL_OBJ = \
43+
demo/dthash.o \
44+
demo/demoutil.o
45+
46+
OPENCV_CFLAGS := $(shell pkg-config --cflags opencv4 2>&1)
47+
OPENCV_LIBS = $(shell pkg-config --libs opencv4)
48+
QUIRC_CXXFLAGS = $(QUIRC_CFLAGS) $(OPENCV_CFLAGS) --std=c++17
49+
50+
.PHONY: all v4l sdl opencv install uninstall clean
51+
52+
all: libquirc.$(LIB_SUFFIX) qrtest
53+
54+
v4l: quirc-scanner
55+
56+
sdl: inspect quirc-demo
57+
58+
opencv: inspect-opencv quirc-demo-opencv
59+
60+
qrtest: tests/dbgutil.o tests/qrtest.o libquirc.a
61+
$(CC) -o $@ tests/dbgutil.o tests/qrtest.o libquirc.a $(LDFLAGS) -lm -ljpeg -lpng
62+
63+
inspect: tests/dbgutil.o tests/inspect.o libquirc.a
64+
$(CC) -o $@ tests/dbgutil.o tests/inspect.o libquirc.a $(LDFLAGS) -lm -ljpeg -lpng $(SDL_LIBS) -lSDL_gfx
65+
66+
inspect-opencv: tests/dbgutil.o tests/inspect_opencv.o libquirc.a
67+
$(CXX) -o $@ tests/dbgutil.o tests/inspect_opencv.o libquirc.a $(LDFLAGS) -lm -ljpeg -lpng $(OPENCV_LIBS)
68+
69+
quirc-demo: $(DEMO_OBJ) $(DEMO_UTIL_OBJ) demo/demo.o libquirc.a
70+
$(CC) -o $@ $(DEMO_OBJ) $(DEMO_UTIL_OBJ) demo/demo.o libquirc.a $(LDFLAGS) -lm -ljpeg $(SDL_LIBS) -lSDL_gfx
71+
72+
quirc-demo-opencv: $(DEMO_UTIL_OBJ) demo/demo_opencv.o libquirc.a
73+
$(CXX) -o $@ $(DEMO_UTIL_OBJ) demo/demo_opencv.o libquirc.a $(LDFLAGS) -lm $(OPENCV_LIBS)
74+
75+
quirc-scanner: $(DEMO_OBJ) $(DEMO_UTIL_OBJ) demo/scanner.o libquirc.a
76+
$(CC) -o $@ $(DEMO_OBJ) $(DEMO_UTIL_OBJ) demo/scanner.o libquirc.a $(LDFLAGS) -lm -ljpeg
77+
78+
libquirc.a: $(LIB_OBJ)
79+
rm -f $@
80+
ar cru $@ $(LIB_OBJ)
81+
ranlib $@
82+
83+
libquirc.$(LIB_SUFFIX): libquirc.$(VERSIONED_LIB_SUFFIX)
84+
ln -s $< $@
85+
86+
libquirc.$(VERSIONED_LIB_SUFFIX): $(LIB_OBJ)
87+
$(CC) -shared -o $@ $(LIB_OBJ) $(LDFLAGS) -lm
88+
89+
.c.o:
90+
$(CC) $(QUIRC_CFLAGS) -o $@ -c $<
91+
92+
.SUFFIXES: .cxx
93+
.cxx.o:
94+
$(CXX) $(QUIRC_CXXFLAGS) -o $@ -c $<
95+
96+
install: libquirc.a libquirc.$(LIB_SUFFIX) quirc-demo quirc-scanner
97+
install -o root -g root -m 0644 lib/quirc.h $(DESTDIR)$(PREFIX)/include
98+
install -o root -g root -m 0644 libquirc.a $(DESTDIR)$(PREFIX)/lib
99+
install -o root -g root -m 0755 libquirc.$(VERSIONED_LIB_SUFFIX) \
100+
$(DESTDIR)$(PREFIX)/lib
101+
cp -d libquirc.$(LIB_SUFFIX) $(DESTDIR)$(PREFIX)/lib
102+
install -o root -g root -m 0755 quirc-demo $(DESTDIR)$(PREFIX)/bin
103+
# install -o root -g root -m 0755 quirc-demo-opencv $(DESTDIR)$(PREFIX)/bin
104+
install -o root -g root -m 0755 quirc-scanner $(DESTDIR)$(PREFIX)/bin
105+
106+
uninstall:
107+
rm -f $(DESTDIR)$(PREFIX)/include/quirc.h
108+
rm -f $(DESTDIR)$(PREFIX)/lib/libquirc.{$(LIB_SUFFIX),$(VERSIONED_LIB_SUFFIX)}
109+
rm -f $(DESTDIR)$(PREFIX)/lib/libquirc.a
110+
rm -f $(DESTDIR)$(PREFIX)/bin/quirc-demo
111+
rm -f $(DESTDIR)$(PREFIX)/bin/quirc-demo-opencv
112+
rm -f $(DESTDIR)$(PREFIX)/bin/quirc-scanner
113+
114+
clean:
115+
rm -f */*.o
116+
rm -f */*.lo
117+
rm -f libquirc.a
118+
rm -f libquirc.{$(LIB_SUFFIX),$(VERSIONED_LIB_SUFFIX)}
119+
rm -f qrtest
120+
rm -f inspect
121+
rm -f inspect-opencv
122+
rm -f quirc-demo
123+
rm -f quirc-demo-opencv
124+
rm -f quirc-scanner

0 commit comments

Comments
 (0)