comparison mupdf-source/thirdparty/zxing-cpp/wrappers/wasm/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.14)
2
3 project (ZXingWasm)
4
5 include (${CMAKE_CURRENT_SOURCE_DIR}/../../zxing.cmake)
6 zxing_add_package_stb()
7
8 set (CMAKE_CXX_STANDARD 20)
9
10 option (ZXING_WRITERS "Build with writer support (encoders)" ON)
11 option (ZXING_READERS "Build with reader support (decoders)" ON)
12 set (ZXING_EMSCRIPTEN_ENVIRONMENT "web" CACHE STRING "Optimize build for given emscripten runtime environment (web/node/shell/worker)")
13
14 # provide backward compatibility for deprecated BUILD_... options
15 if (DEFINED BUILD_READERS)
16 set (ZXING_READERS ${BUILD_READERS})
17 endif()
18 if (DEFINED BUILD_WRITERS)
19 set (ZXING_WRITERS ${BUILD_WRITERS})
20 endif()
21 if (DEFINED BUILD_EMSCRIPTEN_ENVIRONMENT)
22 set (ZXING_EMSCRIPTEN_ENVIRONMENT ${BUILD_EMSCRIPTEN_ENVIRONMENT})
23 endif()
24
25 if (NOT CMAKE_BUILD_TYPE)
26 set (CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build." FORCE)
27 endif()
28
29 add_definitions ("-s DISABLE_EXCEPTION_CATCHING=0")
30
31 add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR}/../../core ${CMAKE_BINARY_DIR}/ZXing)
32
33 set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --bind -s ENVIRONMENT=${ZXING_EMSCRIPTEN_ENVIRONMENT} -s DISABLE_EXCEPTION_CATCHING=0 -s FILESYSTEM=0 -s MODULARIZE=1 -s EXPORT_NAME=ZXing -s EXPORTED_FUNCTIONS=\"['_malloc', '_free']\" -s ALLOW_MEMORY_GROWTH=1")
34
35 if (ZXING_READERS AND ZXING_WRITERS)
36 add_executable (zxing BarcodeReader.cpp BarcodeWriter.cpp)
37 target_link_libraries (zxing ZXing::ZXing stb::stb)
38 endif()
39
40 if (ZXING_READERS)
41 configure_file(demo_cam_reader.html demo_cam_reader.html COPYONLY)
42 configure_file(demo_reader.html demo_reader.html COPYONLY)
43 add_executable (zxing_reader BarcodeReader.cpp)
44 target_link_libraries (zxing_reader ZXing::ZXing stb::stb)
45 endif()
46
47 if (ZXING_WRITERS)
48 configure_file(demo_writer.html demo_writer.html COPYONLY)
49 add_executable (zxing_writer BarcodeWriter.cpp )
50 target_link_libraries (zxing_writer ZXing::ZXing stb::stb)
51 endif()
52