fastqr 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/BUILD.md +482 -0
- data/CHANGELOG.md +51 -0
- data/CMakeLists.txt +126 -0
- data/CONTRIBUTING.md +63 -0
- data/DISTRIBUTION.md +730 -0
- data/INSTALL.md +171 -0
- data/LICENSE +39 -0
- data/PREBUILT.md +171 -0
- data/README.md +312 -0
- data/VERSION +1 -0
- data/bindings/nodejs/binding.gyp +38 -0
- data/bindings/nodejs/fastqr_node.cpp +125 -0
- data/bindings/nodejs/index.d.ts +80 -0
- data/bindings/nodejs/index.js +187 -0
- data/bindings/nodejs/lib/platform.js +72 -0
- data/bindings/nodejs/package.json +45 -0
- data/bindings/nodejs/test/test.js +45 -0
- data/bindings/php/fastqr_php.cpp +85 -0
- data/bindings/php/src/FastQR.php +316 -0
- data/bindings/php/tests/FastQRTest.php +97 -0
- data/bindings/ruby/extconf.rb +29 -0
- data/bindings/ruby/fastqr_ruby.cpp +122 -0
- data/bindings/ruby/lib/fastqr/platform.rb +70 -0
- data/bindings/ruby/lib/fastqr/version.rb +6 -0
- data/bindings/ruby/lib/fastqr.rb +129 -0
- data/bindings/ruby/prebuilt/macos-arm64.tar.gz +1 -0
- data/bindings/ruby/prebuilt/macos-x86_64.tar.gz +1 -0
- data/build.sh +109 -0
- data/cmake/fastqrConfig.cmake.in +6 -0
- data/composer.json +36 -0
- data/docs/CLI_USAGE.md +478 -0
- data/docs/NODEJS_USAGE.md +694 -0
- data/docs/PHP_USAGE.md +815 -0
- data/docs/README.md +191 -0
- data/docs/RUBY_USAGE.md +537 -0
- data/examples/CMakeLists.txt +7 -0
- data/examples/basic.cpp +58 -0
- data/include/fastqr.h +97 -0
- data/include/stb_image.h +7988 -0
- data/include/stb_image_write.h +1724 -0
- data/phpunit.xml +18 -0
- data/prebuilt/README.md +131 -0
- data/scripts/README.md +248 -0
- data/scripts/build-binaries.sh +98 -0
- data/scripts/build-local.sh +18 -0
- data/scripts/install.sh +87 -0
- data/scripts/release.sh +78 -0
- data/scripts/update-version.sh +58 -0
- data/src/cli.cpp +316 -0
- data/src/fastqr.cpp +665 -0
- data/test.sh +86 -0
- metadata +155 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 3cfb16eee23a1070b11b2013601477652c38b61eb11e202fd14de3864de6dc16
|
|
4
|
+
data.tar.gz: 4b9b60fb37a427f9921a4bb80bf32cddb7167fd7ea6e07f1938080885305f8a8
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 2a032ae6df4927909e110905199b26fd970abd8e59dd7d34eb3e718152f096da724fd153db2c570f8e31bea34769c98a696b982e00552ce1dec395ebf5fc0d3a
|
|
7
|
+
data.tar.gz: 96a2b4db93bef4d77105b6439143bd52570a64fa4d3db13a7760284d126d46c8b534d068a32f0109c17a9b0daf159a4c55c8d1b2db31e3d26015db9ddede7d7f
|
data/BUILD.md
ADDED
|
@@ -0,0 +1,482 @@
|
|
|
1
|
+
# Building FastQR from Source
|
|
2
|
+
|
|
3
|
+
This guide explains how to build FastQR from source, including building with custom versions of libqrencode and libvips (as required by LGPL).
|
|
4
|
+
|
|
5
|
+
## 📋 Requirements
|
|
6
|
+
|
|
7
|
+
### All Platforms
|
|
8
|
+
|
|
9
|
+
- C++14 compatible compiler (GCC 5+, Clang 3.4+, MSVC 2017+)
|
|
10
|
+
- CMake 3.15 or higher
|
|
11
|
+
- Git
|
|
12
|
+
|
|
13
|
+
### Dependencies
|
|
14
|
+
|
|
15
|
+
- **libqrencode** (version 4.0+)
|
|
16
|
+
- **libvips** (version 8.10+)
|
|
17
|
+
|
|
18
|
+
## 🍎 macOS
|
|
19
|
+
|
|
20
|
+
### Install Dependencies
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Using Homebrew
|
|
24
|
+
brew install cmake qrencode vips pkg-config
|
|
25
|
+
|
|
26
|
+
# Or build from source (see below)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Build FastQR
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Clone repository
|
|
33
|
+
git clone https://github.com/tranhuucanh/fastqr.git
|
|
34
|
+
cd fastqr
|
|
35
|
+
|
|
36
|
+
# Create build directory
|
|
37
|
+
mkdir build
|
|
38
|
+
cd build
|
|
39
|
+
|
|
40
|
+
# Configure
|
|
41
|
+
cmake .. \
|
|
42
|
+
-DCMAKE_BUILD_TYPE=Release \
|
|
43
|
+
-DCMAKE_INSTALL_PREFIX=/usr/local
|
|
44
|
+
|
|
45
|
+
# Build
|
|
46
|
+
make -j$(sysctl -n hw.ncpu)
|
|
47
|
+
|
|
48
|
+
# Test
|
|
49
|
+
make test
|
|
50
|
+
|
|
51
|
+
# Install
|
|
52
|
+
sudo make install
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Build with Custom libqrencode
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Build libqrencode from source
|
|
59
|
+
cd /tmp
|
|
60
|
+
git clone https://github.com/fukuchi/libqrencode.git
|
|
61
|
+
cd libqrencode
|
|
62
|
+
./autogen.sh
|
|
63
|
+
./configure --prefix=/usr/local
|
|
64
|
+
make
|
|
65
|
+
sudo make install
|
|
66
|
+
|
|
67
|
+
# Build FastQR
|
|
68
|
+
cd /path/to/fastqr
|
|
69
|
+
mkdir build && cd build
|
|
70
|
+
cmake .. -DCMAKE_PREFIX_PATH=/usr/local
|
|
71
|
+
make
|
|
72
|
+
sudo make install
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Build with Custom libvips
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Install libvips dependencies
|
|
79
|
+
brew install glib libpng libjpeg libexif
|
|
80
|
+
|
|
81
|
+
# Build libvips from source
|
|
82
|
+
cd /tmp
|
|
83
|
+
git clone https://github.com/libvips/libvips.git
|
|
84
|
+
cd libvips
|
|
85
|
+
./autogen.sh
|
|
86
|
+
./configure --prefix=/usr/local
|
|
87
|
+
make
|
|
88
|
+
sudo make install
|
|
89
|
+
|
|
90
|
+
# Build FastQR
|
|
91
|
+
cd /path/to/fastqr
|
|
92
|
+
mkdir build && cd build
|
|
93
|
+
cmake .. -DCMAKE_PREFIX_PATH=/usr/local
|
|
94
|
+
make
|
|
95
|
+
sudo make install
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## 🐧 Ubuntu/Debian
|
|
99
|
+
|
|
100
|
+
### Install Dependencies
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
# Ubuntu 20.04+, Debian 11+
|
|
104
|
+
sudo apt-get update
|
|
105
|
+
sudo apt-get install -y \
|
|
106
|
+
build-essential \
|
|
107
|
+
cmake \
|
|
108
|
+
pkg-config \
|
|
109
|
+
libqrencode-dev \
|
|
110
|
+
libvips-dev \
|
|
111
|
+
git
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Build FastQR
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# Clone repository
|
|
118
|
+
git clone https://github.com/tranhuucanh/fastqr.git
|
|
119
|
+
cd fastqr
|
|
120
|
+
|
|
121
|
+
# Create build directory
|
|
122
|
+
mkdir build
|
|
123
|
+
cd build
|
|
124
|
+
|
|
125
|
+
# Configure
|
|
126
|
+
cmake .. \
|
|
127
|
+
-DCMAKE_BUILD_TYPE=Release \
|
|
128
|
+
-DCMAKE_INSTALL_PREFIX=/usr/local
|
|
129
|
+
|
|
130
|
+
# Build
|
|
131
|
+
make -j$(nproc)
|
|
132
|
+
|
|
133
|
+
# Test
|
|
134
|
+
make test
|
|
135
|
+
|
|
136
|
+
# Install
|
|
137
|
+
sudo make install
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Build with Custom libqrencode
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
# Install build dependencies
|
|
144
|
+
sudo apt-get install -y autoconf automake libtool libpng-dev
|
|
145
|
+
|
|
146
|
+
# Build libqrencode
|
|
147
|
+
cd /tmp
|
|
148
|
+
git clone https://github.com/fukuchi/libqrencode.git
|
|
149
|
+
cd libqrencode
|
|
150
|
+
./autogen.sh
|
|
151
|
+
./configure --prefix=/usr/local
|
|
152
|
+
make
|
|
153
|
+
sudo make install
|
|
154
|
+
sudo ldconfig
|
|
155
|
+
|
|
156
|
+
# Build FastQR
|
|
157
|
+
cd /path/to/fastqr
|
|
158
|
+
mkdir build && cd build
|
|
159
|
+
cmake .. -DCMAKE_PREFIX_PATH=/usr/local
|
|
160
|
+
make
|
|
161
|
+
sudo make install
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Build with Custom libvips
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
# Install libvips dependencies
|
|
168
|
+
sudo apt-get install -y \
|
|
169
|
+
libglib2.0-dev \
|
|
170
|
+
libexpat1-dev \
|
|
171
|
+
libjpeg-dev \
|
|
172
|
+
libpng-dev \
|
|
173
|
+
libwebp-dev \
|
|
174
|
+
libtiff-dev \
|
|
175
|
+
libexif-dev
|
|
176
|
+
|
|
177
|
+
# Build libvips
|
|
178
|
+
cd /tmp
|
|
179
|
+
git clone https://github.com/libvips/libvips.git
|
|
180
|
+
cd libvips
|
|
181
|
+
./autogen.sh
|
|
182
|
+
./configure --prefix=/usr/local
|
|
183
|
+
make
|
|
184
|
+
sudo make install
|
|
185
|
+
sudo ldconfig
|
|
186
|
+
|
|
187
|
+
# Build FastQR
|
|
188
|
+
cd /path/to/fastqr
|
|
189
|
+
mkdir build && cd build
|
|
190
|
+
cmake .. -DCMAKE_PREFIX_PATH=/usr/local
|
|
191
|
+
make
|
|
192
|
+
sudo make install
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## 🪟 Windows (MSVC)
|
|
196
|
+
|
|
197
|
+
### Install Dependencies
|
|
198
|
+
|
|
199
|
+
1. Install Visual Studio 2019 or later with C++ support
|
|
200
|
+
2. Install CMake from https://cmake.org/download/
|
|
201
|
+
3. Install vcpkg:
|
|
202
|
+
|
|
203
|
+
```powershell
|
|
204
|
+
cd C:\
|
|
205
|
+
git clone https://github.com/Microsoft/vcpkg.git
|
|
206
|
+
cd vcpkg
|
|
207
|
+
.\bootstrap-vcpkg.bat
|
|
208
|
+
.\vcpkg integrate install
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
4. Install dependencies:
|
|
212
|
+
|
|
213
|
+
```powershell
|
|
214
|
+
.\vcpkg install qrencode:x64-windows
|
|
215
|
+
.\vcpkg install vips:x64-windows
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Build FastQR
|
|
219
|
+
|
|
220
|
+
```powershell
|
|
221
|
+
# Clone repository
|
|
222
|
+
git clone https://github.com/tranhuucanh/fastqr.git
|
|
223
|
+
cd fastqr
|
|
224
|
+
|
|
225
|
+
# Create build directory
|
|
226
|
+
mkdir build
|
|
227
|
+
cd build
|
|
228
|
+
|
|
229
|
+
# Configure
|
|
230
|
+
cmake .. `
|
|
231
|
+
-DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake `
|
|
232
|
+
-DCMAKE_BUILD_TYPE=Release
|
|
233
|
+
|
|
234
|
+
# Build
|
|
235
|
+
cmake --build . --config Release
|
|
236
|
+
|
|
237
|
+
# Install
|
|
238
|
+
cmake --install . --prefix C:\fastqr
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## 🔧 CMake Build Options
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
# Build shared library (default: static)
|
|
245
|
+
cmake .. -DBUILD_SHARED_LIBS=ON
|
|
246
|
+
|
|
247
|
+
# Disable examples
|
|
248
|
+
cmake .. -DFASTQR_BUILD_EXAMPLES=OFF
|
|
249
|
+
|
|
250
|
+
# Disable bindings
|
|
251
|
+
cmake .. -DFASTQR_BUILD_BINDINGS=OFF
|
|
252
|
+
|
|
253
|
+
# Custom install prefix
|
|
254
|
+
cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/local
|
|
255
|
+
|
|
256
|
+
# Debug build
|
|
257
|
+
cmake .. -DCMAKE_BUILD_TYPE=Debug
|
|
258
|
+
|
|
259
|
+
# Specify C++ compiler
|
|
260
|
+
cmake .. -DCMAKE_CXX_COMPILER=clang++
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
## 🧪 Running Tests
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
cd build
|
|
267
|
+
|
|
268
|
+
# Run all tests
|
|
269
|
+
make test
|
|
270
|
+
|
|
271
|
+
# Or use ctest
|
|
272
|
+
ctest --output-on-failure
|
|
273
|
+
|
|
274
|
+
# Run specific test
|
|
275
|
+
ctest -R basic_test
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
## 💎 Building Ruby Gem
|
|
279
|
+
|
|
280
|
+
```bash
|
|
281
|
+
cd /path/to/fastqr
|
|
282
|
+
|
|
283
|
+
# Install dependencies
|
|
284
|
+
gem install rake rake-compiler
|
|
285
|
+
|
|
286
|
+
# Build gem
|
|
287
|
+
gem build fastqr.gemspec
|
|
288
|
+
|
|
289
|
+
# Install locally
|
|
290
|
+
gem install fastqr-1.0.0.gem
|
|
291
|
+
|
|
292
|
+
# Test
|
|
293
|
+
ruby -rfastqr -e "puts FastQR.version"
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
### Building Ruby Gem with Custom Libraries
|
|
297
|
+
|
|
298
|
+
```bash
|
|
299
|
+
# Set library paths
|
|
300
|
+
export LIBRARY_PATH=/usr/local/lib:$LIBRARY_PATH
|
|
301
|
+
export C_INCLUDE_PATH=/usr/local/include:$C_INCLUDE_PATH
|
|
302
|
+
export CPLUS_INCLUDE_PATH=/usr/local/include:$CPLUS_INCLUDE_PATH
|
|
303
|
+
|
|
304
|
+
# Build gem
|
|
305
|
+
gem build fastqr.gemspec
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
## 📦 Building Node.js Module
|
|
309
|
+
|
|
310
|
+
```bash
|
|
311
|
+
cd /path/to/fastqr/bindings/nodejs
|
|
312
|
+
|
|
313
|
+
# Install dependencies
|
|
314
|
+
npm install
|
|
315
|
+
|
|
316
|
+
# Build native addon
|
|
317
|
+
npm run install
|
|
318
|
+
|
|
319
|
+
# Test
|
|
320
|
+
npm test
|
|
321
|
+
|
|
322
|
+
# Create tarball
|
|
323
|
+
npm pack
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
### Building Node.js Module with Custom Libraries
|
|
327
|
+
|
|
328
|
+
```bash
|
|
329
|
+
cd bindings/nodejs
|
|
330
|
+
|
|
331
|
+
# Set PKG_CONFIG_PATH
|
|
332
|
+
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
|
|
333
|
+
|
|
334
|
+
# Build
|
|
335
|
+
npm run install
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
## 🐘 Building PHP Extension
|
|
339
|
+
|
|
340
|
+
PHP uses FFI, so no compilation needed. Just ensure libfastqr is installed:
|
|
341
|
+
|
|
342
|
+
```bash
|
|
343
|
+
# Build and install libfastqr
|
|
344
|
+
cd /path/to/fastqr
|
|
345
|
+
mkdir build && cd build
|
|
346
|
+
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local
|
|
347
|
+
make
|
|
348
|
+
sudo make install
|
|
349
|
+
|
|
350
|
+
# Test PHP binding
|
|
351
|
+
cd ../bindings/php
|
|
352
|
+
composer install
|
|
353
|
+
vendor/bin/phpunit
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
## 🔍 Troubleshooting
|
|
357
|
+
|
|
358
|
+
### "qrencode.h not found"
|
|
359
|
+
|
|
360
|
+
```bash
|
|
361
|
+
# Make sure qrencode is installed
|
|
362
|
+
pkg-config --modversion libqrencode
|
|
363
|
+
|
|
364
|
+
# If not found, install or add to PKG_CONFIG_PATH
|
|
365
|
+
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
### "vips.h not found"
|
|
369
|
+
|
|
370
|
+
```bash
|
|
371
|
+
# Make sure vips is installed
|
|
372
|
+
pkg-config --modversion vips
|
|
373
|
+
|
|
374
|
+
# If not found, install or add to PKG_CONFIG_PATH
|
|
375
|
+
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
### "Library not found" at runtime
|
|
379
|
+
|
|
380
|
+
```bash
|
|
381
|
+
# macOS
|
|
382
|
+
export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATH
|
|
383
|
+
|
|
384
|
+
# Linux
|
|
385
|
+
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
|
|
386
|
+
sudo ldconfig
|
|
387
|
+
|
|
388
|
+
# Or add to system library path
|
|
389
|
+
# macOS: Add to /etc/ld.so.conf
|
|
390
|
+
# Linux: sudo ldconfig /usr/local/lib
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
### CMake can't find libraries
|
|
394
|
+
|
|
395
|
+
```bash
|
|
396
|
+
# Specify library locations explicitly
|
|
397
|
+
cmake .. \
|
|
398
|
+
-DQRENCODE_INCLUDE_DIR=/usr/local/include \
|
|
399
|
+
-DQRENCODE_LIBRARY=/usr/local/lib/libqrencode.a \
|
|
400
|
+
-DVIPS_INCLUDE_DIR=/usr/local/include \
|
|
401
|
+
-DVIPS_LIBRARY=/usr/local/lib/libvips.a
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
### Ruby gem fails to build
|
|
405
|
+
|
|
406
|
+
```bash
|
|
407
|
+
# Install development headers
|
|
408
|
+
# Ubuntu/Debian:
|
|
409
|
+
sudo apt-get install ruby-dev
|
|
410
|
+
|
|
411
|
+
# macOS: Already included with Homebrew Ruby
|
|
412
|
+
|
|
413
|
+
# Check Ruby configuration
|
|
414
|
+
ruby -rrbconfig -e 'puts RbConfig::CONFIG["CC"]'
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
### Node.js module fails to build
|
|
418
|
+
|
|
419
|
+
```bash
|
|
420
|
+
# Install node-gyp globally
|
|
421
|
+
npm install -g node-gyp
|
|
422
|
+
|
|
423
|
+
# Rebuild
|
|
424
|
+
node-gyp rebuild
|
|
425
|
+
|
|
426
|
+
# Clean and rebuild
|
|
427
|
+
node-gyp clean
|
|
428
|
+
node-gyp configure
|
|
429
|
+
node-gyp build
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
## 📝 LGPL Compliance Notes
|
|
433
|
+
|
|
434
|
+
FastQR uses **LGPL 2.1** license and statically links with:
|
|
435
|
+
- libqrencode (LGPL 2.1)
|
|
436
|
+
- libvips (LGPL 2.1+)
|
|
437
|
+
|
|
438
|
+
As required by LGPL, you can:
|
|
439
|
+
|
|
440
|
+
1. **Replace the library**: Build FastQR with different versions of libqrencode/libvips using the instructions above
|
|
441
|
+
2. **Modify the library**: Fork and modify libqrencode/libvips, then build FastQR against your modified versions
|
|
442
|
+
3. **Link dynamically**: Use `-DBUILD_SHARED_LIBS=ON` to build shared library instead of static
|
|
443
|
+
|
|
444
|
+
### Example: Using Modified libqrencode
|
|
445
|
+
|
|
446
|
+
```bash
|
|
447
|
+
# 1. Fork and modify libqrencode
|
|
448
|
+
git clone https://github.com/yourfork/libqrencode.git
|
|
449
|
+
cd libqrencode
|
|
450
|
+
# Make your changes
|
|
451
|
+
./autogen.sh
|
|
452
|
+
./configure --prefix=$HOME/custom
|
|
453
|
+
make install
|
|
454
|
+
|
|
455
|
+
# 2. Build FastQR with your modified libqrencode
|
|
456
|
+
cd /path/to/fastqr
|
|
457
|
+
mkdir build && cd build
|
|
458
|
+
cmake .. -DCMAKE_PREFIX_PATH=$HOME/custom
|
|
459
|
+
make
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
This satisfies LGPL requirement that users must be able to replace/modify the LGPL libraries.
|
|
463
|
+
|
|
464
|
+
## 🆘 Getting Help
|
|
465
|
+
|
|
466
|
+
If you encounter issues:
|
|
467
|
+
|
|
468
|
+
1. Check this BUILD.md
|
|
469
|
+
2. Check GitHub Issues: https://github.com/tranhuucanh/fastqr/issues
|
|
470
|
+
3. Open a new issue with:
|
|
471
|
+
- Your OS and version
|
|
472
|
+
- Compiler version
|
|
473
|
+
- CMake output
|
|
474
|
+
- Error messages
|
|
475
|
+
|
|
476
|
+
## 📚 Resources
|
|
477
|
+
|
|
478
|
+
- [CMake Documentation](https://cmake.org/documentation/)
|
|
479
|
+
- [libqrencode](https://github.com/fukuchi/libqrencode)
|
|
480
|
+
- [libvips](https://github.com/libvips/libvips)
|
|
481
|
+
- [LGPL v2.1 License](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html)
|
|
482
|
+
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [1.0.0] - 2025-10-18
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Initial release of FastQR
|
|
12
|
+
- Core C++ library with libqrencode and libvips integration
|
|
13
|
+
- Full UTF-8 support (Vietnamese, Japanese, Chinese, emoji, etc.)
|
|
14
|
+
- Custom color support for QR code and background
|
|
15
|
+
- Precise size control (exact pixel dimensions)
|
|
16
|
+
- Logo embedding capability
|
|
17
|
+
- Error correction levels (L, M, Q, H)
|
|
18
|
+
- Multiple output formats (PNG, JPG, WebP)
|
|
19
|
+
- CLI tool with comprehensive options
|
|
20
|
+
- Ruby binding (Gem)
|
|
21
|
+
- Node.js binding (npm) with TypeScript definitions
|
|
22
|
+
- PHP binding (Composer) using FFI
|
|
23
|
+
- CMake build system
|
|
24
|
+
- Comprehensive documentation (README, BUILD, DISTRIBUTION)
|
|
25
|
+
- Example code
|
|
26
|
+
- Unit tests for all bindings
|
|
27
|
+
- LGPL 2.1 license compliance
|
|
28
|
+
- macOS and Linux support
|
|
29
|
+
|
|
30
|
+
### Features
|
|
31
|
+
- Generate QR codes with exact dimensions (e.g., 2000x2000px)
|
|
32
|
+
- Support for all UTF-8 characters
|
|
33
|
+
- RGB color customization for foreground and background
|
|
34
|
+
- Logo overlay with size percentage control
|
|
35
|
+
- 4 error correction levels
|
|
36
|
+
- Quality control for lossy formats
|
|
37
|
+
- Fast performance (no process forking)
|
|
38
|
+
|
|
39
|
+
### Bindings
|
|
40
|
+
- **Ruby**: Full-featured gem with native extension
|
|
41
|
+
- **Node.js**: Native addon with N-API
|
|
42
|
+
- **PHP**: FFI-based binding (no compilation needed)
|
|
43
|
+
|
|
44
|
+
### Documentation
|
|
45
|
+
- Comprehensive README with examples
|
|
46
|
+
- BUILD.md with detailed compilation instructions
|
|
47
|
+
- DISTRIBUTION.md with publishing guides for all package managers
|
|
48
|
+
- API documentation for all languages
|
|
49
|
+
|
|
50
|
+
[1.0.0]: https://github.com/tranhuucanh/fastqr/releases/tag/v1.0.0
|
|
51
|
+
|
data/CMakeLists.txt
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.15)
|
|
2
|
+
project(fastqr VERSION 1.0.0 LANGUAGES CXX C)
|
|
3
|
+
|
|
4
|
+
set(CMAKE_CXX_STANDARD 14)
|
|
5
|
+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
6
|
+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
|
7
|
+
|
|
8
|
+
# Optimization flags for maximum performance
|
|
9
|
+
if(NOT CMAKE_BUILD_TYPE)
|
|
10
|
+
set(CMAKE_BUILD_TYPE Release)
|
|
11
|
+
endif()
|
|
12
|
+
|
|
13
|
+
set(CMAKE_CXX_FLAGS_RELEASE "-Ofast -DNDEBUG -march=native -flto")
|
|
14
|
+
set(CMAKE_C_FLAGS_RELEASE "-Ofast -DNDEBUG -march=native -flto")
|
|
15
|
+
|
|
16
|
+
# Options
|
|
17
|
+
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
|
|
18
|
+
option(FASTQR_BUILD_EXAMPLES "Build examples" ON)
|
|
19
|
+
option(FASTQR_BUILD_BINDINGS "Build language bindings" ON)
|
|
20
|
+
|
|
21
|
+
# Find dependencies
|
|
22
|
+
find_package(PkgConfig REQUIRED)
|
|
23
|
+
find_package(PNG REQUIRED)
|
|
24
|
+
|
|
25
|
+
# Find libqrencode
|
|
26
|
+
pkg_check_modules(QRENCODE REQUIRED libqrencode)
|
|
27
|
+
|
|
28
|
+
# Add library directories
|
|
29
|
+
link_directories(${QRENCODE_LIBRARY_DIRS})
|
|
30
|
+
|
|
31
|
+
# Main library
|
|
32
|
+
add_library(fastqr
|
|
33
|
+
src/fastqr.cpp
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
target_include_directories(fastqr
|
|
37
|
+
PUBLIC
|
|
38
|
+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
39
|
+
$<INSTALL_INTERFACE:include>
|
|
40
|
+
PRIVATE
|
|
41
|
+
${QRENCODE_INCLUDE_DIRS}
|
|
42
|
+
${PNG_INCLUDE_DIRS}
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
target_link_directories(fastqr
|
|
46
|
+
PRIVATE
|
|
47
|
+
${QRENCODE_LIBRARY_DIRS}
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
target_link_libraries(fastqr
|
|
51
|
+
PRIVATE
|
|
52
|
+
${QRENCODE_LIBRARIES}
|
|
53
|
+
PNG::PNG
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
target_compile_options(fastqr
|
|
57
|
+
PRIVATE
|
|
58
|
+
${QRENCODE_CFLAGS_OTHER}
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
# Set library output name
|
|
62
|
+
set_target_properties(fastqr PROPERTIES
|
|
63
|
+
VERSION ${PROJECT_VERSION}
|
|
64
|
+
SOVERSION 1
|
|
65
|
+
OUTPUT_NAME fastqr
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
# CLI tool
|
|
69
|
+
add_executable(fastqr-cli
|
|
70
|
+
src/cli.cpp
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
target_link_libraries(fastqr-cli
|
|
74
|
+
PRIVATE fastqr
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
set_target_properties(fastqr-cli PROPERTIES
|
|
78
|
+
OUTPUT_NAME fastqr
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
# Examples
|
|
82
|
+
if(FASTQR_BUILD_EXAMPLES)
|
|
83
|
+
add_subdirectory(examples)
|
|
84
|
+
endif()
|
|
85
|
+
|
|
86
|
+
# Install
|
|
87
|
+
include(GNUInstallDirs)
|
|
88
|
+
|
|
89
|
+
install(TARGETS fastqr fastqr-cli
|
|
90
|
+
EXPORT fastqrTargets
|
|
91
|
+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
92
|
+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
93
|
+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
install(FILES include/fastqr.h
|
|
97
|
+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
install(EXPORT fastqrTargets
|
|
101
|
+
FILE fastqrTargets.cmake
|
|
102
|
+
NAMESPACE fastqr::
|
|
103
|
+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/fastqr
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
# Create config file
|
|
107
|
+
include(CMakePackageConfigHelpers)
|
|
108
|
+
|
|
109
|
+
configure_package_config_file(
|
|
110
|
+
${CMAKE_CURRENT_SOURCE_DIR}/cmake/fastqrConfig.cmake.in
|
|
111
|
+
${CMAKE_CURRENT_BINARY_DIR}/fastqrConfig.cmake
|
|
112
|
+
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/fastqr
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
write_basic_package_version_file(
|
|
116
|
+
${CMAKE_CURRENT_BINARY_DIR}/fastqrConfigVersion.cmake
|
|
117
|
+
VERSION ${PROJECT_VERSION}
|
|
118
|
+
COMPATIBILITY SameMajorVersion
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
install(FILES
|
|
122
|
+
${CMAKE_CURRENT_BINARY_DIR}/fastqrConfig.cmake
|
|
123
|
+
${CMAKE_CURRENT_BINARY_DIR}/fastqrConfigVersion.cmake
|
|
124
|
+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/fastqr
|
|
125
|
+
)
|
|
126
|
+
|
data/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Contributing to FastQR
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to FastQR! This document provides guidelines and instructions for contributing.
|
|
4
|
+
|
|
5
|
+
## 🤝 How to Contribute
|
|
6
|
+
|
|
7
|
+
### Reporting Bugs
|
|
8
|
+
|
|
9
|
+
1. Check if the bug has already been reported in [Issues](https://github.com/tranhuucanh/fastqr/issues)
|
|
10
|
+
2. If not, create a new issue with:
|
|
11
|
+
- Clear title and description
|
|
12
|
+
- Steps to reproduce
|
|
13
|
+
- Expected vs actual behavior
|
|
14
|
+
- Your environment (OS, compiler, library versions)
|
|
15
|
+
- Code samples or test cases
|
|
16
|
+
|
|
17
|
+
### Suggesting Features
|
|
18
|
+
|
|
19
|
+
1. Check [Issues](https://github.com/tranhuucanh/fastqr/issues) for similar requests
|
|
20
|
+
2. Create a new issue tagged with "enhancement"
|
|
21
|
+
3. Describe the feature and its use case
|
|
22
|
+
4. Explain why it would be useful
|
|
23
|
+
|
|
24
|
+
### Pull Requests
|
|
25
|
+
|
|
26
|
+
1. Fork the repository
|
|
27
|
+
2. Create a feature branch: `git checkout -b feature/amazing-feature`
|
|
28
|
+
3. Make your changes
|
|
29
|
+
4. Add tests for new functionality
|
|
30
|
+
5. Ensure all tests pass: `make test`
|
|
31
|
+
6. Commit with clear messages: `git commit -m 'Add amazing feature'`
|
|
32
|
+
7. Push to your fork: `git push origin feature/amazing-feature`
|
|
33
|
+
8. Open a Pull Request
|
|
34
|
+
|
|
35
|
+
## 📝 Development Guidelines
|
|
36
|
+
|
|
37
|
+
### Code Style
|
|
38
|
+
|
|
39
|
+
- **C++**: Follow Google C++ Style Guide
|
|
40
|
+
- **Ruby**: Follow Ruby Style Guide
|
|
41
|
+
- **JavaScript**: Follow Airbnb JavaScript Style Guide
|
|
42
|
+
- **PHP**: Follow PSR-12
|
|
43
|
+
|
|
44
|
+
### Commit Messages
|
|
45
|
+
|
|
46
|
+
- Use present tense: "Add feature" not "Added feature"
|
|
47
|
+
- Be descriptive but concise
|
|
48
|
+
- Reference issues: "Fix #123: Description"
|
|
49
|
+
|
|
50
|
+
### Testing
|
|
51
|
+
|
|
52
|
+
- Add tests for all new features
|
|
53
|
+
- Ensure existing tests pass
|
|
54
|
+
- Test on multiple platforms if possible
|
|
55
|
+
|
|
56
|
+
## 🏗️ Development Setup
|
|
57
|
+
|
|
58
|
+
See [BUILD.md](BUILD.md) for detailed build instructions.
|
|
59
|
+
|
|
60
|
+
## 📄 License
|
|
61
|
+
|
|
62
|
+
By contributing, you agree that your contributions will be licensed under LGPL 2.1.
|
|
63
|
+
|