|
| 1 | +include(vcpkg_common_functions) |
| 2 | + |
| 3 | +# WINDOWS_EXPORT_ALL_SYMBOLS doesn't work. |
| 4 | +# unresolved external symbol "public: static unsigned int const foonathan::memory::detail::memory_block_stack::implementation_offset |
| 5 | +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) |
| 6 | + |
| 7 | +vcpkg_from_github( |
| 8 | + OUT_SOURCE_PATH SOURCE_PATH |
| 9 | + REPO foonathan/memory |
| 10 | + REF 885a9d97bebe9a2f131d21d3c0928c42ab377c8b |
| 11 | + SHA512 7ce78a6e67d590a41b7f8a3d4ae0f6c1fa157c561b718a63973dffc000df74a9f0a0d7955a099e84fbeb3cf4085092eb866a6b8cec8bafd50bdcee94d069f65d |
| 12 | + HEAD_REF master |
| 13 | +) |
| 14 | + |
| 15 | +vcpkg_from_github( |
| 16 | + OUT_SOURCE_PATH COMP_SOURCE_PATH |
| 17 | + REPO foonathan/compatibility |
| 18 | + REF cd142129e30f5b3e6c6d96310daf94242c0b03bf |
| 19 | + SHA512 1d144f82ec46dcc546ee292846330d39536a3145e5a5d8065bda545f55699aeb9a4ef7dea5e5f684ce2327fad210488fe6bb4ba7f84ceac867ac1c72b90c6d69 |
| 20 | + HEAD_REF master |
| 21 | +) |
| 22 | + |
| 23 | +file(COPY ${COMP_SOURCE_PATH}/comp_base.cmake DESTINATION ${SOURCE_PATH}/cmake/comp) |
| 24 | + |
| 25 | +vcpkg_check_features(tool FOONATHAN_MEMORY_BUILD_TOOLS) |
| 26 | + |
| 27 | +vcpkg_configure_cmake( |
| 28 | + SOURCE_PATH ${SOURCE_PATH} |
| 29 | + PREFER_NINJA |
| 30 | + OPTIONS |
| 31 | + -DFOONATHAN_MEMORY_BUILD_EXAMPLES=OFF |
| 32 | + -DFOONATHAN_MEMORY_BUILD_TESTS=OFF |
| 33 | + -DFOONATHAN_MEMORY_BUILD_TOOLS=${FOONATHAN_MEMORY_BUILD_TOOLS} |
| 34 | +) |
| 35 | + |
| 36 | +vcpkg_install_cmake() |
| 37 | + |
| 38 | +if(EXISTS ${CURRENT_PACKAGES_DIR}/cmake) |
| 39 | + vcpkg_fixup_cmake_targets(CONFIG_PATH cmake TARGET_PATH share/foonathan_memory) |
| 40 | +elseif(EXISTS ${CURRENT_PACKAGES_DIR}/share/foonathan_memory/cmake) |
| 41 | + vcpkg_fixup_cmake_targets(CONFIG_PATH share/foonathan_memory/cmake TARGET_PATH share/foonathan_memory) |
| 42 | +endif() |
| 43 | + |
| 44 | +vcpkg_copy_pdbs() |
| 45 | + |
| 46 | +# Place header files into the right folders |
| 47 | +# The original layout is not a problem for CMake-based project. |
| 48 | +file(COPY |
| 49 | + ${CURRENT_PACKAGES_DIR}/include/foonathan_memory/foonathan |
| 50 | + DESTINATION ${CURRENT_PACKAGES_DIR}/include |
| 51 | +) |
| 52 | +file(GLOB |
| 53 | + COMP_INCLUDE_FILES |
| 54 | + ${CURRENT_PACKAGES_DIR}/include/foonathan_memory/comp/foonathan/*.hpp |
| 55 | +) |
| 56 | +file(COPY |
| 57 | + ${COMP_INCLUDE_FILES} |
| 58 | + DESTINATION ${CURRENT_PACKAGES_DIR}/include/foonathan |
| 59 | +) |
| 60 | +file(COPY |
| 61 | + ${CURRENT_PACKAGES_DIR}/include/foonathan_memory/config_impl.hpp |
| 62 | + DESTINATION ${CURRENT_PACKAGES_DIR}/include/foonathan/memory |
| 63 | +) |
| 64 | +file(REMOVE_RECURSE |
| 65 | + ${CURRENT_PACKAGES_DIR}/include/foonathan_memory |
| 66 | +) |
| 67 | +vcpkg_replace_string( |
| 68 | + ${CURRENT_PACKAGES_DIR}/share/foonathan_memory/foonathan_memory-config.cmake |
| 69 | + "\${_IMPORT_PREFIX}/include/foonathan_memory/comp;\${_IMPORT_PREFIX}/include/foonathan_memory" |
| 70 | + "\${_IMPORT_PREFIX}/include" |
| 71 | +) |
| 72 | +# Place header files into the right folders - Done! |
| 73 | + |
| 74 | +# The Debug version of this lib is built with: |
| 75 | +# #define FOONATHAN_MEMORY_DEBUG_FILL 1 |
| 76 | +# and Release version is built with: |
| 77 | +# #define FOONATHAN_MEMORY_DEBUG_FILL 0 |
| 78 | +# We only have the Release version header files installed, however. |
| 79 | +vcpkg_replace_string( |
| 80 | + ${CURRENT_PACKAGES_DIR}/include/foonathan/memory/detail/debug_helpers.hpp |
| 81 | + "#if FOONATHAN_MEMORY_DEBUG_FILL" |
| 82 | + "#ifndef NDEBUG //#if FOONATHAN_MEMORY_DEBUG_FILL" |
| 83 | +) |
| 84 | + |
| 85 | +file(REMOVE_RECURSE |
| 86 | + ${CURRENT_PACKAGES_DIR}/debug/include |
| 87 | + ${CURRENT_PACKAGES_DIR}/debug/share |
| 88 | +) |
| 89 | + |
| 90 | +file(REMOVE |
| 91 | + ${CURRENT_PACKAGES_DIR}/debug/LICENSE |
| 92 | + ${CURRENT_PACKAGES_DIR}/debug/README.md |
| 93 | + ${CURRENT_PACKAGES_DIR}/LICENSE |
| 94 | + ${CURRENT_PACKAGES_DIR}/README.md |
| 95 | +) |
| 96 | + |
| 97 | +if(FOONATHAN_MEMORY_BUILD_TOOLS) |
| 98 | + if(NOT VCPKG_CMAKE_SYSTEM_NAME OR |
| 99 | + VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") |
| 100 | + set(EXECUTABLE_SUFFIX ".exe") |
| 101 | + else() |
| 102 | + set(EXECUTABLE_SUFFIX "") |
| 103 | + endif() |
| 104 | + |
| 105 | + file(COPY |
| 106 | + ${CURRENT_PACKAGES_DIR}/bin/nodesize_dbg${EXECUTABLE_SUFFIX} |
| 107 | + DESTINATION ${CURRENT_PACKAGES_DIR}/tools/${PORT} |
| 108 | + ) |
| 109 | + vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/${PORT}) |
| 110 | + |
| 111 | + if(VCPKG_LIBRARY_LINKAGE STREQUAL static) |
| 112 | + file(REMOVE_RECURSE |
| 113 | + ${CURRENT_PACKAGES_DIR}/bin |
| 114 | + ${CURRENT_PACKAGES_DIR}/debug/bin |
| 115 | + ) |
| 116 | + else() |
| 117 | + file(REMOVE |
| 118 | + ${CURRENT_PACKAGES_DIR}/bin/nodesize_dbg${EXECUTABLE_SUFFIX} |
| 119 | + ${CURRENT_PACKAGES_DIR}/debug/bin/nodesize_dbg${EXECUTABLE_SUFFIX} |
| 120 | + ) |
| 121 | + endif() |
| 122 | +endif() |
| 123 | + |
| 124 | +# Handle copyright |
| 125 | +configure_file(${SOURCE_PATH}/LICENSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY) |
| 126 | + |
| 127 | +# CMake integration test |
| 128 | +vcpkg_test_cmake(PACKAGE_NAME ${PORT}) |
0 commit comments