SHA256
11
0
forked from pool/snappy

21 Commits

Author SHA256 Message Date
1d0350d0cd Accepting request 1161374 from devel:libraries:c_c++
OBS-URL: https://build.opensuse.org/request/show/1161374
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/snappy?expand=0&rev=11
2024-03-25 20:06:14 +00:00
Danilo Spinella
9fc9daacc5 Accepting request 1161373 from home:dspinella:branches:devel:libraries:c_c++
- Fix build with GTest 1.14.0 by using C++14, bsc#1221872

OBS-URL: https://build.opensuse.org/request/show/1161373
OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/snappy?expand=0&rev=22
2024-03-25 11:36:48 +00:00
68015f86f4 Accepting request 1124994 from devel:libraries:c_c++
- update to 1.1.10:
  * Performance improvements
  * Compilation fixes for various environments
- drop fix-always-inline.patch (obsolete)

  - This is a maintenance release with no changes to the actual

OBS-URL: https://build.opensuse.org/request/show/1124994
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/snappy?expand=0&rev=10
2023-11-13 21:15:42 +00:00
eef6e203d4 - update to 1.1.10:
* Performance improvements
  * Compilation fixes for various environments
- drop fix-always-inline.patch (obsolete)
  - This is a maintenance release with no changes to the actual

OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/snappy?expand=0&rev=20
2023-11-10 13:57:31 +00:00
6372de1ce3 Accepting request 929633 from devel:libraries:c_c++
OBS-URL: https://build.opensuse.org/request/show/929633
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/snappy?expand=0&rev=9
2021-11-06 17:15:40 +00:00
Danilo Spinella
da1721426d Accepting request 927746 from filesystems:ceph:master:upstream
Re-enable RTTI, to fix Ceph runtime failures (for details see https://tracker.ceph.com/issues/53060 and https://github.com/google/snappy/pull/144).  Note that we're already carrying a similar patch for leveldb, for the same reason.  If accepted, please pass this on to Factory.  Thank you!

OBS-URL: https://build.opensuse.org/request/show/927746
OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/snappy?expand=0&rev=19
2021-11-05 10:53:06 +00:00
a96492af76 Accepting request 907347 from devel:libraries:c_c++
Automatic submission by obs-autosubmit

OBS-URL: https://build.opensuse.org/request/show/907347
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/snappy?expand=0&rev=8
2021-08-04 20:28:17 +00:00
Danilo Spinella
3bbb4b46cb Accepting request 906176 from home:dspinella:branches:devel:libraries:c_c++
- Update to 1.1.9:
  * Performance improvements
- Add fix-always-inline.patch
- Add use-system-test-libs.patch
- Add a hardcoded snappy.pc file

OBS-URL: https://build.opensuse.org/request/show/906176
OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/snappy?expand=0&rev=18
2021-07-14 08:29:50 +00:00
da81a5af07 Accepting request 829564 from devel:libraries:c_c++
- update to 1.1.8:
  * Small performance improvements.
  * Removed snappy::string alias for std::string.
  * Improved CMake configuration.
- remove snappy-pcfile.patch (never went upstream)

OBS-URL: https://build.opensuse.org/request/show/829564
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/snappy?expand=0&rev=7
2020-08-28 19:14:31 +00:00
407c983dec - update to 1.1.8:
* Small performance improvements.
  * Removed snappy::string alias for std::string.
  * Improved CMake configuration.
- remove snappy-pcfile.patch (never went upstream)

OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/snappy?expand=0&rev=16
2020-08-25 13:20:09 +00:00
620814e771 Accepting request 574330 from devel:libraries:c_c++
OBS-URL: https://build.opensuse.org/request/show/574330
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/snappy?expand=0&rev=6
2018-02-12 09:10:25 +00:00
Tomáš Chvátal
9407e215eb Accepting request 574307 from home:jengelh:branches:devel:libraries:c_c++
- Better neutrality of from description. Quantify "Core i7".
  Trim description of SRPM and -devel as the user already has an
  idea what to look for.
- Fix RPM groups.

OBS-URL: https://build.opensuse.org/request/show/574307
OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/snappy?expand=0&rev=14
2018-02-08 16:47:49 +00:00
Tomáš Chvátal
a810b6947b - Version update to 1.1.7:
* Aarch64 fixes
  * ppc speedups
  * PIE improvements
  * Switch to cmake build system
- Add patch snappy-pcfile.patch:
  * Pull 55 on upstream github, was dropped when moving to cmake
    of course we still need it
- Fix license install wrt bsc#1080040

OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/snappy?expand=0&rev=13
2018-02-08 11:55:43 +00:00
Tomáš Chvátal
4e770deff0 Accepting request 488140 from home:TheBlackCat:branches:devel:libraries:c_c++
- Version bump to 1.1.4
- Use better download url.

OBS-URL: https://build.opensuse.org/request/show/488140
OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/snappy?expand=0&rev=12
2017-04-18 10:57:37 +00:00
96685c18de Accepting request 319376 from devel:libraries:c_c++
- Version bump to 1.1.3:
  * See the NEWS file for full details
- Switch to distribution from github
- Remove upstreamed patch:
  * snappy-1.1.1-random-return.patch

- Add baselibs.conf: build snappy1-32bit, as needed by
  libqt5-qtwebengine-32bit.

- Update to version 1.1.2
  - This is a maintenance release with no changes to the actual 
    library source code.
    * Stop distributing benchmark data files that have unclear
      or unsuitable licensing.
    * Add support for padding chunks in the framing format.

OBS-URL: https://build.opensuse.org/request/show/319376
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/snappy?expand=0&rev=5
2015-08-21 05:35:20 +00:00
Tomáš Chvátal
f2113ff790 - Version bump to 1.1.3:
* See the NEWS file for full details
- Switch to distribution from github
- Remove upstreamed patch:
  * snappy-1.1.1-random-return.patch

OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/snappy?expand=0&rev=10
2015-07-29 11:03:33 +00:00
85c6f49dc6 Accepting request 319250 from home:dimstar:Factory
- Add baselibs.conf: build snappy1-32bit, as needed by
  libqt5-qtwebengine-32bit.

OBS-URL: https://build.opensuse.org/request/show/319250
OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/snappy?expand=0&rev=9
2015-07-29 10:05:15 +00:00
Ismail Dönmez
517065cd72 Accepting request 248455 from devel:languages:python3
1

OBS-URL: https://build.opensuse.org/request/show/248455
OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/snappy?expand=0&rev=8
2014-09-11 10:14:18 +00:00
Stephan Kulow
aad36261f5 Accepting request 206979 from devel:libraries:c_c++
Update (forwarded request 206746 from posophe)

OBS-URL: https://build.opensuse.org/request/show/206979
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/snappy?expand=0&rev=3
2013-11-15 12:39:00 +00:00
a924899339 Accepting request 206746 from home:posophe:branches:devel:libraries:c_c++
Update

OBS-URL: https://build.opensuse.org/request/show/206746
OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/snappy?expand=0&rev=6
2013-11-15 08:54:58 +00:00
Stephan Kulow
48e3b94d7d Accepting request 196062 from devel:libraries:c_c++
add snappy to Factory, see FATE in changes

OBS-URL: https://build.opensuse.org/request/show/196062
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/snappy?expand=0&rev=1
2013-09-05 21:26:03 +00:00
9 changed files with 307 additions and 122 deletions

BIN
1.1.10.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

1
baselibs.conf Normal file
View File

@@ -0,0 +1 @@
libsnappy1

25
reenable-rtti.patch Normal file
View File

@@ -0,0 +1,25 @@
Index: snappy-1.1.9/CMakeLists.txt
===================================================================
--- snappy-1.1.9.orig/CMakeLists.txt
+++ snappy-1.1.9/CMakeLists.txt
@@ -51,10 +51,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC"
string(REGEX REPLACE "/EH[a-z]+" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHs-c-")
add_definitions(-D_HAS_EXCEPTIONS=0)
-
- # Disable RTTI.
- string(REGEX REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-")
else(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# Use -Wall for clang and gcc.
if(NOT CMAKE_CXX_FLAGS MATCHES "-Wall")
@@ -77,9 +73,6 @@ else(CMAKE_CXX_COMPILER_ID STREQUAL "MSV
string(REGEX REPLACE "-fexceptions" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions")
- # Disable RTTI.
- string(REGEX REPLACE "-frtti" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
endif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to make

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1fa82bc588bb93fa74dfc0e2e9b7d63b6e2a20ede323ef42bf0af0f947676160
size 1719945

View File

@@ -1,61 +0,0 @@
---
snappy-test.h | 8 ++++++--
snappy_unittest.cc | 1 +
2 files changed, 7 insertions(+), 2 deletions(-)
Index: snappy_unittest.cc
===================================================================
--- snappy_unittest.cc.orig
+++ snappy_unittest.cc
@@ -161,6 +161,7 @@ static size_t MinimumRequiredOutputSpace
default:
LOG(FATAL) << "Unknown compression type number " << comp;
+ return -1; //make gcc happy
}
}
Index: snappy-test.h
===================================================================
--- snappy-test.h.orig
+++ snappy-test.h
@@ -132,13 +132,15 @@ namespace File {
} // namespace File
namespace file {
- int Defaults() { }
+ int Defaults() { return 0; } //make gcc happy
class DummyStatus {
public:
void CheckSuccess() { }
};
+ DummyStatus _dummy_ret;
+
DummyStatus ReadFileToString(const char* filename, string* data, int unused) {
FILE* fp = fopen(filename, "rb");
if (fp == NULL) {
@@ -158,12 +160,13 @@ namespace file {
}
fclose(fp);
+ return _dummy_ret; //make gcc happy
}
DummyStatus ReadFileToString(const string& filename,
string* data,
int unused) {
- ReadFileToString(filename.c_str(), data, unused);
+ return ReadFileToString(filename.c_str(), data, unused);
}
DummyStatus WriteStringToFile(const string& str,
@@ -182,6 +185,7 @@ namespace file {
}
fclose(fp);
+ return _dummy_ret; //make gcc happy
}
} // namespace file

View File

@@ -1,3 +1,108 @@
-------------------------------------------------------------------
Mon Mar 25 11:34:39 UTC 2024 - Danilo Spinella <danilo.spinella@suse.com>
- Fix build with GTest 1.14.0 by using C++14, bsc#1221872
-------------------------------------------------------------------
Fri Nov 10 13:54:10 UTC 2023 - Dirk Müller <dmueller@suse.com>
- update to 1.1.10:
* Performance improvements
* Compilation fixes for various environments
- drop fix-always-inline.patch (obsolete)
-------------------------------------------------------------------
Wed Oct 27 06:25:52 UTC 2021 - Tim Serong <tserong@suse.com>
- Re-enable RTTI, without which other applications can't subclass
snappy::Source (this breaks Ceph, as one example)
- Add reenable-rtti.patch
-------------------------------------------------------------------
Tue Jul 13 16:38:54 UTC 2021 - Danilo Spinella <danilo.spinella@suse.com>
- Update to 1.1.9:
* Performance improvements
- Add fix-always-inline.patch
- Add use-system-test-libs.patch
- Add a hardcoded snappy.pc file
-------------------------------------------------------------------
Tue Aug 25 13:06:16 UTC 2020 - Dirk Mueller <dmueller@suse.com>
- update to 1.1.8:
* Small performance improvements.
* Removed snappy::string alias for std::string.
* Improved CMake configuration.
- remove snappy-pcfile.patch (never went upstream)
-------------------------------------------------------------------
Thu Feb 8 15:00:05 UTC 2018 - jengelh@inai.de
- Better neutrality of from description. Quantify "Core i7".
Trim description of SRPM and -devel as the user already has an
idea what to look for.
- Fix RPM groups.
-------------------------------------------------------------------
Thu Feb 8 11:23:03 UTC 2018 - tchvatal@suse.com
- Version update to 1.1.7:
* Aarch64 fixes
* ppc speedups
* PIE improvements
* Switch to cmake build system
- Add patch snappy-pcfile.patch:
* Pull 55 on upstream github, was dropped when moving to cmake
of course we still need it
- Fix license install wrt bsc#1080040
-------------------------------------------------------------------
Sat Apr 15 23:55:17 UTC 2017 - toddrme2178@gmail.com
- Version bump to 1.1.4
* Fix a 1% performance regression when snappy is used in PIE executables.
* Improve compression performance by 5%.
* Improve decompression performance by 20%.
- Use better download url.
-------------------------------------------------------------------
Wed Jul 29 10:42:56 UTC 2015 - tchvatal@suse.com
- Version bump to 1.1.3:
* See the NEWS file for full details
- Switch to distribution from github
- Remove upstreamed patch:
* snappy-1.1.1-random-return.patch
-------------------------------------------------------------------
Wed Jul 29 09:58:16 UTC 2015 - dimstar@opensuse.org
- Add baselibs.conf: build snappy1-32bit, as needed by
libqt5-qtwebengine-32bit.
-------------------------------------------------------------------
Thu Sep 11 09:34:36 UTC 2014 - toddrme2178@gmail.com
- Update to version 1.1.2
- This is a maintenance release with no changes to the actual
library source code.
* Stop distributing benchmark data files that have unclear
or unsuitable licensing.
* Add support for padding chunks in the framing format.
-------------------------------------------------------------------
Wed Nov 13 12:44:42 UTC 2013 - p.drouand@gmail.com
- Update to version 1.1.1
* Add support for uncompressing to iovecs (scatter I/O).
* Speed up decompression by ~2%; much more so (~13-20%) on
a few benchmarks on given compilers and CPUs.
* Fix a few issues with MSVC compilation.
* Support truncated test data in the benchmark.
- Adapt patch to upstream changes
* snappy-random-return.patch > snappy-1.1.1-random-return.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Aug 22 12:56:27 UTC 2013 - cdenicolo@suse.com Thu Aug 22 12:56:27 UTC 2013 - cdenicolo@suse.com

10
snappy.pc Normal file
View File

@@ -0,0 +1,10 @@
prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib64
includedir=${prefix}/include
Name: snappy
Description: A compressor/decompressor library favoring time
Version: 1.1.9
Libs: -L${libdir} -lsnappy
Cflags: -I${includedir}

View File

@@ -1,7 +1,7 @@
# #
# spec file for package snappy # spec file for package snappy
# #
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. # Copyright (c) 2024 SUSE LLC
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@@ -12,106 +12,91 @@
# license that conforms to the Open Source Definition (Version 1.9) # license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative. # published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/ # Please submit bugfixes or comments via https://bugs.opensuse.org/
# #
%define lib_name libsnappy1
%define libname libsnappy1
Name: snappy Name: snappy
Version: 1.1.0 Version: 1.1.10
Release: 0 Release: 0
Summary: A fast compressor/decompressor library Summary: A compressor/decompressor library favoring time
License: BSD-3-Clause License: BSD-3-Clause
Group: Development/Libraries/C and C++ Group: Development/Libraries/C and C++
Url: http://code.google.com/p/snappy/ URL: https://github.com/google/snappy/
Source0: http://snappy.googlecode.com/files/%{name}-%{version}.tar.gz Source0: https://github.com/google/snappy/archive/%{version}.tar.gz
#PATCH-FIX-OPENSUSE: fix minor things in unittest, probably not worth for upstreaming ... Source1: snappy.pc
Patch0: snappy-random-return.patch Source99: baselibs.conf
BuildRoot: %{_tmppath}/%{name}-%{version}-build Patch0: use-system-test-libs.patch
Patch2: reenable-rtti.patch
BuildRequires: cmake
BuildRequires: gcc-c++ BuildRequires: gcc-c++
BuildRequires: lzo-devel BuildRequires: lzo-devel
BuildRequires: zlib-devel BuildRequires: pkgconfig
BuildRequires: pkgconfig(benchmark)
BuildRequires: pkgconfig(gtest)
BuildRequires: pkgconfig(zlib)
%description %description
Snappy is a compression/decompression library. It does not aim for maximum Snappy is a compression/decompression library. It does not aim for maximum
compression, or compatibility with any other compression library; instead, it compression, or compatibility with any other compression library; instead, it
aims for very high speeds and reasonable compression. For instance, compared to aims for high speeds and reasonable compression.
the fastest mode of zlib, Snappy is an order of magnitude faster for most
inputs, but the resulting compressed files are anywhere from 20% to 100%
bigger. On a single core of a Core i7 processor in 64-bit mode, Snappy
compresses at about 250 MB/sec or more and decompresses at about
500 MB/sec or more.
%package -n %{lib_name} %package -n %{libname}
Summary: Shared library from snappy Summary: Shared library from snappy
Group: Development/Libraries/C and C++ Group: System/Libraries
%description -n %{lib_name} %description -n %{libname}
Snappy is a compression/decompression library. It does not aim for maximum compression, Snappy is a compression/decompression library. It does not aim for maximum
or compatibility with any other compression library; instead, it aims for very high compression, or compatibility with any other compression library; instead, it
speeds and reasonable compression. For instance, compared to the fastest mode of zlib, aims for high speeds and reasonable compression. For instance, compared to
Snappy is an order of magnitude faster for most inputs, but the resulting compressed the fastest mode of zlib, Snappy is an order of magnitude faster for most
files are anywhere from 20% to 100% bigger. On a single core of a Core i7 processor inputs, but the resulting compressed files are anywhere from 20%% to 100%%
in 64-bit mode, Snappy compresses at about 250 MB/sec or more and decompresses at about bigger. On a single core of a 1st-generation Core i7 processor in 64-bit
mode, Snappy compresses at about 250 MB/sec or more and decompresses at about
500 MB/sec or more. 500 MB/sec or more.
This package holds the shared library of snappy. This package holds the shared library of snappy.
%package devel %package devel
Requires: %{lib_name} = %{version}
Summary: Development files for snappy Summary: Development files for snappy
Group: Development/Libraries/C and C++ Group: Development/Libraries/C and C++
Requires: %{libname} = %{version}
%description devel %description devel
Snappy is a compression/decompression library. It does not aim for maximum Snappy is a compression/decompression library. It does not aim for maximum
compression, or compatibility with any other compression library; instead, it compression, or compatibility with any other compression library; instead, it
aims for very high speeds and reasonable compression. For instance, compared to aims for high speeds and reasonable compression.
the fastest mode of zlib, Snappy is an order of magnitude faster for most
inputs, but the resulting compressed files are anywhere from 20% to 100%
bigger. On a single core of a Core i7 processor in 64-bit mode, Snappy
compresses at about 250 MB/sec or more and decompresses at about
500 MB/sec or more.
This package holds the development files for snappy. This package holds the development files for snappy.
%prep %prep
%setup -q %autosetup
%patch0 -p0
%build %build
# mvyskocil: disable assertions to improve a speed a bit in microbenchmarks and hopefully in real-world use as well %cmake -DSNAPPY_USE_BUNDLED_GTEST=OFF -DSNAPPY_USE_BUNDLED_BENCHMARK_LIB=OFF -DCMAKE_CXX_STANDARD=14
# http://code.google.com/p/snappy/issues/detail?id=40 %make_build
%configure CXXFLAGS="%{optflags} -DNDEBUG" \
--with-pic \
--disable-static \
--docdir=%{_defaultdocdir}/%{name}
make %{?_smp_flags}
%install %install
%makeinstall %cmake_install
find %{buildroot} -name \*.la -delete -print install -d -m 755 %{buildroot}%{_libdir}/pkgconfig
rm %{buildroot}/%{_defaultdocdir}/%{name}/INSTALL install -m 644 %{SOURCE1} %{buildroot}%{_libdir}/pkgconfig/%{name}.pc
%check %check
make check %ctest
%clean %post -n %{libname} -p /sbin/ldconfig
rm -rf %{buildroot} %postun -n %{libname} -p /sbin/ldconfig
%post -n %{lib_name} -p /sbin/ldconfig %files -n %{libname}
%postun -n %{lib_name} -p /sbin/ldconfig %license COPYING
%files -n %{lib_name}
%defattr(-,root,root,-)
%doc %{_defaultdocdir}/%{name}/COPYING
%{_libdir}/libsnappy.so.* %{_libdir}/libsnappy.so.*
%files devel %files devel
%defattr(-,root,root,-)
%{_includedir}/snappy*.h %{_includedir}/snappy*.h
%{_libdir}/libsnappy.so %{_libdir}/libsnappy.so
%doc %{_defaultdocdir}/%{name} %dir %{_libdir}/cmake/Snappy/
%exclude %{_defaultdocdir}/%{name}/COPYING %{_libdir}/cmake/Snappy/*
%{_libdir}/pkgconfig/%{name}.pc
%changelog %changelog

120
use-system-test-libs.patch Normal file
View File

@@ -0,0 +1,120 @@
From 114df35e84ad95b6d5afbcf69aa85a14ff029000 Mon Sep 17 00:00:00 2001
From: Danilo Spinella <danilo.spinella@suse.com>
Date: Fri, 9 Jul 2021 16:57:35 +0200
Subject: [PATCH] Add a switch to use system gtest and benchmark
Upstream: https://github.com/google/snappy/pull/132
Allow to use the gtest and benchmark libraries from the system.
Use pkg-config to check that the libraries are installed and to
add the correct cflags/link flags.
---
CMakeLists.txt | 66 ++++++++++++++++++++++++++++++++++++--------------
1 file changed, 48 insertions(+), 18 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 672561e..eb2a743 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -90,6 +90,14 @@ option(SNAPPY_BUILD_TESTS "Build Snappy's own tests." ON)
option(SNAPPY_BUILD_BENCHMARKS "Build Snappy's benchmarks" ON)
+if(UNIX)
+ option(SNAPPY_USE_BUNDLED_GTEST "Build test using bundled googletest library" ON)
+ option(SNAPPY_USE_BUNDLED_BENCHMARK_LIB "Build benchmarks using bundled benchmark library" ON)
+else(UNIX)
+ set(SNAPPY_USE_BUNDLED_GTEST ON)
+ set(SNAPPY_USE_BUNDLED_BENCHMARK_LIB ON)
+endif(UNIX)
+
option(SNAPPY_FUZZING_BUILD "Build Snappy for fuzzing." OFF)
option(SNAPPY_REQUIRE_AVX "Target processors with AVX support." OFF)
@@ -284,29 +292,40 @@ endif(SNAPPY_BUILD_TESTS OR SNAPPY_BUILD_BENCHMARKS)
if(SNAPPY_BUILD_TESTS)
enable_testing()
- # Prevent overriding the parent project's compiler/linker settings on Windows.
- set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
- set(install_gtest OFF)
- set(install_gmock OFF)
- set(build_gmock ON)
-
- # This project is tested using GoogleTest.
- add_subdirectory("third_party/googletest")
-
- # GoogleTest triggers a missing field initializers warning.
- if(SNAPPY_HAVE_NO_MISSING_FIELD_INITIALIZERS)
- set_property(TARGET gtest
- APPEND PROPERTY COMPILE_OPTIONS -Wno-missing-field-initializers)
- set_property(TARGET gmock
- APPEND PROPERTY COMPILE_OPTIONS -Wno-missing-field-initializers)
- endif(SNAPPY_HAVE_NO_MISSING_FIELD_INITIALIZERS)
+ if(SNAPPY_USE_BUNDLED_GTEST)
+ # Prevent overriding the parent project's compiler/linker settings on Windows.
+ set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
+ set(install_gtest OFF)
+ set(install_gmock OFF)
+ set(build_gmock ON)
+
+ # This project is tested using GoogleTest.
+ add_subdirectory("third_party/googletest")
+
+ # GoogleTest triggers a missing field initializers warning.
+ if(SNAPPY_HAVE_NO_MISSING_FIELD_INITIALIZERS)
+ set_property(TARGET gtest
+ APPEND PROPERTY COMPILE_OPTIONS -Wno-missing-field-initializers)
+ set_property(TARGET gmock
+ APPEND PROPERTY COMPILE_OPTIONS -Wno-missing-field-initializers)
+ endif(SNAPPY_HAVE_NO_MISSING_FIELD_INITIALIZERS)
+ else(SNAPPY_USE_BUNDLED_GTEST)
+ find_package(PkgConfig)
+ pkg_search_module(GTEST REQUIRED gtest_main)
+ endif(SNAPPY_USE_BUNDLED_GTEST)
add_executable(snappy_unittest "")
target_sources(snappy_unittest
PRIVATE
"snappy_unittest.cc"
)
- target_link_libraries(snappy_unittest snappy_test_support gmock_main gtest)
+ target_link_libraries(snappy_unittest snappy_test_support)
+ if(SNAPPY_USE_BUNDLED_GTEST)
+ target_link_libraries(snappy_unittest gmock_main gtest)
+ else(SNAPPY_USE_BUNDLED_BENCHMARK_LIB)
+ target_link_libraries(snappy_unittest ${GTEST_LDFLAGS})
+ target_compile_options(snappy_unittest PUBLIC ${GTEST_CFLAGS})
+ endif(SNAPPY_USE_BUNDLED_GTEST)
add_test(
NAME snappy_unittest
@@ -322,17 +341,28 @@ if(SNAPPY_BUILD_TESTS)
endif(SNAPPY_BUILD_TESTS)
if(SNAPPY_BUILD_BENCHMARKS)
+ if(NOT SNAPPY_USE_BUNDLED_BENCHMARK_LIB)
+ find_package(PkgConfig)
+ pkg_search_module(BENCHMARK REQUIRED benchmark)
+ endif(NOT SNAPPY_USE_BUNDLED_BENCHMARK_LIB)
+
add_executable(snappy_benchmark "")
target_sources(snappy_benchmark
PRIVATE
"snappy_benchmark.cc"
)
target_link_libraries(snappy_benchmark snappy_test_support benchmark_main)
+ if(NOT SNAPPY_USE_BUNDLED_BENCHMARK_LIB)
+ target_link_libraries(snappy_benchmark ${BENCHMARK_LDFLAGS})
+ target_compile_options(snappy_benchmark PUBLIC ${BENCHMARK_CFLAGS})
+ endif(NOT SNAPPY_USE_BUNDLED_BENCHMARK_LIB)
# This project uses Google benchmark for benchmarking.
set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "" FORCE)
set(BENCHMARK_ENABLE_EXCEPTIONS OFF CACHE BOOL "" FORCE)
- add_subdirectory("third_party/benchmark")
+ if(SNAPPY_USE_BUNDLED_BENCHMARK_LIB)
+ add_subdirectory("third_party/benchmark")
+ endif(SNAPPY_USE_BUNDLED_BENCHMARK_LIB)
endif(SNAPPY_BUILD_BENCHMARKS)
if(SNAPPY_FUZZING_BUILD)