|
| 1 | +vcpkg_download_distfile(SPDLOG_BACKPORT_3541_PATCH |
| 2 | + URLS https://github.com/gabime/spdlog/commit/1685e694c5cd8328280c48f8b94b1281c17c6fee.patch?full_index=1 |
| 3 | + FILENAME spdlog-backport-3541.patch |
| 4 | + SHA512 9b5340c93b9a869ae7479395e23672288fc3b4347fc1e9a4535b580a6ade1dadd985e939fb5fbb820d262f0c2153599a88dd572443b62dab3498da8b327ee034 |
| 5 | +) |
| 6 | +vcpkg_download_distfile(SPDLOG_BACKPORT_3543_PATCH |
| 7 | + URLS https://github.com/gabime/spdlog/commit/d5af52d903ed69f96c7350155e94aeff248b31eb.patch?full_index=1 |
| 8 | + FILENAME spdlog-backport-3543.patch |
| 9 | + SHA512 ada7e63920a48fa1641bf4929b6172c4e8570e2610534caf9fd1a769d00d304b7c5907987420f85989295a939aa1e75cf18c54bbf3ccc6ccad594a24aba2e8b9 |
| 10 | +) |
| 11 | + |
| 12 | +vcpkg_from_github( |
| 13 | + OUT_SOURCE_PATH SOURCE_PATH |
| 14 | + REPO gabime/spdlog |
| 15 | + REF "v${VERSION}" |
| 16 | + SHA512 8df117055d19ff21c9c9951881c7bdf27cc0866ea3a4aa0614b2c3939cedceab94ac9abaa63dc4312b51562b27d708cb2f014c68c603fd1c1051d3ed5c1c3087 |
| 17 | + HEAD_REF v1.x |
| 18 | + PATCHES |
| 19 | + "${SPDLOG_BACKPORT_3541_PATCH}" |
| 20 | + "${SPDLOG_BACKPORT_3543_PATCH}" |
| 21 | +) |
| 22 | + |
| 23 | +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS |
| 24 | + FEATURES |
| 25 | + benchmark SPDLOG_BUILD_BENCH |
| 26 | + fmt SPDLOG_FMT_EXTERNAL |
| 27 | + wchar SPDLOG_WCHAR_SUPPORT |
| 28 | + INVERTED_FEATURES |
| 29 | + fmt SPDLOG_USE_STD_FORMAT |
| 30 | + tz-offset SPDLOG_NO_TZ_OFFSET |
| 31 | +) |
| 32 | + |
| 33 | +# SPDLOG_WCHAR_FILENAMES can only be configured in triplet file since it is an alternative (not additive) |
| 34 | +if(NOT DEFINED SPDLOG_WCHAR_FILENAMES) |
| 35 | + set(SPDLOG_WCHAR_FILENAMES OFF) |
| 36 | +endif() |
| 37 | +if(NOT VCPKG_TARGET_IS_WINDOWS AND SPDLOG_WCHAR_FILENAMES) |
| 38 | + message(FATAL_ERROR "Build option 'SPDLOG_WCHAR_FILENAMES' is for Windows.") |
| 39 | +endif() |
| 40 | + |
| 41 | +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" SPDLOG_BUILD_SHARED) |
| 42 | + |
| 43 | +vcpkg_cmake_configure( |
| 44 | + SOURCE_PATH "${SOURCE_PATH}" |
| 45 | + OPTIONS |
| 46 | + ${FEATURE_OPTIONS} |
| 47 | + -DSPDLOG_INSTALL=ON |
| 48 | + -DSPDLOG_BUILD_SHARED=${SPDLOG_BUILD_SHARED} |
| 49 | + -DSPDLOG_WCHAR_FILENAMES=${SPDLOG_WCHAR_FILENAMES} |
| 50 | + -DSPDLOG_BUILD_EXAMPLE=OFF |
| 51 | +) |
| 52 | + |
| 53 | +vcpkg_cmake_install() |
| 54 | +vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/spdlog) |
| 55 | +vcpkg_fixup_pkgconfig() |
| 56 | +vcpkg_copy_pdbs() |
| 57 | + |
| 58 | +if(NOT VCPKG_BUILD_TYPE) |
| 59 | + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/spdlog.pc" " -lspdlog" " -lspdlogd") |
| 60 | +endif() |
| 61 | + |
| 62 | +# add support for integration other than cmake |
| 63 | +if(SPDLOG_FMT_EXTERNAL) |
| 64 | + vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/include/spdlog/tweakme.h |
| 65 | + "// #define SPDLOG_FMT_EXTERNAL" |
| 66 | + "#ifndef SPDLOG_FMT_EXTERNAL\n#define SPDLOG_FMT_EXTERNAL\n#endif" |
| 67 | + ) |
| 68 | +endif() |
| 69 | +if(SPDLOG_USE_STD_FORMAT) |
| 70 | + vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/include/spdlog/tweakme.h |
| 71 | + "// #define SPDLOG_USE_STD_FORMAT" |
| 72 | + "#ifndef SPDLOG_USE_STD_FORMAT\n#define SPDLOG_USE_STD_FORMAT\n#endif" |
| 73 | + ) |
| 74 | +endif() |
| 75 | +if(SPDLOG_WCHAR_SUPPORT) |
| 76 | + vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/include/spdlog/tweakme.h |
| 77 | + "// #define SPDLOG_WCHAR_TO_UTF8_SUPPORT" |
| 78 | + "#ifndef SPDLOG_WCHAR_TO_UTF8_SUPPORT\n#define SPDLOG_WCHAR_TO_UTF8_SUPPORT\n#endif" |
| 79 | + ) |
| 80 | +endif() |
| 81 | +if(SPDLOG_WCHAR_FILENAMES) |
| 82 | + vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/include/spdlog/tweakme.h |
| 83 | + "// #define SPDLOG_WCHAR_FILENAMES" |
| 84 | + "#ifndef SPDLOG_WCHAR_FILENAMES\n#define SPDLOG_WCHAR_FILENAMES\n#endif" |
| 85 | + ) |
| 86 | +endif() |
| 87 | + |
| 88 | +file(REMOVE_RECURSE |
| 89 | + "${CURRENT_PACKAGES_DIR}/include/spdlog/fmt/bundled" |
| 90 | + "${CURRENT_PACKAGES_DIR}/debug/include" |
| 91 | + "${CURRENT_PACKAGES_DIR}/debug/share" |
| 92 | +) |
| 93 | + |
| 94 | +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") |
| 95 | +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") |
0 commit comments