comparison mupdf-source/thirdparty/zxing-cpp/CMakeLists.txt @ 2:b50eed0cc0ef upstream

ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4. The directory name has changed: no version number in the expanded directory now.
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 15 Sep 2025 11:43:07 +0200
parents
children
comparison
equal deleted inserted replaced
1:1d09e1dec1d9 2:b50eed0cc0ef
1 cmake_minimum_required(VERSION 3.16)
2
3 project(ZXing)
4
5 option (ZXING_READERS "Build with reader support (decoders)" ON)
6 set (ZXING_WRITERS "ON" CACHE STRING "Build with old and/or new writer (encoder) backend (OFF/ON/OLD/NEW/BOTH)")
7 option (ZXING_USE_BUNDLED_ZINT "Use the bundled libzint for barcode creation/writing" ON)
8 option (ZXING_C_API "Build the C-API" OFF)
9 option (ZXING_EXPERIMENTAL_API "Build with experimental API" OFF)
10 option (ZXING_EXAMPLES "Build the example barcode reader/writer applications" ON)
11 option (ZXING_BLACKBOX_TESTS "Build the black box reader/writer tests" OFF)
12 option (ZXING_UNIT_TESTS "Build the unit tests (don't enable for production builds)" OFF)
13 option (ZXING_PYTHON_MODULE "Build the python module" OFF)
14 set (ZXING_DEPENDENCIES "AUTO" CACHE STRING "Fetch from github or use locally installed (AUTO/GITHUB/LOCAL)")
15
16 if (WIN32)
17 option (BUILD_SHARED_LIBS "Build and link as shared library" OFF)
18 else()
19 option (BUILD_SHARED_LIBS "Build and link as shared library" ON)
20 endif()
21
22 if (MSVC)
23 add_definitions (-DUNICODE -D_UNICODE -D_CRT_SECURE_NO_WARNINGS)
24 option (ZXING_LINK_CPP_STATICALLY "MSVC only, link standard library statically (/MT and /MTd)" OFF)
25 if (LINK_CPP_STATICALLY OR ZXING_LINK_CPP_STATICALLY)
26 set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
27 endif()
28 endif()
29
30 if (NOT CMAKE_BUILD_TYPE)
31 set (DEFAULT_BUILD_TYPE "Release")
32 message (STATUS "Setting build type to '${DEFAULT_BUILD_TYPE}' as none was specified.")
33 set (CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}" CACHE STRING "Choose the type of build." FORCE)
34 set_property (CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
35 endif()
36
37 # provide backward compatibility for deprecated BUILD_... options
38 if (DEFINED BUILD_READERS)
39 set (ZXING_READERS ${BUILD_READERS})
40 endif()
41 if (DEFINED BUILD_WRITERS)
42 set (ZXING_WRITERS ${BUILD_WRITERS})
43 endif()
44 if (DEFINED BUILD_EXAMPLES)
45 message (WARNING "zxing-cpp cmake options BUILD_... are deprecated, please switch to ZXING_... variant")
46 set (ZXING_EXAMPLES ${BUILD_EXAMPLES})
47 endif()
48 if (DEFINED BUILD_PYTHON_MODULE)
49 message (WARNING "zxing-cpp cmake options BUILD_... are deprecated, please switch to ZXING_... variant")
50 set (ZXING_PYTHON_MODULE ${BUILD_PYTHON_MODULE})
51 endif()
52 if (DEFINED BUILD_DEPENDENCIES)
53 message (WARNING "zxing-cpp cmake options BUILD_... are deprecated, please switch to ZXING_... variant")
54 set (ZXING_DEPENDENCIES ${BUILD_DEPENDENCIES})
55 endif()
56
57 if (NOT (ZXING_READERS OR ZXING_WRITERS))
58 message(FATAL_ERROR "At least one of ZXING_READERS/ZXING_WRITERS must be enabled.")
59 endif()
60
61 set(ZXING_WRITERS_LIST OFF ON OLD NEW BOTH)
62 set_property(CACHE ZXING_WRITERS PROPERTY STRINGS ${ZXING_WRITERS_LIST})
63 if(NOT ZXING_WRITERS IN_LIST ZXING_WRITERS_LIST)
64 message(FATAL_ERROR "ZXING_WRITERS must be one of ${ZXING_WRITERS_LIST}")
65 endif()
66
67 set(ZXING_DEPENDENCIES_LIST AUTO GITHUB LOCAL)
68 set_property(CACHE ZXING_DEPENDENCIES PROPERTY STRINGS ${ZXING_DEPENDENCIES_LIST})
69 if(NOT ZXING_DEPENDENCIES IN_LIST ZXING_DEPENDENCIES_LIST)
70 message(FATAL_ERROR "ZXING_DEPENDENCIES must be one of ${ZXING_DEPENDENCIES_LIST}")
71 endif()
72
73 if (NOT DEFINED CMAKE_CXX_STANDARD)
74 set (CMAKE_CXX_STANDARD 20)
75 # Allow the fallback to earlier versions if the compiler does not support it.
76 set(CMAKE_CXX_STANDARD_REQUIRED OFF)
77 endif()
78 if (NOT DEFINED CMAKE_CXX_EXTENSIONS)
79 set (CMAKE_CXX_EXTENSIONS OFF)
80 endif()
81
82 add_subdirectory (core)
83
84 enable_testing()
85
86 include(zxing.cmake)
87
88 if (ZXING_EXAMPLES)
89 add_subdirectory (example)
90 endif()
91 if (ZXING_BLACKBOX_TESTS)
92 add_subdirectory (test/blackbox)
93 endif()
94 if (ZXING_UNIT_TESTS)
95 add_subdirectory (test/unit)
96 endif()
97 if (ZXING_PYTHON_MODULE)
98 add_subdirectory (wrappers/python)
99 endif()
100 if (ZXING_C_API)
101 add_subdirectory (wrappers/c)
102 endif()