fastqr 1.0.9 → 1.0.11

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ebdc094c4b99f58f52cb8e96663c42b155a036f419b2fa80239a92bbfb512eb9
4
- data.tar.gz: 6dbb33c8d3dd4c35e34db189d47f9ce18490f474fa8faebfa41d843b66ae833f
3
+ metadata.gz: cecb54f8189d6e136d9543e962a0e3c2852145fc35fd94f3a0a6615ebd95fa60
4
+ data.tar.gz: dbd35fdf0763e4792d96ca1ea5dceaa191e54b468d788ca00164224577cc7715
5
5
  SHA512:
6
- metadata.gz: 69e544be8d0454fccb215e7af53cbf8b0f3b50f0491f8cb3802b5070adcdae6265f82e795176488b4105bd174d9e000f37d53446c7f577684488ba28bfa2285f
7
- data.tar.gz: 7c2a36f574a7f61cb68d4d317e2e413a5241a86a37e7b2421f0bef36ac653fc1f52158752d41260471f9746eac276a75933e3d7473a8669e736f97929cd0f376
6
+ metadata.gz: c8e8967e977ebc246706b41848ef042b142d69370c136899a7959fa978a4c244c16894e3d22def54583f65fe432365bc758ed522d6b3b85b25519232cffadd67
7
+ data.tar.gz: 640f00a79e52a95f836b2b69e56ab106466ebcafa10c0dfb90096714c61a2abd95d1c3adf131a0f3c8b7f27b55ebf05ca701baa0c93d043a2cf831ae8583365c
data/CMakeLists.txt CHANGED
@@ -1,5 +1,5 @@
1
1
  cmake_minimum_required(VERSION 3.15)
2
- project(fastqr VERSION 1.0.9 LANGUAGES CXX C)
2
+ project(fastqr VERSION 1.0.11 LANGUAGES CXX C)
3
3
 
4
4
  set(CMAKE_CXX_STANDARD 14)
5
5
  set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -28,12 +28,12 @@ pkg_check_modules(QRENCODE REQUIRED libqrencode)
28
28
  # Add library directories
29
29
  link_directories(${QRENCODE_LIBRARY_DIRS})
30
30
 
31
- # Main library
32
- add_library(fastqr
31
+ # Object library for internal use (no linking yet)
32
+ add_library(fastqr_obj OBJECT
33
33
  src/fastqr.cpp
34
34
  )
35
35
 
36
- target_include_directories(fastqr
36
+ target_include_directories(fastqr_obj
37
37
  PUBLIC
38
38
  $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
39
39
  $<INSTALL_INTERFACE:include>
@@ -42,6 +42,22 @@ target_include_directories(fastqr
42
42
  ${PNG_INCLUDE_DIRS}
43
43
  )
44
44
 
45
+ target_compile_options(fastqr_obj
46
+ PRIVATE
47
+ ${QRENCODE_CFLAGS_OTHER}
48
+ )
49
+
50
+ # Main library (for install and linking by other projects)
51
+ add_library(fastqr
52
+ $<TARGET_OBJECTS:fastqr_obj>
53
+ )
54
+
55
+ target_include_directories(fastqr
56
+ PUBLIC
57
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
58
+ $<INSTALL_INTERFACE:include>
59
+ )
60
+
45
61
  target_link_directories(fastqr
46
62
  PRIVATE
47
63
  ${QRENCODE_LIBRARY_DIRS}
@@ -53,11 +69,6 @@ target_link_libraries(fastqr
53
69
  PNG::PNG
54
70
  )
55
71
 
56
- target_compile_options(fastqr
57
- PRIVATE
58
- ${QRENCODE_CFLAGS_OTHER}
59
- )
60
-
61
72
  # Set library output name
62
73
  set_target_properties(fastqr PROPERTIES
63
74
  VERSION ${PROJECT_VERSION}
@@ -70,9 +81,56 @@ add_executable(fastqr-cli
70
81
  src/cli.cpp
71
82
  )
72
83
 
73
- target_link_libraries(fastqr-cli
74
- PRIVATE fastqr
75
- )
84
+ # For standalone CLI binary, link with object library and static dependencies
85
+ if(NOT BUILD_SHARED_LIBS)
86
+ # Find static versions of libraries
87
+ find_library(PNG_STATIC_LIBRARY
88
+ NAMES libpng.a libpng16.a
89
+ PATHS
90
+ ${PNG_LIBRARY_DIRS}
91
+ /usr/local/lib
92
+ /opt/homebrew/lib
93
+ /usr/lib
94
+ NO_DEFAULT_PATH
95
+ )
96
+
97
+ find_library(QRENCODE_STATIC_LIBRARY
98
+ NAMES libqrencode.a
99
+ PATHS
100
+ ${QRENCODE_LIBRARY_DIRS}
101
+ /usr/local/lib
102
+ /opt/homebrew/lib
103
+ /usr/lib
104
+ NO_DEFAULT_PATH
105
+ )
106
+
107
+ if(PNG_STATIC_LIBRARY AND QRENCODE_STATIC_LIBRARY)
108
+ message(STATUS "✓ Found static libpng: ${PNG_STATIC_LIBRARY}")
109
+ message(STATUS "✓ Found static libqrencode: ${QRENCODE_STATIC_LIBRARY}")
110
+
111
+ # Link CLI directly with object library + static libs (no dependency propagation)
112
+ target_link_libraries(fastqr-cli
113
+ PRIVATE
114
+ fastqr_obj
115
+ ${QRENCODE_STATIC_LIBRARY}
116
+ ${PNG_STATIC_LIBRARY}
117
+ z # zlib is needed by libpng
118
+ )
119
+ else()
120
+ message(WARNING "Static libraries not found, falling back to dynamic linking")
121
+ message(WARNING " libpng: ${PNG_STATIC_LIBRARY}")
122
+ message(WARNING " libqrencode: ${QRENCODE_STATIC_LIBRARY}")
123
+
124
+ target_link_libraries(fastqr-cli
125
+ PRIVATE fastqr
126
+ )
127
+ endif()
128
+ else()
129
+ # Shared library build
130
+ target_link_libraries(fastqr-cli
131
+ PRIVATE fastqr
132
+ )
133
+ endif()
76
134
 
77
135
  set_target_properties(fastqr-cli PROPERTIES
78
136
  OUTPUT_NAME fastqr
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.9
1
+ 1.0.11
@@ -13,7 +13,7 @@ let fastqr;
13
13
  // Use pre-built CLI binary (no FFI needed!)
14
14
  if (platform.isPrebuiltAvailable()) {
15
15
  const cliPath = path.join(__dirname, 'prebuilt', platform.getPlatformString(), 'bin', 'fastqr');
16
-
16
+
17
17
  if (!fs.existsSync(cliPath)) {
18
18
  throw new Error(
19
19
  'FastQR CLI binary not found. Expected at: ' + cliPath + '\n' +
@@ -25,11 +25,11 @@ if (platform.isPrebuiltAvailable()) {
25
25
  fastqr = {
26
26
  generate: function(data, outputPath, options = {}) {
27
27
  const args = [data, outputPath];
28
-
28
+
29
29
  // Support both new 'size' and legacy 'width'/'height'
30
30
  const size = options.size || options.width || options.height || 300;
31
31
  args.push('-s', size.toString());
32
-
32
+
33
33
  if (options.optimizeSize) args.push('-o');
34
34
  if (options.foreground) args.push('-f', options.foreground.join(','));
35
35
  if (options.background) args.push('-b', options.background.join(','));
@@ -37,7 +37,7 @@ if (platform.isPrebuiltAvailable()) {
37
37
  if (options.logo) args.push('-l', options.logo);
38
38
  if (options.logoSize) args.push('-p', options.logoSize.toString());
39
39
  if (options.quality) args.push('-q', options.quality.toString());
40
-
40
+
41
41
  try {
42
42
  execFileSync(cliPath, args, { stdio: 'pipe' });
43
43
  return true;
@@ -55,7 +55,7 @@ if (platform.isPrebuiltAvailable()) {
55
55
  },
56
56
  VERSION: null // Will be set below
57
57
  };
58
-
58
+
59
59
  fastqr.VERSION = fastqr.version();
60
60
  } else {
61
61
  throw new Error(
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fastqr-pro",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "description": "Fast QR code generator with UTF-8 support, custom colors, logo embedding, and precise size control",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FastQR
4
- VERSION = "1.0.9"
4
+ VERSION = "1.0.11"
5
5
  end
6
6
 
@@ -3,33 +3,6 @@
3
3
  require_relative "fastqr/version"
4
4
  require_relative "fastqr/platform"
5
5
 
6
- # Load pre-built binary if available, otherwise try to load compiled extension
7
- begin
8
- if FastQR::Platform.prebuilt_available?
9
- # Load from pre-built binary
10
- require 'ffi'
11
-
12
- module FastQR
13
- module Native
14
- extend FFI::Library
15
-
16
- lib_path = Platform.lib_path
17
- ffi_lib lib_path
18
-
19
- # Define C functions
20
- attach_function :fastqr_generate_c, :fastqr_generate, [:string, :string, :pointer], :int
21
- attach_function :fastqr_version, [], :string
22
- end
23
- end
24
- else
25
- # Fall back to compiled extension
26
- require_relative "fastqr/fastqr"
27
- end
28
- rescue LoadError => e
29
- warn "Warning: Could not load FastQR native extension: #{e.message}"
30
- warn "Please run: gem install fastqr -- --with-system-libraries"
31
- end
32
-
33
6
  module FastQR
34
7
  class Error < StandardError; end
35
8
 
@@ -37,7 +10,11 @@ module FastQR
37
10
  #
38
11
  # @return [String] Version string
39
12
  def self.version
40
- Native.fastqr_version
13
+ cli_path = Platform.find_binary
14
+ output = `#{cli_path} -v 2>&1`.strip
15
+ output.sub('FastQR v', '')
16
+ rescue => e
17
+ VERSION
41
18
  end
42
19
 
43
20
  # Generate QR code with options
@@ -77,10 +54,22 @@ module FastQR
77
54
  raise Error, "Data cannot be empty" if data.nil? || data.empty?
78
55
  raise Error, "Output path cannot be empty" if output_path.nil? || output_path.empty?
79
56
 
80
- # TODO: Build C struct from options hash
81
- # For now, pass nil to use defaults
82
- result = Native.fastqr_generate_c(data, output_path, nil)
83
- raise Error, "Failed to generate QR code" unless result == 1
57
+ cli_path = Platform.find_binary
58
+ args = [data, output_path]
59
+
60
+ # Build command arguments from options
61
+ args += ['-s', options[:size].to_s] if options[:size]
62
+ args += ['-o'] if options[:optimize_size]
63
+ args += ['-f', options[:foreground].join(',')] if options[:foreground]
64
+ args += ['-b', options[:background].join(',')] if options[:background]
65
+ args += ['-e', options[:error_level]] if options[:error_level]
66
+ args += ['-l', options[:logo]] if options[:logo]
67
+ args += ['-p', options[:logo_size].to_s] if options[:logo_size]
68
+ args += ['-q', options[:quality].to_s] if options[:quality]
69
+
70
+ # Execute CLI binary
71
+ result = system(cli_path, *args, out: File::NULL, err: File::NULL)
72
+ raise Error, "Failed to generate QR code" unless result
84
73
 
85
74
  true
86
75
  end
@@ -37,10 +37,11 @@ rm -rf build
37
37
  mkdir build
38
38
  cd build
39
39
 
40
- # Configure with static linking
40
+ echo "🔧 Building standalone CLI with static linking..."
41
+ # Configure for standalone CLI (all dependencies static)
41
42
  cmake .. \
42
43
  -DCMAKE_BUILD_TYPE=Release \
43
- -DBUILD_SHARED_LIBS=ON \
44
+ -DBUILD_SHARED_LIBS=OFF \
44
45
  -DCMAKE_INSTALL_PREFIX="$PWD/install" \
45
46
  -DFASTQR_BUILD_EXAMPLES=OFF
46
47
 
@@ -51,34 +52,14 @@ else
51
52
  make -j$(nproc)
52
53
  fi
53
54
 
54
- # Install to temporary location
55
- make install DESTDIR="$PWD/staging"
56
-
57
55
  cd ..
58
56
 
59
- # Copy binaries
60
- if [[ "$OS" == "macos" ]]; then
61
- cp build/staging/usr/local/lib/libfastqr.*.dylib "$OUTPUT_DIR/lib/libfastqr.dylib" 2>/dev/null || \
62
- cp build/libfastqr.*.dylib "$OUTPUT_DIR/lib/libfastqr.dylib" 2>/dev/null || \
63
- cp build/libfastqr.dylib "$OUTPUT_DIR/lib/libfastqr.dylib"
57
+ # Copy standalone CLI binary (no dylib needed!)
58
+ cp build/fastqr "$OUTPUT_DIR/bin/fastqr"
59
+ echo " Built standalone CLI (all static - no dependencies!)"
64
60
 
65
- cp build/staging/usr/local/bin/fastqr "$OUTPUT_DIR/bin/fastqr" 2>/dev/null || \
66
- cp build/fastqr "$OUTPUT_DIR/bin/fastqr"
67
- else
68
- # Copy all .so files to lib directory
69
- if [ -f build/staging/usr/local/lib/libfastqr.so ]; then
70
- cp build/staging/usr/local/lib/libfastqr.so* "$OUTPUT_DIR/lib/"
71
- else
72
- cp build/libfastqr.so* "$OUTPUT_DIR/lib/"
73
- fi
74
-
75
- # Copy binary
76
- if [ -f build/staging/usr/local/bin/fastqr ]; then
77
- cp build/staging/usr/local/bin/fastqr "$OUTPUT_DIR/bin/fastqr"
78
- else
79
- cp build/fastqr "$OUTPUT_DIR/bin/fastqr"
80
- fi
81
- fi
61
+ # No shared library needed - CLI is standalone!
62
+ # (Ruby and Node.js use CLI binary directly)
82
63
 
83
64
  # Copy headers
84
65
  cp -r include "$OUTPUT_DIR/"
@@ -57,9 +57,9 @@ console.log('✅ Result:', result2);
57
57
  // Test 3: With options
58
58
  console.log('');
59
59
  console.log('Test 3: QR with optimize...');
60
- const result3 = fastqr.generate('Test Optimize', 'test_node_opt.png', {
61
- size: 500,
62
- optimizeSize: true
60
+ const result3 = fastqr.generate('Test Optimize', 'test_node_opt.png', {
61
+ size: 500,
62
+ optimizeSize: true
63
63
  });
64
64
  console.log('✅ Result:', result3);
65
65
 
data/src/fastqr.cpp CHANGED
@@ -25,7 +25,7 @@
25
25
  // Enable benchmarking
26
26
  // #define FASTQR_BENCHMARK
27
27
 
28
- #define FASTQR_VERSION "1.0.9"
28
+ #define FASTQR_VERSION "1.0.11"
29
29
 
30
30
  namespace fastqr {
31
31
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastqr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.9
4
+ version: 1.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - FastQR Project
@@ -10,20 +10,6 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2025-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: ffi
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.15'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.15'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: rake
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -104,13 +90,11 @@ files:
104
90
  - bindings/ruby/prebuilt/macos-arm64/include/fastqr.h
105
91
  - bindings/ruby/prebuilt/macos-arm64/include/stb_image.h
106
92
  - bindings/ruby/prebuilt/macos-arm64/include/stb_image_write.h
107
- - bindings/ruby/prebuilt/macos-arm64/lib/libfastqr.dylib
108
93
  - bindings/ruby/prebuilt/macos-x86_64.tar.gz
109
94
  - bindings/ruby/prebuilt/macos-x86_64/bin/fastqr
110
95
  - bindings/ruby/prebuilt/macos-x86_64/include/fastqr.h
111
96
  - bindings/ruby/prebuilt/macos-x86_64/include/stb_image.h
112
97
  - bindings/ruby/prebuilt/macos-x86_64/include/stb_image_write.h
113
- - bindings/ruby/prebuilt/macos-x86_64/lib/libfastqr.dylib
114
98
  - build.sh
115
99
  - cmake/fastqrConfig.cmake.in
116
100
  - composer.json