Skip to content

Commit

Permalink
cmake: switch to c++-20 by default for the core library
Browse files Browse the repository at this point in the history
I finally accept the incurred performance penalty from the position
independent DataMatrix detection by default.

This is finally fixing zxing-cpp#386. It also (sufficiently) fixes zxing-cpp#822 and thereby
supersedes zxing-cpp#836.
  • Loading branch information
axxel committed Sep 22, 2024
1 parent fd4d337 commit d98739c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
- name: Configure
run: >
cmake -S . -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_SHARED_LIBS=ON
-DZXING_READERS=ON -DZXING_WRITERS=NEW -DZXING_EXPERIMENTAL_API=ON -DCMAKE_CXX_STANDARD=20
-DZXING_READERS=ON -DZXING_WRITERS=NEW -DZXING_EXPERIMENTAL_API=ON
-DZXING_BLACKBOX_TESTS=ON -DZXING_UNIT_TESTS=OFF -DZXING_PYTHON_MODULE=OFF -DZXING_C_API=ON
- name: Build
Expand Down
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ if(NOT ZXING_DEPENDENCIES IN_LIST ZXING_DEPENDENCIES_LIST)
endif()

if (NOT DEFINED CMAKE_CXX_STANDARD)
set (CMAKE_CXX_STANDARD 17)
set (CMAKE_CXX_STANDARD 20)
# Allow the fallback to earlier versions if the compiler does not support it.
set(CMAKE_CXX_STANDARD_REQUIRED OFF)
endif()
if (NOT DEFINED CMAKE_CXX_EXTENSIONS)
set (CMAKE_CXX_EXTENSIONS OFF)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Thanks a lot for your contribution!

## Features

* Written in pure C++17 (/C++20), no third-party dependencies (for the library itself)
* Written in pure C++20 (/C++17), no third-party dependencies (for the library itself)
* Thread safe
* Wrappers/Bindings for:
* [Android](wrappers/android/README.md)
Expand Down Expand Up @@ -47,7 +47,7 @@ Thanks a lot for your contribution!
[Note:]
* DataBar used to be called RSS.
* DataBar, DX Film Edge, MaxiCode, Micro QR Code and rMQR Code are not supported for writing.
* Building with C++20 (see [CMakeLists.txt](https://github.com/zxing-cpp/zxing-cpp/blob/d4b0f502775857f257d13efd25fb840ece1bca3e/CMakeLists.txt#L45)) changes the behaviour of the library: it then supports multi-symbol and position independent detection for DataMatrix. This comes at a noticable performace cost. C++20 is enabled by default for the Android, iOS, Python and WASM wrappers.
* Building with only C++17 (see [CMakeLists.txt](https://github.com/zxing-cpp/zxing-cpp/blob/d4b0f502775857f257d13efd25fb840ece1bca3e/CMakeLists.txt#L45)) changes the behaviour of the library: it then lacks supports multi-symbol and position independent detection for DataMatrix.

## Getting Started

Expand Down

0 comments on commit d98739c

Please sign in to comment.