comparison mupdf-source/thirdparty/zxing-cpp/wrappers/winrt/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 #
2 # This will create a Windows Runtime Component that can be consumed by any WinRT or UWP project.
3 # You need to specify -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 at command line
4 # to generate correctly UWP projects. You can also use Toolchain-Win10.cmake as tool chain file
5 # which defined these for you.
6 #
7 # You can add EXTENSION_SDK_OUTPUT variable to deploy the build as UWP Extension SDK
8 # e.g. -DEXTENSION_SDK_OUTPUT:STRING=<path_to_folder_parent_of_SDKManifest.xml>
9 #
10 cmake_minimum_required (VERSION 3.14)
11
12 project (ZXingWinRT)
13
14 set (CMAKE_CONFIGURATION_TYPES "RelWithDebInfo;Release" CACHE STRING "" FORCE)
15 set (WINRT ON)
16 set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /INCREMENTAL:NO" )
17
18 add_definitions (-DUNICODE -D_UNICODE)
19
20 if (MSVC)
21 add_definitions (
22 -DNOMINMAX -wd4996
23 )
24 endif()
25
26 include(TargetArch.cmake)
27 get_target_architecture (TARGET_ARCHITECTURE)
28 set (TARGET_ARCHITECTURE ${TARGET_ARCHITECTURE} CACHE INTERNAL "")
29 message (STATUS "Building for " ${TARGET_ARCHITECTURE})
30
31 if (NOT DEFINED EXTENSION_SDK_OUTPUT)
32 set (EXTENSION_SDK_OUTPUT "" CACHE PATH "Path to folder parent of SDKManifest")
33 endif()
34
35 add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR}/../../core ${CMAKE_BINARY_DIR}/ZXingCore)
36
37 file (GLOB SOURCE_FILES *.cpp)
38 file (GLOB HEADER_FILES *.h)
39
40 set (ROOT_NAMESPACE "ZXing")
41 set (OUTPUT_FILE_BASE_NAME "ZXing")
42
43 add_library (ZXingWinRT SHARED ${HEADER_FILES} ${SOURCE_FILES})
44
45 target_link_libraries (ZXingWinRT
46 PRIVATE ZXing::ZXing
47 )
48
49 target_compile_options (ZXingWinRT PRIVATE
50 -D_WINRT_DLL
51 -ZW # Consume Windows Runtime Extension
52 )
53
54 set_target_properties (ZXingWinRT PROPERTIES
55 LINK_FLAGS "/WINMD" # Generate Windows Metadata
56 VS_GLOBAL_ROOTNAMESPACE "${ROOT_NAMESPACE}"
57 OUTPUT_NAME ${OUTPUT_FILE_BASE_NAME}
58 )
59
60 set_target_properties (ZXingWinRT ZXing PROPERTIES
61 VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION "10.0.10240.0"
62 )
63
64 if (EXTENSION_SDK_OUTPUT)
65 add_custom_command (TARGET ZXingWinRT POST_BUILD
66 COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different "$<TARGET_FILE:ZXingWinRT>" "${EXTENSION_SDK_OUTPUT}/Redist/$<$<CONFIG:Release>:Retail>$<$<CONFIG:RelWithDebInfo>:Debug>/${TARGET_ARCHITECTURE}/$<TARGET_FILE_NAME:ZXingWinRT>"
67 COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different "$<TARGET_FILE_DIR:ZXingWinRT>/${ROOT_NAMESPACE}.winmd" "${EXTENSION_SDK_OUTPUT}/References/CommonConfiguration/Neutral/${ROOT_NAMESPACE}.winmd"
68 COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different "$<TARGET_FILE_DIR:ZXingWinRT>/${ROOT_NAMESPACE}.pri" "${EXTENSION_SDK_OUTPUT}/References/CommonConfiguration/Neutral/${ROOT_NAMESPACE}.pri"
69 )
70 endif()