Skip to content

Commit

Permalink
Merge branch 'main' into impl-stats
Browse files Browse the repository at this point in the history
  • Loading branch information
robomics committed Jul 27, 2023
2 parents 244db62 + 8a909b7 commit a25afb5
Show file tree
Hide file tree
Showing 177 changed files with 912 additions and 1,134 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ Testing/
venv/

# Ignored files
*.bak
gmon.out
perf.*
compile_commands.json
CMakeUserPresets.json
src/common/include/hictk/git.hpp
src/common/include/hictk/version.hpp
src/libhictk/common/include/hictk/git.hpp
src/libhictk/common/include/hictk/version.hpp
23 changes: 12 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ include(cmake/Versioning.cmake)
project(
hictk
LANGUAGES C CXX
VERSION ${HICTK_PROJECT_VERSION_MAJOR}.${HICTK_PROJECT_VERSION_MINOR}.${HICTK_PROJECT_VERSION_PATCH}
VERSION "${HICTK_PROJECT_VERSION_MAJOR}.${HICTK_PROJECT_VERSION_MINOR}.${HICTK_PROJECT_VERSION_PATCH}"
HOMEPAGE_URL https://github.com/robomics/hictk
DESCRIPTION "High-performance C++ library to read and write .cool files.")

include(FetchContent)
FetchContent_Declare(
_hictk_project_options
URL ${CMAKE_CURRENT_SOURCE_DIR}/external/project_options-v0.29.0.tar.xz
URL "${CMAKE_CURRENT_SOURCE_DIR}/external/project_options-v0.29.0.tar.xz"
URL_HASH SHA256=ee2836af616d42e22c61048f4aedafd104fbfd97cf52bdd122a212d98777304c
SYSTEM)
FetchContent_MakeAvailable(_hictk_project_options)
Expand All @@ -55,8 +55,8 @@ if(BUILDING_MULTI_CONFIG)
endif()
endif()

include(${_hictk_project_options_SOURCE_DIR}/src/DynamicProjectOptions.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/CompilerWarnings.cmake)
include("${_hictk_project_options_SOURCE_DIR}/src/DynamicProjectOptions.cmake")
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/CompilerWarnings.cmake")

# dynamic_project_options sets recommended defaults and provides user and developer modes and full GUI support for
# choosing options at configure time
Expand Down Expand Up @@ -101,15 +101,15 @@ dynamic_project_options(
--suppress=passedByValue
--inconclusive
MSVC_WARNINGS
${MSVC_WARNINGS}
"${MSVC_WARNINGS}"
CLANG_WARNINGS
${CLANG_WARNINGS}
"${CLANG_WARNINGS}"
GCC_WARNINGS
${GCC_WARNINGS}
"${GCC_WARNINGS}"
CUDA_WARNINGS
${CUDA_WARNINGS})
"${CUDA_WARNINGS}")

target_compile_features(hictk_project_options INTERFACE cxx_std_${CMAKE_CXX_STANDARD})
target_compile_features(hictk_project_options INTERFACE "cxx_std_${CMAKE_CXX_STANDARD}")

if(WIN32)
target_compile_definitions(hictk_project_options INTERFACE NOMINMAX _CRT_SECURE_NO_WARNINGS)
Expand All @@ -131,8 +131,6 @@ if(HICTK_WITH_EIGEN)
target_compile_definitions(hictk_project_options INTERFACE HICTK_WITH_EIGEN)
endif()

include(cmake/FetchExternalDeps.cmake)

add_subdirectory(src)

if(HICTK_ENABLE_TESTING)
Expand All @@ -156,3 +154,6 @@ if(HICTK_BUILD_PYTHON_BINDINGS)
message(STATUS "Building Python bindings.")
add_subdirectory(bindings/python)
endif()


include(cmake/Install.cmake)
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ RUN cmake -DCMAKE_BUILD_TYPE=Release \
-B "$build_dir"

# Build and install project
RUN cmake --build "$build_dir" -t hictk_tools -j "$(nproc)" \
&& cmake --install "$build_dir"
RUN cmake --build "$build_dir" -t hictk -j "$(nproc)" \
&& cmake --install "$build_dir" \
&& rm -rf "$build_dir/include" "$build_dir/lib"

ARG FINAL_BASE_IMAGE
ARG FINAL_BASE_IMAGE_DIGEST
Expand Down
1 change: 1 addition & 0 deletions benchmark/fetch_and_sum/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# SPDX-License-Identifier: MIT

find_package(CLI11 CONFIG REQUIRED)
find_package(Filesystem REQUIRED)

add_executable(hictk_fetch_and_sum_bench fetch_and_sum.cpp)
Expand Down
1 change: 1 addition & 0 deletions benchmark/hic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# SPDX-License-Identifier: MIT

find_package(CLI11 CONFIG REQUIRED)
find_package(Filesystem REQUIRED)

add_executable(hictk_hic_dump_bench dump.cpp)
Expand Down
121 changes: 0 additions & 121 deletions cmake/FetchExternalDeps.cmake

This file was deleted.

6 changes: 3 additions & 3 deletions cmake/FetchTestDataset.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
file(
DOWNLOAD https://zenodo.org/record/8143316/files/hictk_test_data.tar.xz?download=1
EXPECTED_HASH SHA256=c36249596d429a3d0b1b4a32802ac505ab2eba550b19ca093706922155f2d333
${PROJECT_SOURCE_DIR}/test/data/hictk_test_data.tar.xz)
"${PROJECT_SOURCE_DIR}/test/data/hictk_test_data.tar.xz")
# cmake-format: on

file(
ARCHIVE_EXTRACT
INPUT
${PROJECT_SOURCE_DIR}/test/data/hictk_test_data.tar.xz
"${PROJECT_SOURCE_DIR}/test/data/hictk_test_data.tar.xz"
DESTINATION
${PROJECT_SOURCE_DIR})
"${PROJECT_SOURCE_DIR}")
51 changes: 51 additions & 0 deletions cmake/Install.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Copyright (C) 2023 Roberto Rossini <[email protected]>
#
# SPDX-License-Identifier: MIT

set(targets
balancing;bin_table;chromosome;common;cooler;formatting;genomic_interval;hic;numeric;pixel;reference;transformers;variant
)

include(GNUInstallDirs)
foreach(tgt ${targets})
install(DIRECTORY "${PROJECT_SOURCE_DIR}/src/libhictk/${tgt}/include/hictk" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
endforeach()

install(
TARGETS libhictk
balancing
bin_table
chromosome
common
cooler
formatting
genomic_interval
hic
numeric
pixel
reference
transformers
variant
EXPORT libhictk-targets
FILE_SET HEADERS
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
PRIVATE_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
INCLUDES
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")

install(
EXPORT libhictk-targets
FILE hictkTargets.cmake
NAMESPACE hictk::
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/hictk/")

include(CMakePackageConfigHelpers)
configure_package_config_file(
"${PROJECT_SOURCE_DIR}/cmake/hictkConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/hictkConfig.cmake"
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/hictk/")

install(FILES "${CMAKE_CURRENT_BINARY_DIR}/hictkConfig.cmake" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/hictk")
13 changes: 7 additions & 6 deletions cmake/Versioning.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ function(ConfigureVersioning input_config_folder output_config_folder)
include(FetchContent)
FetchContent_Declare(
_hictk_cmake-git-version-tracking
URL ${CMAKE_CURRENT_SOURCE_DIR}/external/cmake-git-version-tracking.20221027.tar.xz
URL "${CMAKE_CURRENT_SOURCE_DIR}/external/cmake-git-version-tracking.20221027.tar.xz"
URL_HASH SHA256=f2d407c9b45bf8874e5f2126147fbb4e7d2872d586f43d6a2c45d09f60f04365)
FetchContent_MakeAvailable(_hictk_cmake-git-version-tracking)

set(GIT_IGNORE_UNTRACKED ON)
include(${_hictk_cmake-git-version-tracking_SOURCE_DIR}/git_watcher.cmake)
include("${_hictk_cmake-git-version-tracking_SOURCE_DIR}/git_watcher.cmake")
else()
# Add dummy target
add_custom_target(_hictk_check_git)
Expand Down Expand Up @@ -69,14 +69,15 @@ function(ConfigureVersioning input_config_folder output_config_folder)
set(GIT_TAG "unknown")
endif()

configure_file(${PRE_CONFIGURE_FILE} ${POST_CONFIGURE_FILE} @ONLY)
configure_file("${PRE_CONFIGURE_FILE}" "${POST_CONFIGURE_FILE}" @ONLY)
endif()

set(PRE_CONFIGURE_FILE "${input_config_folder}/version.hpp.in")
set(POST_CONFIGURE_FILE "${output_config_folder}/version.hpp")

file(TOUCH ${POST_CONFIGURE_FILE})
configure_file(${PRE_CONFIGURE_FILE} ${POST_CONFIGURE_FILE} @ONLY)
file(TOUCH "${POST_CONFIGURE_FILE}")
configure_file("${PRE_CONFIGURE_FILE}" "${POST_CONFIGURE_FILE}" @ONLY)
endfunction()

configureversioning("${CMAKE_CURRENT_SOURCE_DIR}/src/config" "${CMAKE_CURRENT_SOURCE_DIR}/src/common/include/hictk")
configureversioning("${CMAKE_CURRENT_SOURCE_DIR}/src/libhictk/config"
"${CMAKE_CURRENT_SOURCE_DIR}/src/libhictk/common/include/hictk")
58 changes: 58 additions & 0 deletions cmake/hictkConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Copyright (C) 2023 Roberto Rossini <[email protected]>
#
# SPDX-License-Identifier: MIT

@PACKAGE_INIT@

set(HICTK_WITH_EIGEN @HICTK_WITH_EIGEN@)

include(CMakeFindDependencyMacro)
if(HICTK_WITH_EIGEN)
find_dependency(
Eigen3
CONFIG
QUIET
REQUIRED)
endif()

find_dependency(
FastFloat
CONFIG
QUIET
REQUIRED)
find_dependency(
FMT
CONFIG
QUIET
REQUIRED)
find_dependency(
HDF5
CONFIG
QUIET
REQUIRED
COMPONENTS
C)
find_dependency(
HighFive
CONFIG
QUIET
REQUIRED)
find_dependency(
libdeflate
CONFIG
QUIET
REQUIRED)
find_dependency(
phmap
CONFIG
QUIET
REQUIRED)
find_dependency(
spdlog
CONFIG
QUIET
REQUIRED)

include("${CMAKE_CURRENT_LIST_DIR}/hictkTargets.cmake")

check_required_components(hictk)
Loading

0 comments on commit a25afb5

Please sign in to comment.