Skip to content

Commit

Permalink
Ship kseqpp headers with the project.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmaklin committed Jun 6, 2024
1 parent 2ee82f9 commit 6e82dee
Show file tree
Hide file tree
Showing 18 changed files with 2,511 additions and 20 deletions.
25 changes: 5 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,14 @@ else()
endif()

## Check dependencies and download them if not found
## BitMagic - supplied with the project
### BitMagic - supplied with the project
set(CMAKE_BITMAGIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/external/BitMagic-7.12.3/src)
include_directories(${CMAKE_BITMAGIC_HEADERS})

### kseq++
set(CMAKE_KSEQPP_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/external/kseqpp-1.1.2/include)
include_directories(${CMAKE_KSEQPP_HEADERS})

## bxzstr
if (DEFINED CMAKE_BXZSTR_HEADERS)
message(STATUS "bxzstr headers provided in: ${CMAKE_BXZSTR_HEADERS}")
Expand Down Expand Up @@ -169,25 +173,6 @@ else()
endif()
include_directories("${CMAKE_CXXARGS_HEADERS}")

## kseqpp
if (DEFINED CMAKE_KSEQPP_HEADERS)
message(STATUS "kseq++ headers provided in: ${CMAKE_KSEQPP_HEADERS}")
else()
FetchContent_Declare(kseqpp
GIT_REPOSITORY https://github.com/cartoonist/kseqpp
GIT_TAG v1.1.2
PREFIX "external"
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/external/kseqpp"
BUILD_IN_SOURCE 0
BUILD_COMMAND ""
CONFIGURE_COMMAND ""
INSTALL_COMMAND ""
)
FetchContent_MakeAvailable(kseqpp)
set(CMAKE_KSEQPP_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/external/kseqpp/include)
endif()
include_directories("${CMAKE_KSEQPP_HEADERS}")

# Link libraries
if (OPENMP_FOUND)
target_link_libraries(libalignmentwriter OpenMP::OpenMP_CXX)
Expand Down
86 changes: 86 additions & 0 deletions external/kseqpp-1.1.2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
cmake_minimum_required(VERSION 3.10)
project(kseq++ VERSION 1.1.2 LANGUAGES CXX)

#options
option(BUILD_TESTING "Build test programs" OFF) # ignored by default
option(BUILD_BENCHMARKING "Build benchmark program" OFF) # ignored by default

# Include external modules
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)

# Finding dependencies.
find_package(ZLIB REQUIRED)
find_package(BZip2 REQUIRED)
find_package(Threads REQUIRED)

# Creating an INTERFACE library
add_library(kseq++ INTERFACE)
# Defining include directories
target_include_directories(kseq++
INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>;$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR}>
INTERFACE $<TARGET_PROPERTY:ZLIB::ZLIB,INTERFACE_INCLUDE_DIRECTORIES>
INTERFACE $<TARGET_PROPERTY:BZip2::BZip2,INTERFACE_INCLUDE_DIRECTORIES>
INTERFACE $<TARGET_PROPERTY:Threads::Threads,INTERFACE_INCLUDE_DIRECTORIES>)
# Defining link libraries
target_link_libraries(kseq++
INTERFACE $<BUILD_INTERFACE:ZLIB::ZLIB>;$<INSTALL_INTERFACE:ZLIB::ZLIB>
INTERFACE $<BUILD_INTERFACE:BZip2::BZip2>;$<INSTALL_INTERFACE:BZip2::BZip2>
INTERFACE $<BUILD_INTERFACE:Threads::Threads>;$<INSTALL_INTERFACE:Threads::Threads>)
# Use C++17
target_compile_features(kseq++ INTERFACE cxx_std_11)
# Generating the configure header file
configure_file(include/kseq++/config.hpp.in ${PROJECT_SOURCE_DIR}/include/kseq++/config.hpp @ONLY)
# Generating pkgconfig file
configure_file(kseq++.pc.in ${PROJECT_SOURCE_DIR}/kseq++.pc @ONLY)
# Setting header files
file(GLOB HEADER_FILES RELATIVE "${PROJECT_SOURCE_DIR}/include" "${PROJECT_SOURCE_DIR}/include/kseq++/*.h")
list(TRANSFORM HEADER_FILES PREPEND "${PROJECT_SOURCE_DIR}/include/" OUTPUT_VARIABLE BUILD_HEADER_FILES)
list(TRANSFORM HEADER_FILES PREPEND "${CMAKE_INSTALL_FULL_INCLUDEDIR}/" OUTPUT_VARIABLE INSTALL_HEADER_FILES)
# Defining target sources
target_sources(kseq++
INTERFACE "$<BUILD_INTERFACE:${BUILD_HEADER_FILES}>;$<INSTALL_INTERFACE:${INSTALL_HEADER_FILES}>")
# Defining `kseq++::kseq++` alias
add_library(kseq++::kseq++ ALIAS kseq++)
# Install targets
install(DIRECTORY include/kseq++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} PATTERN "*.hpp.in" EXCLUDE)
install(FILES kseq++.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
# Exporting targets
install(TARGETS kseq++ EXPORT kseq++-targets)
install(EXPORT kseq++-targets NAMESPACE kseq++:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/kseq++)
# Creating the package configuration file
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/kseq++-config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/kseq++-config.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/kseq++)
# Generating the version file for the configuration file
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/kseq++-config-version.cmake"
VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}"
COMPATIBILITY AnyNewerVersion)
# Install generated configuration files
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/kseq++-config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/kseq++-config-version.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/kseq++)

# Adding test submodule
if(BUILD_TESTING)
add_subdirectory(test)
endif(BUILD_TESTING)

# Adding benchmark submodule
if(BUILD_BENCHMARKING)
add_subdirectory(benchmark)
endif(BUILD_BENCHMARKING)

# Packaging configuration
set(CPACK_PACKAGE_NAME "kseqpp")
set(CPACK_PACKAGE_VENDOR "cartoonist")
set(CPACK_GENERATOR "STGZ;TGZ;RPM")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Fast FASTA/Q parser and writer (C++ re-implementation of kseq library)")
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
set(CPACK_SYSTEM_NAME "noarch")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
include(CPack)
23 changes: 23 additions & 0 deletions external/kseqpp-1.1.2/KSEQ_LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
The MIT License

Copyright (c) 2008, 2009, 2011 Attractive Chaos <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
21 changes: 21 additions & 0 deletions external/kseqpp-1.1.2/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 Ali Ghaffaari

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit 6e82dee

Please sign in to comment.