[spdlog] Improve macro baking (#24830)

- correct vcpkg feature `wchar`
- add support for integrations other than cmake
- update port-version + vcpkg x-add-version spdlog
This commit is contained in:
Dale Phurrough 2022-05-23 23:17:10 +02:00 committed by GitHub
parent b2afb50afe
commit 840f701d83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 4 deletions

View File

@ -12,14 +12,14 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
wchar SPDLOG_WCHAR_SUPPORT wchar SPDLOG_WCHAR_SUPPORT
) )
# configured in triplet file # SPDLOG_WCHAR_FILENAMES can only be configured in triplet file since it is an alternative (not additive)
if(NOT DEFINED SPDLOG_WCHAR_FILENAMES) if(NOT DEFINED SPDLOG_WCHAR_FILENAMES)
set(SPDLOG_WCHAR_FILENAMES OFF) set(SPDLOG_WCHAR_FILENAMES OFF)
endif() endif()
if(NOT VCPKG_TARGET_IS_WINDOWS) if(NOT VCPKG_TARGET_IS_WINDOWS)
if("wchar" IN_LIST FEATURES) if("wchar" IN_LIST FEATURES)
message(WARNING "Feature 'wchar' is only supported for Windows and has no effect on other platforms.") message(WARNING "Feature 'wchar' is only supported for Windows and has no effect on other platforms.")
elseif(SPDLOG_WCHAR_FILENAMES) elseif(SPDLOG_WCHAR_FILENAMES)
message(FATAL_ERROR "Build option 'SPDLOG_WCHAR_FILENAMES' is for Windows.") message(FATAL_ERROR "Build option 'SPDLOG_WCHAR_FILENAMES' is for Windows.")
endif() endif()
endif() endif()
@ -45,10 +45,23 @@ vcpkg_copy_pdbs()
# use vcpkg-provided fmt library (see also option SPDLOG_FMT_EXTERNAL above) # use vcpkg-provided fmt library (see also option SPDLOG_FMT_EXTERNAL above)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/spdlog/fmt/bundled) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/spdlog/fmt/bundled)
# add support for integration other than cmake
vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/include/spdlog/tweakme.h vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/include/spdlog/tweakme.h
"// #define SPDLOG_FMT_EXTERNAL" "// #define SPDLOG_FMT_EXTERNAL"
"#define SPDLOG_FMT_EXTERNAL" "#ifndef SPDLOG_FMT_EXTERNAL\n#define SPDLOG_FMT_EXTERNAL\n#endif"
) )
if(SPDLOG_WCHAR_SUPPORT)
vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/include/spdlog/tweakme.h
"// #define SPDLOG_WCHAR_TO_UTF8_SUPPORT"
"#ifndef SPDLOG_WCHAR_TO_UTF8_SUPPORT\n#define SPDLOG_WCHAR_TO_UTF8_SUPPORT\n#endif"
)
endif()
if(SPDLOG_WCHAR_FILENAMES)
vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/include/spdlog/tweakme.h
"// #define SPDLOG_WCHAR_FILENAMES"
"#ifndef SPDLOG_WCHAR_FILENAMES\n#define SPDLOG_WCHAR_FILENAMES\n#endif"
)
endif()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include
${CURRENT_PACKAGES_DIR}/debug/share) ${CURRENT_PACKAGES_DIR}/debug/share)

View File

@ -1,6 +1,7 @@
{ {
"name": "spdlog", "name": "spdlog",
"version-semver": "1.10.0", "version-semver": "1.10.0",
"port-version": 1,
"description": "Very fast, header only, C++ logging library", "description": "Very fast, header only, C++ logging library",
"homepage": "https://github.com/gabime/spdlog", "homepage": "https://github.com/gabime/spdlog",
"license": "MIT", "license": "MIT",

2
versions/baseline.json Normal file → Executable file
View File

@ -6690,7 +6690,7 @@
}, },
"spdlog": { "spdlog": {
"baseline": "1.10.0", "baseline": "1.10.0",
"port-version": 0 "port-version": 1
}, },
"spectra": { "spectra": {
"baseline": "1.0.1", "baseline": "1.0.1",

5
versions/s-/spdlog.json Normal file → Executable file
View File

@ -1,5 +1,10 @@
{ {
"versions": [ "versions": [
{
"git-tree": "3256ea88cc375fda2f977a2eb18435e23d498572",
"version-semver": "1.10.0",
"port-version": 1
},
{ {
"git-tree": "1ac795913d88241171b45d796d3fe5dd38519d5a", "git-tree": "1ac795913d88241171b45d796d3fe5dd38519d5a",
"version-semver": "1.10.0", "version-semver": "1.10.0",