Skip to content

Commit

Permalink
[snappy] Update to 1.1.10 and disable optimizations based on hardware…
Browse files Browse the repository at this point in the history
… support (microsoft#26828)
  • Loading branch information
Osyotr authored Jul 27, 2023
1 parent f204b54 commit 16eeb02
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 7 deletions.
11 changes: 11 additions & 0 deletions ports/snappy/no-werror.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -68,7 +68,7 @@

# Use -Werror for clang only.
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
- if(NOT CMAKE_CXX_FLAGS MATCHES "-Werror")
+ if(0)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
endif(NOT CMAKE_CXX_FLAGS MATCHES "-Werror")
endif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
16 changes: 13 additions & 3 deletions ports/snappy/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,31 @@ vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO google/snappy
REF ${version}
SHA512 f1f8a90f5f7f23310423574b1d8c9acb84c66ea620f3999d1060395205e5760883476837aba02f0aa913af60819e34c625d8308c18a5d7a9c4e190f35968b024
SHA512 3578597f1d4ec09104ce0296b825b013590351230dfe56c635081fd282ce7a13a34caf2c283ac77bd24065e2d27af6db068d1f84b98cec2fd39a0e37a0d77070
HEAD_REF master
PATCHES
fix_clang-cl_build.patch
no-werror.patch
)

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DSNAPPY_BUILD_TESTS=OFF
-DSNAPPY_BUILD_BENCHMARKS=OFF

# These variables can be overriden in a custom triplet, see usage file
-DSNAPPY_HAVE_SSSE3=OFF
-DSNAPPY_HAVE_X86_CRC32=OFF
-DSNAPPY_HAVE_NEON_CRC32=OFF
-DSNAPPY_HAVE_BMI2=OFF
-DSNAPPY_HAVE_NEON=OFF
)

vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/Snappy)
vcpkg_copy_pdbs()

string(JSON version GET "${manifest}" version)
string(JSON description GET "${manifest}" description)
set(name "${PORT}")

Expand All @@ -34,4 +41,7 @@ endif()


file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

file(COPY "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")
13 changes: 13 additions & 0 deletions ports/snappy/usage
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
snappy provides CMake targets:

find_package(Snappy CONFIG REQUIRED)
target_link_libraries(main PRIVATE Snappy::snappy)

Optimizations based on hardware support are disabled by default.
You can enable them by adding corresponding flags to VCPKG_CMAKE_CONFIGURE_OPTIONS inside a custom triplet file, for example:

if("${PORT}" STREQUAL "snappy")
list(APPEND VCPKG_CMAKE_CONFIGURE_OPTIONS -DSNAPPY_HAVE_SSSE3=ON -DSNAPPY_HAVE_BMI2=ON)
endif()

For a full list of possible options, see project's root CMakeLists.txt.
3 changes: 1 addition & 2 deletions ports/snappy/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "snappy",
"version": "1.1.9",
"port-version": 5,
"version": "1.1.10",
"description": "A fast compressor/decompressor.",
"homepage": "https://github.com/google/snappy",
"license": null,
Expand Down
4 changes: 2 additions & 2 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -7621,8 +7621,8 @@
"port-version": 9
},
"snappy": {
"baseline": "1.1.9",
"port-version": 5
"baseline": "1.1.10",
"port-version": 0
},
"sndfile": {
"baseline": "0",
Expand Down
5 changes: 5 additions & 0 deletions versions/s-/snappy.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "674abac6de71455f63c6649f436ff0801545ae00",
"version": "1.1.10",
"port-version": 0
},
{
"git-tree": "a97f6aac039dc2b5e6fdac753d66b94cfb408d30",
"version": "1.1.9",
Expand Down

0 comments on commit 16eeb02

Please sign in to comment.