Skip to content

Commit

Permalink
cmake: reorganize BUILD_WRITER options
Browse files Browse the repository at this point in the history
Build with old and/or new writer (encoder) backend (OFF/ON/OLD/NEW/BOTH)

The default value ON is currently mapped to OLD (MultiFormatWriter).

The value NEW means use libzint as the writer backend but that only takes
effect if BUILD_EXPERIMENTAL_API is ON as well.
  • Loading branch information
axxel committed Mar 7, 2024
1 parent 29fb3cf commit 5e20475
Show file tree
Hide file tree
Showing 11 changed files with 240 additions and 172 deletions.
16 changes: 6 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ cmake_minimum_required(VERSION 3.15)

project(ZXing)

option (BUILD_WRITERS "Build with writer support (encoders)" ON)
# option (BUILD_WRITERS "Build with writer support (encoders)" ON)
set(BUILD_WRITERS "ON" CACHE STRING "Build with old and/or new writer (encoder) backend (OFF/ON/OLD/NEW/BOTH)")
option (BUILD_READERS "Build with reader support (decoders)" ON)
option (BUILD_EXAMPLES "Build the example barcode reader/writer applications" ON)
option (BUILD_BLACKBOX_TESTS "Build the black box reader/writer tests" OFF)
option (BUILD_UNIT_TESTS "Build the unit tests (don't enable for production builds)" OFF)
option (BUILD_PYTHON_MODULE "Build the python module" OFF)
option (BUILD_C_API "Build the C-API" OFF)
option (BUILD_EXPERIMENTAL_API "Build with experimental API" OFF)
option (ZXING_USE_ZINT "Use libzint for barcode creation/generation" OFF)
set(BUILD_DEPENDENCIES "AUTO" CACHE STRING "Fetch from github or use locally installed (AUTO/GITHUB/LOCAL)")

if (WIN32)
Expand Down Expand Up @@ -48,14 +48,10 @@ if (BUILD_UNIT_TESTS AND (NOT BUILD_WRITERS OR NOT BUILD_READERS))
set (BUILD_READERS ON)
endif()

if (ZXING_USE_ZINT)
set (BUILD_EXPERIMENTAL_API ON)
add_definitions (-DZXING_USE_ZINT)
endif()

if (BUILD_EXPERIMENTAL_API)
set (CMAKE_CXX_STANDARD 20)
add_definitions (-DZXING_BUILD_EXPERIMENTAL_API)
set(BUILD_WRITERS_LIST OFF ON OLD NEW BOTH)
set_property(CACHE BUILD_WRITERS PROPERTY STRINGS ${BUILD_WRITERS_LIST})
if(NOT BUILD_WRITERS IN_LIST BUILD_WRITERS_LIST)
message(FATAL_ERROR "BUILD_WRITERS must be one of ${BUILD_WRITERS_LIST}")
endif()

set(BUILD_DEPENDENCIES_LIST AUTO GITHUB LOCAL)
Expand Down
Loading

0 comments on commit 5e20475

Please sign in to comment.