-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Changes project name and adds namespace. * Adds gz reader and bgzf writer. * Updates readme. * Adds bgzf support. * Fixes test commands. * Adds ogzbuf and updates target names. * Minor changes. * Updates bgz seek test. * Example of actual bgzf. This commit is a temporary untested example of actual bgzf. I find the the encoding of compressed block size into the header a counterproductive solution to a problem that does not exist. So this code will be replaced with a simpler version of blocked gzip that only restricts the uncompressed data size as opposed to both uncompressed and compressed. * Reverting actual bgzf implementation. * Changes naming structure. * Checks in generic istream. * Adds generic istream tests. * Updates readme with new naming structure. * Fixes bgzf virtual offset bugs. * Adds initial zstd support. * Fixes build error. * Fixes zlib flush issue. * Adds zstd seek support. * Fixes move bug in zstd::ibuf. * Adds zstd.cmake. * Addresses gcc bug 54316. * Addresses gcc bug 54316. * Fixes premature end of file. * Removes unnecessary assert. * Adds cmake 3.2 support. * Attempts to fix cmake issues. * Attempts to fix cmake issues. * Attempts to fix cmake issues. * Attempts to fix cmake issues. * Attempts to fix cmake issues. * Adds optional compression level parameter to zstd::obuf. * Prevents zstd shared libs from being built since advanced api is required.
- Loading branch information
Showing
12 changed files
with
2,172 additions
and
609 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,76 @@ | ||
cmake_minimum_required(VERSION 3.2) | ||
include(ExternalProject) | ||
include(CMakePackageConfigHelpers) | ||
project(xzbuf VERSION 1.0.0) | ||
project(shrinkwrap VERSION 1.0.0) | ||
|
||
enable_testing() | ||
|
||
set(CMAKE_CXX_STANDARD 11) | ||
|
||
if (BUILD_SHARED_LIBS) | ||
set(LIBLZMA_LIB_NAME ${CMAKE_SHARED_LIBRARY_PREFIX}lzma${CMAKE_SHARED_LIBRARY_SUFFIX}) | ||
set(ZLIB_LIB_NAME ${CMAKE_SHARED_LIBRARY_PREFIX}z${CMAKE_SHARED_LIBRARY_SUFFIX}) | ||
else() | ||
set(LIBLZMA_LIB_NAME ${CMAKE_STATIC_LIBRARY_PREFIX}lzma${CMAKE_STATIC_LIBRARY_SUFFIX}) | ||
set(ZLIB_LIB_NAME ${CMAKE_STATIC_LIBRARY_PREFIX}z${CMAKE_STATIC_LIBRARY_SUFFIX}) | ||
endif() | ||
|
||
find_library(LIBLZMA_LIBRARIES | ||
NAMES ${LIBLZMA_LIB_NAME}) | ||
|
||
find_library(ZLIB_LIBRARIES | ||
NAMES ${ZLIB_LIB_NAME}) | ||
|
||
#ZSTD can only likn statically since experimental functions are being used. | ||
find_library(ZSTD_LIBRARIES | ||
NAMES ${CMAKE_STATIC_LIBRARY_PREFIX}zstd${CMAKE_STATIC_LIBRARY_SUFFIX}) | ||
|
||
if (NOT LIBLZMA_LIBRARIES) | ||
message(FATAL_ERROR "lzma library not found") | ||
endif() | ||
|
||
add_library(xzbuf INTERFACE) | ||
target_sources(xzbuf INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/xzbuf.hpp>) | ||
target_include_directories(xzbuf INTERFACE | ||
$<INSTALL_INTERFACE:include> | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>) | ||
target_link_libraries(xzbuf INTERFACE ${LIBLZMA_LIBRARIES}) | ||
if (NOT ZLIB_LIBRARIES) | ||
message(FATAL_ERROR "zlib library not found") | ||
endif() | ||
|
||
add_executable(xzbuf-test src/test.cpp) | ||
target_link_libraries(xzbuf-test xzbuf) | ||
if (NOT ZSTD_LIBRARIES) | ||
message(FATAL_ERROR "zstd library not found") | ||
endif() | ||
|
||
add_test(seek_test xzbuf-test seek) | ||
add_test(iterator_test xzbuf-test iterator) | ||
add_library(shrinkwrap INTERFACE) | ||
if (CMAKE_VERSION VERSION_GREATER 3.3) | ||
target_sources(shrinkwrap INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/shrinkwrap/xz.hpp;${CMAKE_CURRENT_SOURCE_DIR}/include/shrinkwrap/gz.hpp;${CMAKE_CURRENT_SOURCE_DIR}/include/shrinkwrap/zstd.hpp;${CMAKE_CURRENT_SOURCE_DIR}/include/shrinkwrap/istream.hpp>) | ||
target_include_directories(shrinkwrap INTERFACE | ||
$<INSTALL_INTERFACE:include> | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>) | ||
target_link_libraries(shrinkwrap INTERFACE ${LIBLZMA_LIBRARIES} ${ZLIB_LIBRARIES} ${ZSTD_LIBRARIES}) | ||
|
||
add_executable(shrinkwrap-test src/test.cpp) | ||
target_link_libraries(shrinkwrap-test shrinkwrap) | ||
else() | ||
add_executable(shrinkwrap-test src/test.cpp) | ||
target_link_libraries(shrinkwrap-test ${LIBLZMA_LIBRARIES} ${ZLIB_LIBRARIES} ${ZSTD_LIBRARIES}) | ||
target_include_directories(shrinkwrap-test PUBLIC include) | ||
endif() | ||
|
||
install(FILES $<TARGET_PROPERTY:xzbuf,INTERFACE_SOURCES> DESTINATION include) | ||
install(TARGETS xzbuf EXPORT xzbuf-config | ||
LIBRARY DESTINATION lib | ||
ARCHIVE DESTINATION lib) | ||
add_test(xz_seek_test shrinkwrap-test xz-seek) | ||
add_test(xz_iterator_test shrinkwrap-test xz-iter) | ||
add_test(gz_iterator_test shrinkwrap-test gz-iter) | ||
add_test(bgz_seek_test shrinkwrap-test bgz-seek) | ||
add_test(bgz_iterator_test shrinkwrap-test bgz-iter) | ||
add_test(zstd_iterator_test shrinkwrap-test zstd-iter) | ||
add_test(zstd_seek_test shrinkwrap-test zstd-seek) | ||
add_test(generic_iterator_test shrinkwrap-test generic-iter) | ||
add_test(generic_seek_test shrinkwrap-test generic-seek) | ||
|
||
install(EXPORT ${PROJECT_NAME}-config DESTINATION share/${PROJECT_NAME}) | ||
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake COMPATIBILITY SameMajorVersion) | ||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake DESTINATION share/${PROJECT_NAME}) | ||
install(DIRECTORY include/shrinkwrap DESTINATION include) | ||
if (CMAKE_VERSION VERSION_GREATER 3.3) | ||
install(TARGETS shrinkwrap EXPORT ${PROJECT_NAME}-config | ||
LIBRARY DESTINATION lib | ||
ARCHIVE DESTINATION lib) | ||
|
||
export(EXPORT ${PROJECT_NAME}-config) | ||
install(EXPORT ${PROJECT_NAME}-config DESTINATION share/${PROJECT_NAME}) | ||
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake COMPATIBILITY SameMajorVersion) | ||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake DESTINATION share/${PROJECT_NAME}) | ||
export(EXPORT ${PROJECT_NAME}-config) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# ################################################################ | ||
# Copyright (c) 2016-present, Yann Collet, Facebook, Inc. | ||
# All rights reserved. | ||
# | ||
# This source code is licensed under the BSD-style license found in the | ||
# LICENSE file in the root directory of this source tree. An additional grant | ||
# of patent rights can be found in the PATENTS file in the same directory. | ||
# ################################################################ | ||
|
||
PROJECT(zstd) | ||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9) | ||
OPTION(ZSTD_BUILD_STATIC "must be static" ON) | ||
SET(ZSTD_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") | ||
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build/cmake/CMakeModules") | ||
|
||
#----------------------------------------------------------------------------- | ||
# Add extra compilation flags | ||
#----------------------------------------------------------------------------- | ||
INCLUDE(AddZstdCompilationFlags) | ||
ADD_ZSTD_COMPILATION_FLAGS() | ||
|
||
#----------------------------------------------------------------------------- | ||
# Options | ||
#----------------------------------------------------------------------------- | ||
OPTION(ZSTD_LEGACY_SUPPORT "LEGACY SUPPORT" OFF) | ||
IF (UNIX) | ||
OPTION(ZSTD_MULTITHREAD_SUPPORT "MULTITHREADING SUPPORT" ON) | ||
ELSE (UNIX) | ||
OPTION(ZSTD_MULTITHREAD_SUPPORT "MULTITHREADING SUPPORT" OFF) | ||
ENDIF (UNIX) | ||
OPTION(ZSTD_BUILD_PROGRAMS "BUILD PROGRAMS" ON) | ||
OPTION(ZSTD_BUILD_CONTRIB "BUILD CONTRIB" OFF) | ||
OPTION(ZSTD_BUILD_TESTS "BUILD TESTS" OFF) | ||
|
||
IF (ZSTD_LEGACY_SUPPORT) | ||
MESSAGE(STATUS "ZSTD_LEGACY_SUPPORT defined!") | ||
ADD_DEFINITIONS(-DZSTD_LEGACY_SUPPORT=4) | ||
ELSE (ZSTD_LEGACY_SUPPORT) | ||
MESSAGE(STATUS "ZSTD_LEGACY_SUPPORT not defined!") | ||
ADD_DEFINITIONS(-DZSTD_LEGACY_SUPPORT=0) | ||
ENDIF (ZSTD_LEGACY_SUPPORT) | ||
|
||
#----------------------------------------------------------------------------- | ||
# Add source directories | ||
#----------------------------------------------------------------------------- | ||
SET(ZSTD_BUILD_SHARED OFF CACHE BOOL "must be static" FORCE) | ||
ADD_SUBDIRECTORY(build/cmake/lib) | ||
|
||
IF (ZSTD_BUILD_PROGRAMS) | ||
ADD_SUBDIRECTORY(build/cmake/programs) | ||
ENDIF (ZSTD_BUILD_PROGRAMS) | ||
|
||
IF (ZSTD_BUILD_TESTS) | ||
IF (NOT ZSTD_BUILD_STATIC) | ||
MESSAGE(SEND_ERROR "You need to build static library to build tests") | ||
ENDIF (NOT ZSTD_BUILD_STATIC) | ||
|
||
ADD_SUBDIRECTORY(build/cmake/tests) | ||
ENDIF (ZSTD_BUILD_TESTS) | ||
|
||
IF (ZSTD_BUILD_CONTRIB) | ||
ADD_SUBDIRECTORY(build/cmake/contrib) | ||
ENDIF (ZSTD_BUILD_CONTRIB) | ||
|
||
#----------------------------------------------------------------------------- | ||
# Add clean-all target | ||
#----------------------------------------------------------------------------- | ||
ADD_CUSTOM_TARGET(clean-all | ||
COMMAND ${CMAKE_BUILD_TOOL} clean | ||
COMMAND rm -rf ${CMAKE_BINARY_DIR}/ | ||
) |
Oops, something went wrong.