Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
31f94eb
ignore build folder etc.
ixik-melissa Jul 29, 2025
5246828
update version of action checkout
ixik-melissa Jul 29, 2025
338bdf7
build libray using gcc
ixik-melissa Jul 29, 2025
1ae11fe
add missing include statement
ixik-melissa Jul 29, 2025
ceb0ca5
disable windows run for now
ixik-melissa Jul 29, 2025
c256e9d
fix warning
ixik-melissa Jul 29, 2025
f1a1625
fix warning
ixik-melissa Jul 29, 2025
ee607ca
fix warning
ixik-melissa Jul 29, 2025
96681f0
remove conan and docker as it adds too much complexity for a small he…
ixik-melissa Jul 29, 2025
2a0c996
enable windows again
ixik-melissa Jul 29, 2025
0f227bf
remove conan and docker as it adds too much complexity for a small he…
ixik-melissa Jul 29, 2025
9cf37d8
remove c++ latest for windows
ixik-melissa Jul 29, 2025
65ad975
push to c++23
ixik-melissa Jul 29, 2025
1f2103d
readme polish
ixik-melissa Jul 29, 2025
ed6ce47
disable windows build as it still has problems
ixik-melissa Jul 30, 2025
ee94d0b
add demo
ixik-melissa Jul 30, 2025
2337878
add demo
ixik-melissa Jul 30, 2025
83992ff
add demo
ixik-melissa Jul 30, 2025
88b6b5e
add demo
ixik-melissa Jul 30, 2025
a53da4a
add demo
ixik-melissa Jul 30, 2025
ad7d3d0
add demo
ixik-melissa Jul 30, 2025
617e3a5
add demo
ixik-melissa Jul 30, 2025
63d2cd3
add demo
ixik-melissa Jul 30, 2025
06eaa5a
add demo
ixik-melissa Jul 30, 2025
534a36c
add demo
ixik-melissa Jul 30, 2025
9a1d14a
add demo
ixik-melissa Jul 30, 2025
4a44f64
clang build: fix initialization issues
ixik-melissa Jul 31, 2025
f2f42d0
clang build: comparison operator needs explicit bool declaration othe…
ixik-melissa Jul 31, 2025
349493e
clang build: add missing include
ixik-melissa Jul 31, 2025
908081c
clang build: comparison operator needs explicit bool declaration othe…
ixik-melissa Jul 31, 2025
044ca36
clang build: some more fixes
ixik-melissa Jul 31, 2025
0b2ec01
clang build: better compile option switches
ixik-melissa Jul 31, 2025
bab405f
clang build: better compile option switches
ixik-melissa Jul 31, 2025
cd39db7
don't run test file as part of a post link step, confuses xcode durin…
ixik-melissa Jul 31, 2025
b3896f3
enable c++23 for demo
ixik-melissa Jul 31, 2025
4c9486f
add clang build
ixik-melissa Jul 31, 2025
f4233df
fix run stage and compare svg result
ixik-melissa Jul 31, 2025
b782039
fix stages
ixik-melissa Jul 31, 2025
66413f8
remove unused ignore line
ixik-melissa Jul 31, 2025
d427958
shorter file name for workflow
ixik-melissa Jul 31, 2025
dc46d5b
state c++23 instead of c++20
ixik-melissa Jul 31, 2025
1f12f4a
use diff instead of cmp and ignore space etc.
ixik-melissa Jul 31, 2025
f11fdca
compare svg in clang as-well
ixik-melissa Jul 31, 2025
85a3cba
add macos support
ixik-melissa Jul 31, 2025
4aee876
pin operating system versions
ixik-melissa Jul 31, 2025
b58adf3
build release
ixik-melissa Jul 31, 2025
ebb2b29
update supported compiler list
ixik-melissa Jul 31, 2025
51ffa31
change author name
ixik-melissa Jul 31, 2025
14af87d
update copyright
ixik-melissa Jul 31, 2025
f6acc5f
enable windows build
ixik-melissa Jul 31, 2025
2eb1d0e
some fixes for msvc
ixik-melissa Jul 31, 2025
52fc1c2
more steps for msvc build
ixik-melissa Jul 31, 2025
a64114f
simplified paths
ixik-melissa Jul 31, 2025
365d9d6
fix stages
ixik-melissa Jul 31, 2025
393bd08
fix windows build
ixik-melissa Jul 31, 2025
ac16d24
fix windows build
ixik-melissa Jul 31, 2025
d300e27
readme adjustments
ixik-melissa Jul 31, 2025
9161336
fix windows build
ixik-melissa Jul 31, 2025
0c8cb23
fix windows build
ixik-melissa Jul 31, 2025
7d024e5
fix windows build
ixik-melissa Jul 31, 2025
2addd51
fix windows build
ixik-melissa Jul 31, 2025
4c4813a
fix windows build
ixik-melissa Jul 31, 2025
7b7ebec
fix windows build
ixik-melissa Jul 31, 2025
eece0de
fix windows build
ixik-melissa Jul 31, 2025
a5a56ec
fix windows build
ixik-melissa Jul 31, 2025
76f0d1d
fix windows build
ixik-melissa Jul 31, 2025
d22c556
fix windows build
ixik-melissa Jul 31, 2025
d6b47ab
fix windows build
ixik-melissa Jul 31, 2025
f6bc4d5
fix windows build
ixik-melissa Jul 31, 2025
ab9c169
fix windows build
ixik-melissa Jul 31, 2025
edf1f4d
fix windows build
ixik-melissa Jul 31, 2025
6cab932
fix windows build
ixik-melissa Jul 31, 2025
35e2f2a
fix windows build
ixik-melissa Jul 31, 2025
b2e2d83
fix windows build
ixik-melissa Jul 31, 2025
4dff87f
fix windows build
ixik-melissa Jul 31, 2025
8cac37a
fix windows build
ixik-melissa Jul 31, 2025
fc6866a
enable all warnings, treat them as errors
ixik-melissa Jul 31, 2025
2913f13
cosmetics
ixik-melissa Jul 31, 2025
e3431cf
disable brance initialization warning when using msvc
ixik-melissa Jul 31, 2025
84d7b8d
fix signed/unsigned mismatch
ixik-melissa Jul 31, 2025
405b0ff
relax warnings for msvc
ixik-melissa Jul 31, 2025
fb73976
fix step description
ixik-melissa Jul 31, 2025
ef61a57
add missing shell definition in windows build
ixik-melissa Jul 31, 2025
3c0ce08
add missing shell definition in windows build
ixik-melissa Jul 31, 2025
09960a7
test
ixik-melissa Jul 31, 2025
b253e74
test
ixik-melissa Jul 31, 2025
6f13d97
ignore some vs stuff
ixik-melissa Jul 31, 2025
0fc13f2
pre-define include directory for demo
ixik-melissa Jul 31, 2025
45bbbb3
windows needs a bigger stack size in order to work properly
ixik-melissa Jul 31, 2025
2dd1dc3
fix windows build
ixik-melissa Jul 31, 2025
15a6d2f
first version of cmake presets
ixik-melissa Aug 1, 2025
ae9dbe2
rewrite tests for use with std vector
ixik-melissa Aug 1, 2025
4707847
fix build
ixik-melissa Aug 1, 2025
1f7a862
use std vector when possible
ixik-melissa Aug 1, 2025
bf9eafd
remove deprecated information from readme
ixik-melissa Aug 1, 2025
d9eeaf7
fix build
ixik-melissa Aug 1, 2025
8cc5c0e
fix build
ixik-melissa Aug 1, 2025
9c2b4e1
fix build
ixik-melissa Aug 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 124 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@

name: CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

workflow_dispatch:

jobs:
GCC:
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Install build infrastructure
run: sudo apt-get install -y build-essential cmake ninja-build gcc-13 g++-13 libstdc++-13-dev

- name: Build test
run: |
mkdir -p build/test
cd build/test
cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DQRCODE_TESTS_ENABLED:BOOL=True ../../
ninja

- name: Run test
run: build/test/test/libqrcode_test

- name: Build demo
run: |
mkdir -p build/demo
cd build/demo
cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DLIBQRCODE_INCLUDE_DIR=$GITHUB_WORKSPACE/include/ ../../demo
ninja

- name: Run demo
run: |
build/demo/demo "Hello World!" >> result.svg
diff -u --ignore-space-change --strip-trailing-cr --ignore-blank-lines demo/qrcode.svg result.svg

Clang:
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Install build infrastructure
run: sudo apt-get install -y build-essential cmake ninja-build clang-15 libstdc++-13-dev

- name: Build test
run: |
mkdir -p build/test
cd build/test
cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DQRCODE_TESTS_ENABLED:BOOL=True ../../
ninja

- name: Run test
run: build/test/test/libqrcode_test

- name: Build demo
run: |
mkdir -p build/demo
cd build/demo
cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DLIBQRCODE_INCLUDE_DIR=$GITHUB_WORKSPACE/include/ ../../demo
ninja

- name: Run demo
run: |
build/demo/demo "Hello World!" >> result.svg
diff -u --ignore-space-change --strip-trailing-cr --ignore-blank-lines demo/qrcode.svg result.svg

AppleClang:
runs-on: macos-15

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Build test
run: |
mkdir -p build/test
cd build/test
cmake -GXcode -DQRCODE_TESTS_ENABLED:BOOL=True ../../
xcodebuild -scheme ALL_BUILD -configuration Release build

- name: Run test
run: build/test/test/Release/libqrcode_test

- name: Build demo
run: |
mkdir -p build/demo
cd build/demo
cmake -GXcode -DLIBQRCODE_INCLUDE_DIR=$GITHUB_WORKSPACE/include/ ../../demo
xcodebuild -scheme ALL_BUILD -configuration Release build

- name: Run demo
run: |
build/demo/Release/demo "Hello World!" >> result.svg
diff -u --ignore-space-change --strip-trailing-cr --ignore-blank-lines demo/qrcode.svg result.svg

MSVC:
runs-on: windows-2022

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Build test
shell: cmd
run: ${{ '"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" && mkdir build\test && cd build\test && cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DQRCODE_TESTS_ENABLED:BOOL=True ../../ && ninja' }}

- name: Run test
run: build/test/test/libqrcode_test

- name: Build demo
shell: cmd
run: ${{ '"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" && mkdir build\demo && cd build\demo && cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DLIBQRCODE_INCLUDE_DIR="%cd%/include" ../../demo && ninja' }}

- name: Run demo
run: |
. build/demo/demo "Hello World!" >> result.svg
Compare-Object (Get-Content demo/qrcode.svg) (Get-Content result.svg)

32 changes: 0 additions & 32 deletions .github/workflows/ci_build.yml

This file was deleted.

7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.vscode/
build.log
qrcode.svg
build/
out/
.vs/
.DS_Store
CMakeSettings.json
9 changes: 4 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# The MIT License
#
# Copyright (c) 2021 Sebastian Bauer
# Copyright (c) 2025 Melissa Bauer
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -30,7 +30,7 @@ endfunction()
project(libqrcode)

enable_testing()
enable_cxx(20)
enable_cxx(23)

add_library(qrcode INTERFACE)

Expand Down Expand Up @@ -166,9 +166,8 @@ target_sources(qrcode INTERFACE
)

target_include_directories(qrcode INTERFACE "include")
target_link_libraries(qrcode INTERFACE $<$<PLATFORM_ID:Linux>:stdc++ m>)
target_link_libraries(qrcode INTERFACE $<$<PLATFORM_ID:Darwin>:stdc++ m>)
target_compile_options(qrcode INTERFACE $<$<PLATFORM_ID:Windows>:/std:c++latest>)
target_link_libraries(qrcode INTERFACE $<$<CXX_COMPILER_ID:Clang>:stdc++ m>)
target_link_libraries(qrcode INTERFACE $<$<CXX_COMPILER_ID:AppleClang>:m>)

if (QRCODE_TESTS_ENABLED)
add_subdirectory(test)
Expand Down
29 changes: 29 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"version": 10,
"cmakeMinimumRequired": {
"major": 3,
"minor": 23,
"patch": 0
},
"configurePresets": [
{
"name": "apple-clang-with-tests",
"displayName": "AppleClang - With Tests",
"description": "macos build",
"generator": "Xcode",
"binaryDir": "${sourceDir}/build/with-tests",
"cacheVariables": {
"QRCODE_TESTS_ENABLED": {
"type": "BOOL",
"value": "ON"
}
}
}
],
"buildPresets": [
{
"name": "build-apple-clang-with-tests",
"configurePreset": "apple-clang-with-tests"
}
]
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

Copyright (c) 2021 Sebastian Bauer
Copyright (c) 2025 Melissa Bauer

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
51 changes: 13 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# Introduction
libqrcode is C++20 header-only library for generating QR/Micro QR Codes.
libqrcode is C++23 header-only library for generating QR/Micro QR Codes.

Features include:
* Header-only library
* Completely constexpr
* Code is (unit-)tested with `static_asserts` during compile-time
* Utilizes standard library only
* Uses C++20 Ranges
* Uses Ranges
* No C++ exceptions (however)
* Supports Conan package manager

# QR support
Supported:
Expand All @@ -29,13 +28,9 @@ Supported:
* Encodings: Numeric, alphanumeric, byte and kanji encoding (where possible)

# Usage
One can either use the conan recipe provided in this repository or directly integrate the library
into your project. As this libary is header-only, it should be quite easy to setup.
Add the libqrcode include directory to your project's header search path

In your project, just in include the header [`qrcode/qrcode.h`](include/qrcode/qrcode.h).
Micro QR api is located within namespace `micro_qr`.
QR api is located within namespace `qr`.
Micro QR API is located within namespace `micro_qr`.
QR API is located within namespace `qr`.

#### Simple example
```
Expand Down Expand Up @@ -89,41 +84,21 @@ int main()
```

# Requirements
* C++20 compiler and standard library
* C++ compiler and standard library
* Supported:
* gcc10 and libstdc++-10-dev or higher (see [`test/linux.Dockerfile`](test/linux.Dockerfile))
* msvc: Visual Studio 2019 16.10.0 (see [`test/win.Dockerfile`](test/win.Dockerfile))
* Not supported:
* clang doesn't seem to support all featured of C++20 needed to make this work
* macOS (due to lack of C++20 features), support will be added in the future
* gcc13 and libstdc++-13-dev
* clang15 and libstdc++-13-dev
* msvc: Visual Studio 2022 17.14.9
* macos: AppleClang 16.0.0

# How to build
* Since the library is header-only, building is actually not necessary.
* Just put the `include` folder of this project into your header search path and it should just work.
* Just place the `include` folder of this project into your header search path.
* However, if you'd like to run the tests, please select the top-level of the project in order to run _CMake_.
* For more information, please have a look at the _Dockerfile_ in the test folder and consider the remarks below.

## How to run the tests
If you would like to run the tests, one has to add the following cmake flag: `-DQRCODE_TESTS_ENABLED:BOOL=True`

## Debug builds using MSVC
Building with tests enabled in _Debug_ configuration won't build due to an issue in _Microsoft_'s STL implementation. _Release_ configuration works though.
If you would like to run the tests, one has to add the following _CMake_ flag: `-DQRCODE_TESTS_ENABLED:BOOL=True`

# CI builds
CI builds usually consists of a test build and a conan demo build.
If and only if both builds were successful, the CI state is green.

# Tests
All tests are usually built and run in docker containers.
See [`test/linux.Dockerfile`](test/linux.Dockerfile) for more info.
You can also hit [`test/linux_run.sh`](test/linux_run.sh) which creates and
runs the docker image for you.

# Conan
The library supports _Conan_ out of the box. The [`conan_demo/Dockerfile`](conan_demo/Dockerfile)
and [`conan_demo/run.sh`](conan_demo/run.sh) are for demonstration purposes.
It creates a small command-line tool which can create QR symbols from a given text message.

Please note:
The _Conan_ build is part of the CI checks.
The tool has to be compiled successfully in order to clear this stage.
The CI pipeline consist of test builds and demo builds for _GCC_, _Clang_, _AppleClang_ and _MSVC_.
If and only if all builds were successful, the CI state is green.
31 changes: 0 additions & 31 deletions conan_demo/Dockerfile

This file was deleted.

5 changes: 0 additions & 5 deletions conan_demo/conanfile.txt

This file was deleted.

7 changes: 0 additions & 7 deletions conan_demo/run.sh

This file was deleted.

22 changes: 0 additions & 22 deletions conanfile.py

This file was deleted.

Loading