Skip to content
This repository has been archived by the owner on Apr 19, 2022. It is now read-only.

Commit

Permalink
Squashed 'snappy-sys/snappy/' changes from 7d3fa5c..b02bfa7
Browse files Browse the repository at this point in the history
b02bfa7 Tag open source release 1.1.7.
824e671 Add a loop alignment directive to work around a performance regression.
55924d1 Add GNUInstallDirs to CMake configuration.
632cd0f Use 64-bit optimized code path for ARM64.
77c12ad Add unistd.h checks back to the CMake build.
c8049c5 Replace getpagesize() with sysconf(_SC_PAGESIZE).
18e2f22 Add guidelines for opensource contributions.
f0d3237 Use _BitScanForward and _BitScanReverse on MSVC.
71b8f86 Add SNAPPY_ prefix to PREDICT_{TRUE,FALSE} macros.
be6dc3d Redo CMake configuration.
e4de6ce Small improvements to open source CI configuration.
c756f7f Support both static and shared library CMake builds.
038a332 Inline DISALLOW_COPY_AND_ASSIGN.
a8b239c snappy: Remove autoconf build configuration.
27671c6 Clean up CMake header and type checks.
548501c zippy: Re-release snappy 1.1.5 as 1.1.6.
513df5f Tag open source release 1.1.5.
5bc9c82 Set minimum CMake version to 3.1.
e9720a0 Update Travis CI config, add AppVeyor for Windows CI coverage.
f24f9d2 Explicitly copy internal::wordmask to the stack array to work around a compiler optimization with LLVM that converts const stack arrays to global arrays.  This is a temporary change and should be reverted when https://reviews.llvm.org/D30759 is fixed.
82deffc Remove benchmarking support for fastlz.
18488d6 Use 64 bit little endian on ppc64le.
7b9532b Improve the SSE2 macro check on Windows.
7dadcee Check for the existence of sys/uio.h in autoconf build.
83179dd Remove quicklz and lzf support in benchmarks.
c813168 Provide a CMakeLists.txt.
ed3b7b2 Clean up unused function warnings in snappy.
8b60aac Remove "using namespace std;" from zippy-stubs-internal.h.
7d7a8ec Add Travis CI configuration to snappy and fix the make build.
1cd3ab0 Rename README to README.md. It already in markdown, we might as well let github know so that it renders nicely.
597fa79 Delete UnalignedCopy64 from snappy-stubs since the version in snappy.cc is more robust and possibly faster (assuming the compiler knows how to best copy 8 bytes between locations in memory the fastest way possible - a rather safe bet).
039b3a7 Add std:: prefix to STL non-type names.
3c706d2 Make UnalignedCopy64 not exhibit undefined behavior when src and dst overlap.
d3c6d20 Add compression size reporting hooks.
626e1b9 Use #ifdef __SSE2__ for the emmintrin.h include, otherwise snappy.cc does not compile with -march=prescott.
2d99bd1 1.1.4 release.
8bfb028 Improve zippy decompression speed.
818b583 adds std:: to stl types (#061)
27c5d86 Re-work fast path for handling copies in zippy decompression.
4a74094 Speed up Zippy decompression in PIE mode by removing the penalty for global array access.
38a5ec5 Re-work fast path that emits copies in zippy compression.
094c67d Speed up the EmitLiteral fast path, +1.62% for ZFlat benchmarks.
fce661f Speed up zippy decompression by removing some zero-extensions.
e788e52 Avoid calling memset when resizing the buffer.
32d6d7d Merge pull request #6 from deviance/provide-pkg-config-data
9716135 Add #ifdef to guard against macro redefinition if this is included in another Google project that also defines this.
0000f99 Merge pull request #13 from huachaohuang/patch-1
d53de18 Make heuristic match skipping more aggressive.
2b9152d Default to glibtoolize instead of libtoolize if it exists, and also make it customizable through the environment variable $LIBTOOLIZE.
0800b1e Work around an issue where some compilers interpret <:: as a trigraph. Also correct the namespace name.
e7d2818 Unbreak the open-source build for ARM due to missing ATTRIBUTE_PACKED declaration.
7525a16 Fix an issue where the ByteSource path (used for parsing std::string) would incorrectly accept some invalid varints that the other path would not, causing potential CHECK-failures if the unit test were run with --write_uncompressed and a corrupted input file.
ef5598a Make UNALIGNED_LOAD16/32 on ARMv7 go through an explicitly unaligned struct, to avoid the compiler coalescing multiple loads into a single load instruction (which only work for aligned accesses).
b8cd908 Allow to compile in nested packages.
96a2e34 Update URLs in the Snappy README to reflect the move to GitHub.
0852af7 Move the logic from ComputeTable into the unit test, which means it's run automatically together with the other tests, and also removes the stray function ComputeTable() (which was never referenced by anything else in the open-source version, causing compiler warnings for some) out of the core library.
d803429 Fix signed-vs.-unsigned comparison warnings.
d2cb73b Provide pkg-config data
efb39e8 Release Snappy 1.1.3; getting the new Uncompress variant in a release is nice, and it's also good to finally get an official release out after the migration to GitHub.
eb66d81 Initialized members of SnappyArrayWriter and SnappyDecompressionValidator. These members were almost surely initialized before use by other member functions, but Coverity was warning about this. Eliminating these warnings minimizes clutter in that report and the likelihood of overlooking a real bug.
b2312c4 Add support for Uncompress(source, sink). Various changes to allow Uncompress(source, sink) to get the same performance as the different variants of Uncompress to Cord/DataBuffer/String/FlatBuffer.
b2ad960 Changes to eliminate compiler warnings on MSVC
e7a897e Fixed unit tests to compile under MSVC.
86eb8b1 Change a few branch annotations that profiling found to be wrong. Overall performance is neutral or slightly positive.
11ccdfb Sync with various Google-internal changes.
22acaf4 Change some internal path names.
1ff9be9 Release Snappy 1.1.2.
19690d7 Fix public issue 82: Stop distributing benchmark data files that have unclear or unsuitable licensing.
f82bff6 Add support for padding in the Snappy framed format.
eeead8d Release Snappy 1.1.1.
6bc39e2 Add autoconf tests for size_t and ssize_t. Sort-of resolves public issue 79; it would solve the problem if MSVC typically used autoconf. However, it gives a natural place (config.h) to put the typedef even for MSVC.
7c3c01d When we compare the number of bytes produced with the offset for a backreference, make the signedness of the bytes produced clear, by sticking it into a size_t. This avoids a signed/unsigned compare warning from MSVC (public issue 71), and also is slightly clearer.
2f0aaf8 In the fast path for decompressing literals, instead of checking whether there's 16 bytes free and then checking right afterwards (when having subtracted the literal size) that there are now 5 bytes free, just check once for 21 bytes. This skips a compare and a branch; although it is easily predictable, it is still a few cycles on a fast path that we would like to get rid of.
062bf54 Make the two IncrementalCopy* functions take in an ssize_t instead of a len, in order to avoid having to do 32-to-64-bit signed conversions on a hot path during decompression. (Also fixes some MSVC warnings, mentioned in public issue 75, but more of those remain.) They cannot be size_t because we expect them to go negative and test for that.
328aafa Add support for uncompressing to iovecs (scatter I/O). Windows does not have struct iovec defined anywhere, so we define our own version that's equal to what UNIX typically has.
cd92eb0 Some code reorganization needed for an internal change.
a3e928d Supports truncated test data in zippy benchmark.
bde324c Release Snappy 1.1.0.
8168446 Make ./snappy_unittest pass without "srcdir" being defined.
27a0cc3 Increase the Zippy block size from 32 kB to 64 kB, winning ~3% density while being effectively performance neutral.
81f3478 Adjust the Snappy open-source distribution for the changes in Google's internal file API.
698af46 Change a few ORs to additions where they don't matter. This helps the compiler use the LEA instruction more efficiently, since e.g. a + (b << 2) can be encoded as one instruction. Even more importantly, it can constant-fold the COPY_* enums together with the shifted negative constants, which also saves some instructions. (We don't need it for LITERAL, since it happens to be 0.)
55209f9 Stop giving -Werror to automake, due to an incompatibility between current versions of libtool and automake on non-GNU platforms (e.g. Mac OS X).
b86e81c Fix public issue 66: Document GetUncompressedLength better, in particular that it leaves the source in a state that's not appropriate for RawUncompress.
2e225ba Fix public issue 64: Check for <sys/time.h> at configure time, since MSVC seemingly does not have it.
e89f20a Handle the case where gettimeofday() goes backwards or returns the same value twice; it could cause division by zero in the unit test framework. (We already had one fix for this in place, but it was incomplete.)
3ec60ac Mark ARMv4 as not supporting unaligned accesses (not just ARMv5 and ARMv6); apparently Debian still targets these by default, giving us segfaults on armel.
be80d6f Fix public bug #62: Remove an extraneous comma at the end of an enum list, causing compile errors when embedded in Mozilla on OpenBSD.
8b95464 Snappy library no longer depends on iostream.
fc723b2 Release Snappy 1.0.5.
dc63e0a For 32-bit platforms, do not try to accelerate multiple neighboring 32-bit loads with a 64-bit load during compression (it's not a win).
f8829ea Enable the use of unaligned loads and stores for ARM-based architectures where they are available (ARMv7 and higher). This gives a significant speed boost on ARM, both for compression and decompression. It should not affect x86 at all.
f2e184f Lower the size allocated in the "corrupted input" unit test from 256 MB to 2 MB. This fixes issues with running the unit test on platforms with little RAM (e.g. some ARM boards).
e750dc0 Minor refactoring to accomodate changes in Google's internal code tree.
d9068ee Fix public issue r57: Fix most warnings with -Wall, mostly signed/unsigned warnings. There are still some in the unit test, but the main .cc file should be clean. We haven't enabled -Wall for the default build, since the unit test is still not clean.
0755c81 Add a framing format description. We do not have any implementation of this at the current point, but there seems to be enough of a general interest in the topic (cf. public bug #34).
d7eb2dc Speed up decompression by moving the refill check to the end of the loop.
5ed51ce Speed up decompression by making the fast path for literals faster.
0c1b9c3 Fix public issue #53: Update the README to the API we actually open-sourced with.
b61134b In the format description, use a clearer example to emphasize that varints are stored in little-endian. Patch from Christian von Roques.
21a2e4f Release Snappy 1.0.4.
e2e3032 Fix public issue #50: Include generic byteswap macros. Also include Solaris 10 and FreeBSD versions.
593002d Partially fix public issue 50: Remove an extra comma from the end of some enum declarations, as it seems the Sun compiler does not like it.
f1063a5 Use the right #ifdef test for sys/mman.h.
41c827a Fix public issue #47: Small comment cleanups in the unit test.
59aeffa Fix public issue #46: Format description said "3-byte offset" instead of "4-byte offset" for the longest copies.
57e7cd7 Fix public issue #44: Make the definition and declaration of CompressFragment identical, even regarding cv-qualifiers.
13c4a44 Correct an inaccuracy in the Snappy format description. (I stumbled into this when changing the way we decompress literals.)
f540673 Speed up decompression by removing a fast-path attempt.
197f3ee Speed up decompression by not needing a lookup table for literal items.
8efa263 Release Snappy 1.0.3.
2e12124 Remove an unneeded goto in the decompressor; it turns out that the state of ip_ after decompression (or attempted decompresion) is completely irrelevant, so we don't need the trailer.
c266bbf Speed up decompression by caching ip_.
d0ee043 Fix the numbering of the headlines in the Snappy format description.
6c70538 Fix public issue #32: Add compressed format documentation for Snappy. This text is new, but an earlier version from Zeev Tarantov was used as reference.
a1f9f99 Fix public issue #39: Pick out the median runs based on CPU time, not real time. Also, use nth_element instead of sort, since we only need one element.
f7b1056 Fix public issue #38: Make the microbenchmark framework handle properly cases where gettimeofday() can stand return the same result twice (as sometimes on GNU/Hurd) or go backwards (as when the user adjusts the clock). We avoid a division-by-zero, and put a lower bound on the number of iterations -- the same amount as we use to calibrate.
d8d4814 Fix public issue #37: Only link snappy_unittest against -lz and other autodetected libraries, not libsnappy.so (which doesn't need any such dependency).
bcecf19 Release Snappy 1.0.2, to get the license change and various other fixes into a release.
84d9f64 Fix public issue #30: Stop using gettimeofday() altogether on Win32, as MSVC doesn't include it. Replace with QueryPerformanceCounter(), which is monotonic and probably reasonably high-resolution. (Some machines have traditionally had bugs in QPC, but they should be relatively rare these days, and there's really no much better alternative that I know of.)
3d8e71d Fix public issue #31: Don't reset PATH in autogen.sh; instead, do the trickery we need for our own build system internally.
7398735 When including <windows.h>, define WIN32_LEAN_AND_MEAN first, so we won't pull in macro definitions of things like min() and max(), which can conflict with <algorithm>.
fb7e0ea Fix public issue #29: Write CPU timing code for Windows, based on GetProcessTimes() instead of getursage().
c67fa0c Include C bindings of Snappy, contributed by Martin Gieseking.
56be85c Replace geo.protodata with a newer version.
3dd93f3 Fix public issue #27: Add HAVE_CONFIG_H tests around the config.h inclusion in snappy-stubs-internal.h, which eases compiling outside the automake/autoconf framework.
f67bcaa Fix public issue #26: Take memory allocation and reallocation entirely out of the Measure() loop. This gives all algorithms a small speed boost, except Snappy which already didn't do reallocation (so the measurements were slightly biased in its favor).
cc333c1 Renamed "namespace zippy" to "namespace snappy" to reduce the differences from the opensource code.  Will make it easier in the future to mix-and-match third-party code that uses snappy with google code.
f19fb07 Put back the final few lines of what was truncated during the license header change.
7e8ca8f Change on 2011-03-25 19:18:00-07:00 by sesse
b4bbc10 Change Snappy from the Apache 2.0 to a BSD-type license.
c47640c Release Snappy 1.0.1, to soup up all the various small changes that have been made since release.
b1dc1f6 Fix a microbenchmark crash on mingw32; seemingly %lld is not universally supported on Windows, and %I64d is recommended instead.
98004ca Fix public issue #19: Fix unit test when Google Test is installed but the gflags package isn't (Google Test is not properly initialized).
444a6c5 Make the unit test work on systems without mmap(). This is required for, among others, Windows support. For Windows in specific, we could have used CreateFileMapping/MapViewOfFile, but this should at least get us a bit closer to compiling, and is of course also relevant for embedded systems with no MMU.
2e182e9 Make the unit test work on systems without mmap(). This is required for, among others, Windows support. For Windows in specific, we could have used CreateFileMapping/MapViewOfFile, but this should at least get us a bit closer to compiling, and is of course also relevant for embedded systems with no MMU.
48662cb Fix public issue #12: Don't keep autogenerated auto* files in Subversion; it causes problems with others sending patches etc..
9e4717a Fix public issue tracker bug #3: Call AC_SUBST([LIBTOOL_DEPS]), or the rule to rebuild libtool in Makefile.am won't work.
519c822 Fix public issue #10: Don't add GTEST_CPPFLAGS to snappy_unittest_CXXFLAGS; it's not needed (CPPFLAGS are always included when compiling).
ea6b936 Fix public issue #9: Add -Wall -Werror to automake flags. (This concerns automake itself, not the C++ compiler.)
e3ca06a Fix a typo in the Snappy README file.
39d27be Fix public issue #6: Add a --with-gflags for disabling gflags autodetection and using a manually given setting (use/don't use) instead.
60add43 Fix public issue #5: Replace the EXTRA_LIBSNAPPY_LDFLAGS setup with something slightly more standard, that also doesn't leak libtool command-line into configure.ac.
a8dd170 Fix public issue #4: Properly quote all macro arguments in configure.ac.
79752dd Fix public issue #7: Don't use internal variables named ac_*, as those belong to autoconf's namespace.
46e39fb Add missing licensing headers to a few files. (Part 2/2.)
3e76421 Add mising licensing headers to a few files. (Part 1/2.)
9a59f18 Use the correct license file for the Apache 2.0 license; spotted by Florian Weimer.
28a6440 Revision created by MOE tool push_codebase. MOE_MIGRATION=
7c3c607 Create trunk directory.
REVERT: 7d3fa5c Snappy bindings

git-subtree-dir: snappy-sys/snappy
git-subtree-split: b02bfa754ebf27921d8da3bd2517eab445b84ff9
  • Loading branch information
andresilva committed Jun 29, 2018
1 parent 7d3fa5c commit 10c2c2a
Show file tree
Hide file tree
Showing 20 changed files with 1,094 additions and 3,309 deletions.
41 changes: 41 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Build matrix / environment variables are explained on:
# https://www.appveyor.com/docs/appveyor-yml/
# This file can be validated on: https://ci.appveyor.com/tools/validate-yaml

version: "{build}"

environment:
matrix:
# AppVeyor currently has no custom job name feature.
# http://help.appveyor.com/discussions/questions/1623-can-i-provide-a-friendly-name-for-jobs
- JOB: Visual Studio 2017
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
CMAKE_GENERATOR: Visual Studio 15 2017
- JOB: Visual Studio 2015
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
CMAKE_GENERATOR: Visual Studio 14 2015

platform:
- x86
- x64

configuration:
- RelWithDebInfo
- Debug

build:
verbosity: minimal

build_script:
- git submodule update --init --recursive
- mkdir out
- cd out
- if "%platform%"=="x64" set CMAKE_GENERATOR=%CMAKE_GENERATOR% Win64
- cmake --version
- cmake .. -G "%CMAKE_GENERATOR%"
-DCMAKE_CONFIGURATION_TYPES="%CONFIGURATION%"
- cmake --build . --config %CONFIGURATION%
- cd ..

test_script:
- out\%CONFIGURATION%\snappy_unittest
59 changes: 59 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Build matrix / environment variables are explained on:
# http://about.travis-ci.org/docs/user/build-configuration/
# This file can be validated on: http://lint.travis-ci.org/

sudo: false
dist: trusty
language: cpp

compiler:
- gcc
- clang
os:
- linux
- osx

env:
- BUILD_TYPE=Debug
- BUILD_TYPE=RelWithDebInfo

matrix:
allow_failures:
- compiler: clang
env: BUILD_TYPE=RelWithDebInfo

addons:
apt:
# List of whitelisted in travis packages for ubuntu-trusty can be found here:
# https://github.com/travis-ci/apt-package-whitelist/blob/master/ubuntu-trusty
# List of whitelisted in travis apt-sources:
# https://github.com/travis-ci/apt-source-whitelist/blob/master/ubuntu.json
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-4.0
packages:
- cmake
- gcc-6
- g++-6
- clang-4.0

install:
# Travis doesn't have a nice way to install homebrew packages yet.
# https://github.com/travis-ci/travis-ci/issues/5377
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install gcc@6; fi
# /usr/bin/gcc is stuck to old versions by on both Linux and OSX.
- if [ "$CXX" = "g++" ]; then export CXX="g++-6" CC="gcc-6"; fi
- echo ${CC}
- echo ${CXX}
- ${CXX} --version
- cmake --version

before_script:
- mkdir -p build && cd build
- cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE
- cmake --build .
- cd ..

script:
- build/snappy_unittest
174 changes: 174 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
cmake_minimum_required(VERSION 3.1)
project(Snappy VERSION 1.1.7 LANGUAGES C CXX)

# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to make
# it prominent in the GUI.
option(BUILD_SHARED_LIBS "Build shared libraries(DLLs)." OFF)

option(SNAPPY_BUILD_TESTS "Build Snappy's own tests." ON)

include(TestBigEndian)
test_big_endian(SNAPPY_IS_BIG_ENDIAN)

include(CheckIncludeFile)
check_include_file("byteswap.h" HAVE_BYTESWAP_H)
check_include_file("stddef.h" HAVE_STDDEF_H)
check_include_file("stdint.h" HAVE_STDINT_H)
check_include_file("sys/endian.h" HAVE_SYS_ENDIAN_H)
check_include_file("sys/mman.h" HAVE_SYS_MMAN_H)
check_include_file("sys/resource.h" HAVE_SYS_RESOURCE_H)
check_include_file("sys/time.h" HAVE_SYS_TIME_H)
check_include_file("sys/uio.h" HAVE_SYS_UIO_H)
check_include_file("unistd.h" HAVE_UNISTD_H)
check_include_file("windows.h" HAVE_WINDOWS_H)

include(CheckLibraryExists)
check_library_exists(z zlibVersion "" HAVE_LIBZ)
check_library_exists(lzo2 lzo1x_1_15_compress "" HAVE_LIBLZO2)

include(CheckCXXSourceCompiles)
check_cxx_source_compiles(
"int main(void) { return __builtin_expect(0, 1); }" HAVE_BUILTIN_EXPECT)

check_cxx_source_compiles(
"int main(void) { return __builtin_ctzll(0); }" HAVE_BUILTIN_CTZ)

include(CheckSymbolExists)
check_symbol_exists("mmap" "sys/mman.h" HAVE_FUNC_MMAP)
check_symbol_exists("sysconf" "unistd.h" HAVE_FUNC_SYSCONF)

find_package(GTest QUIET)
if(GTEST_FOUND)
set(HAVE_GTEST 1)
endif(GTEST_FOUND)

find_package(Gflags QUIET)
if(GFLAGS_FOUND)
set(HAVE_GFLAGS 1)
endif(GFLAGS_FOUND)

configure_file(
"${PROJECT_SOURCE_DIR}/cmake/config.h.in"
"${PROJECT_BINARY_DIR}/config.h"
)

# We don't want to define HAVE_ macros in public headers. Instead, we use
# CMake's variable substitution with 0/1 variables, which will be seen by the
# preprocessor as constants.
set(HAVE_STDINT_H_01 ${HAVE_STDINT_H})
set(HAVE_STDDEF_H_01 ${HAVE_STDDEF_H})
set(HAVE_SYS_UIO_H_01 ${HAVE_SYS_UIO_H})
if(NOT HAVE_STDINT_H_01)
set(HAVE_STDINT_H_01 0)
endif(NOT HAVE_STDINT_H_01)
if(NOT HAVE_STDDEF_H_01)
set(HAVE_STDDEF_H_01 0)
endif(NOT HAVE_STDDEF_H_01)
if(NOT HAVE_SYS_UIO_H_01)
set(HAVE_SYS_UIO_H_01 0)
endif(NOT HAVE_SYS_UIO_H_01)

configure_file(
"${PROJECT_SOURCE_DIR}/snappy-stubs-public.h.in"
"${PROJECT_BINARY_DIR}/snappy-stubs-public.h")

add_library(snappy "")
target_sources(snappy
PRIVATE
"${PROJECT_SOURCE_DIR}/snappy-internal.h"
"${PROJECT_SOURCE_DIR}/snappy-stubs-internal.h"
"${PROJECT_SOURCE_DIR}/snappy-c.cc"
"${PROJECT_SOURCE_DIR}/snappy-sinksource.cc"
"${PROJECT_SOURCE_DIR}/snappy-stubs-internal.cc"
"${PROJECT_SOURCE_DIR}/snappy.cc"
"${PROJECT_BINARY_DIR}/config.h"

# Only CMake 3.3+ supports PUBLIC sources in targets exported by "install".
$<$<VERSION_GREATER:CMAKE_VERSION,3.2>:PUBLIC>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/snappy-c.h>
$<INSTALL_INTERFACE:include/snappy-c.h>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/snappy-sinksource.h>
$<INSTALL_INTERFACE:include/snappy-sinksource.h>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/snappy.h>
$<INSTALL_INTERFACE:include/snappy.h>
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/snappy-stubs-public.h>
$<INSTALL_INTERFACE:include/snappy-stubs-public.h>
)
target_include_directories(snappy
PUBLIC
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>
)
set_target_properties(snappy
PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR})

target_compile_definitions(snappy PRIVATE -DHAVE_CONFIG_H)
if(BUILD_SHARED_LIBS)
set_target_properties(snappy PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif(BUILD_SHARED_LIBS)

if(SNAPPY_BUILD_TESTS)
enable_testing()

add_executable(snappy_unittest "")
target_sources(snappy_unittest
PRIVATE
"${PROJECT_SOURCE_DIR}/snappy_unittest.cc"
"${PROJECT_SOURCE_DIR}/snappy-test.cc"
)
target_compile_definitions(snappy_unittest PRIVATE -DHAVE_CONFIG_H)
target_link_libraries(snappy_unittest snappy ${GFLAGS_LIBRARIES})

if(HAVE_LIBZ)
target_link_libraries(snappy_unittest z)
endif(HAVE_LIBZ)
if(HAVE_LIBLZO2)
target_link_libraries(snappy_unittest lzo2)
endif(HAVE_LIBLZO2)

target_include_directories(snappy_unittest
BEFORE PRIVATE
"${PROJECT_SOURCE_DIR}"
"${GTEST_INCLUDE_DIRS}"
"${GFLAGS_INCLUDE_DIRS}"
)

add_test(
NAME snappy_unittest
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
COMMAND "${PROJECT_BINARY_DIR}/snappy_unittest")
endif(SNAPPY_BUILD_TESTS)

include(GNUInstallDirs)
install(TARGETS snappy
EXPORT SnappyTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
install(
FILES
"${PROJECT_SOURCE_DIR}/snappy-c.h"
"${PROJECT_SOURCE_DIR}/snappy-sinksource.h"
"${PROJECT_SOURCE_DIR}/snappy.h"
"${PROJECT_BINARY_DIR}/snappy-stubs-public.h"
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"${PROJECT_BINARY_DIR}/SnappyConfigVersion.cmake"
COMPATIBILITY SameMajorVersion
)
install(
EXPORT SnappyTargets
NAMESPACE Snappy::
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Snappy"
)
install(
FILES
"${PROJECT_SOURCE_DIR}/cmake/SnappyConfig.cmake"
"${PROJECT_BINARY_DIR}/SnappyConfigVersion.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Snappy"
)
26 changes: 26 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# How to Contribute

We'd love to accept your patches and contributions to this project. There are
just a few small guidelines you need to follow.

## Contributor License Agreement

Contributions to this project must be accompanied by a Contributor License
Agreement. You (or your employer) retain the copyright to your contribution,
this simply gives us permission to use and redistribute your contributions as
part of the project. Head over to <https://cla.developers.google.com/> to see
your current agreements on file or to sign a new one.

You generally only need to submit a CLA once, so if you've already submitted one
(even if it was for a different project), you probably don't need to do it
again.

## Code reviews

All submissions, including submissions by project members, require review. We
use GitHub pull requests for this purpose. Consult
[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
information on using pull requests.

Please make sure that all the automated checks (CLA, AppVeyor, Travis) pass for
your pull requests. Pull requests whose checks fail may be ignored.
Loading

0 comments on commit 10c2c2a

Please sign in to comment.