Skip to content

Commit

Permalink
CPM add zstd
Browse files Browse the repository at this point in the history
  • Loading branch information
horta committed May 31, 2022
1 parent 5992457 commit beb0279
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 91 deletions.
24 changes: 21 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,32 @@ endif()
set(CMAKE_C_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN YES)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
include(cmake/CPM.cmake)

cpmaddpackage(NAME elapsed GIT_TAG 3.0.5 GITHUB_REPOSITORY horta/elapsed)
cpmaddpackage(NAME athr GIT_TAG 4.0.1 GITHUB_REPOSITORY horta/almosthere)
cpmaddpackage(
NAME
zstd
GITHUB_REPOSITORY
facebook/zstd
VERSION
1.5.2
SOURCE_SUBDIR
build/cmake
OPTIONS
"ZSTD_LEGACY_SUPPORT OFF")

if(zstd_ADDED)
if(NOT TARGET ZSTD::zstd)
add_library(ZSTD::zstd ALIAS libzstd_static)
set_target_properties(
libzstd_static PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
"$<BUILD_INTERFACE:${zstd_SOURCE_DIR}/lib>")
endif()
endif()

find_package(ZLIB REQUIRED)
find_package(ZSTD REQUIRED)

add_library(
bgen
Expand All @@ -44,7 +62,7 @@ add_library(
src/partition.c
src/bstring.c
src/zip/zlib.c
src/zip/zstd.c)
src/unzstd.c)
add_library(BGEN::bgen ALIAS bgen)

if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
Expand Down
83 changes: 0 additions & 83 deletions cmake/FindZSTD.cmake

This file was deleted.

2 changes: 1 addition & 1 deletion src/layout2.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "genotype.h"
#include "mem.h"
#include "zip/zlib.h"
#include "zip/zstd.h"
#include "unzstd.h"
#include <inttypes.h>
#include <math.h>

Expand Down
4 changes: 2 additions & 2 deletions src/zip/zstd.c → src/unzstd.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "zip/zstd.h"
#include "unzstd.h"
#include "report.h"
#include <zstd.h>
#include "zstd.h"

int bgen_unzstd(char const* src, size_t src_size, void** dst, size_t* dst_size)
{
Expand Down
4 changes: 2 additions & 2 deletions src/zip/zstd.h → src/unzstd.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef BGEN_ZIP_ZSTD_H
#define BGEN_ZIP_ZSTD_H
#ifndef BGEN_UNZSTD_H
#define BGEN_UNZSTD_H

#include <stddef.h>

Expand Down

0 comments on commit beb0279

Please sign in to comment.