Debian Codegraph @

sdk/cmake/vcpkg_overlay_ports/pdfium/portfile.cmake

raw
1
2 # From V8 port file in vcpkg repo: https://github.com/microsoft/vcpkg/blob/master/ports/v8/portfile.cmake
3 function(pdfium_from_git)
4 set(pdfiumArgs DESTINATION URL REF SOURCE)
5 cmake_parse_arguments(pdfium "" "${pdfiumArgs}" "" ${ARGN})
6
7 if(EXISTS ${pdfium_SOURCE}/${pdfium_DESTINATION})
8 vcpkg_execute_required_process(
9 COMMAND ${GIT} reset --hard
10 WORKING_DIRECTORY ${pdfium_SOURCE}/${pdfium_DESTINATION}
11 LOGNAME build-${TARGET_TRIPLET})
12 else()
13 vcpkg_execute_required_process(
14 COMMAND ${GIT} clone ${pdfium_URL} ${pdfium_DESTINATION}
15 WORKING_DIRECTORY ${pdfium_SOURCE}
16 LOGNAME build-${TARGET_TRIPLET})
17 vcpkg_execute_required_process(
18 COMMAND ${GIT} fetch --depth 1 origin ${pdfium_REF}
19 WORKING_DIRECTORY ${pdfium_SOURCE}/${pdfium_DESTINATION}
20 LOGNAME build-${TARGET_TRIPLET})
21 vcpkg_execute_required_process(
22 COMMAND ${GIT} checkout FETCH_HEAD
23 WORKING_DIRECTORY ${pdfium_SOURCE}/${pdfium_DESTINATION}
24 LOGNAME build-${TARGET_TRIPLET})
25 endif()
26 endfunction()
27
28 vcpkg_find_acquire_program(GIT)
29
30 vcpkg_from_git(
31 OUT_SOURCE_PATH SOURCE_PATH
32 URL https://pdfium.googlesource.com/pdfium.git
33 REF 7a8409531fbb58d7d15ae331e645977b113d7ced # chromium/6778
34 PATCHES
35 gcc_parentheses_init.patch # gcc9, no aggregate initialization with parentheses in C++20.
36 win-compilation-v142.patch # Compiler fails auto type deduction in v142 platform
37 )
38
39 message(STATUS "Working on submodules and other dependencies...")
40
41 pdfium_from_git(
42 DESTINATION build
43 URL https://chromium.googlesource.com/chromium/src/build.git
44 REF 9b11bd3a6a523134ac35bcc9d1f59d04cc6f5821 # The one in pdfium DEPS file, field 'build_revision'
45 SOURCE ${SOURCE_PATH}
46 )
47
48 pdfium_from_git(
49 DESTINATION third_party/abseil-cpp
50 URL https://chromium.googlesource.com/chromium/src/third_party/abseil-cpp.git
51 REF d2ea9f0eb1a31f0e5a0ab11837ed19333700ab4c # The one in pdfium DEPS file, field 'abseil_revision'
52 SOURCE ${SOURCE_PATH}
53 )
54
55 pdfium_from_git(
56 DESTINATION third_party/fast_float/src
57 URL https://chromium.googlesource.com/external/github.com/fastfloat/fast_float.git
58 REF 3e57d8dcfb0a04b5a8a26b486b54490a2e9b310f # The one in pdfium DEPS file, field 'abseil_revision'
59 SOURCE ${SOURCE_PATH}
60 )
61
62 vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
63
64 file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
65
66 vcpkg_cmake_configure(
67 SOURCE_PATH "${SOURCE_PATH}"
68 )
69
70 vcpkg_cmake_install()
71 vcpkg_cmake_config_fixup(PACKAGE_NAME pdfium CONFIG_PATH share/pdfium)
72
73 set(PDFIUM_PREFIX ${CURRENT_PACKAGES_DIR})
74
75 include(CMakePackageConfigHelpers)
76 configure_package_config_file(${CMAKE_CURRENT_LIST_DIR}/Config.cmake.in
77 "${CURRENT_PACKAGES_DIR}/share/pdfium/pdfiumConfig.cmake"
78 INSTALL_DESTINATION share/pdfium
79 )
80
81 file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
82 file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}/" RENAME copyright)