Skip to content

Commit

Permalink
Switch from conanfile.txt to conanfile.py (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
robomics committed May 16, 2024
1 parent 3e7402f commit 4075162
Show file tree
Hide file tree
Showing 12 changed files with 100 additions and 62 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-dockerfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
- "test/**"
- "CMakeLists.txt"
- "Dockerfile"
- "conanfile.txt"
- "conanfile.py"
tags:
- 'v*.*.*'

Expand All @@ -27,7 +27,7 @@ on:
- "test/**"
- "CMakeLists.txt"
- "Dockerfile"
- "conanfile.txt"
- "conanfile.py"

# https://stackoverflow.com/a/72408109
concurrency:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
- "src/**"
- "test/**"
- "CMakeLists.txt"
- "conanfile.txt"
- "conanfile.py"
tags:
- 'v*.*.*'

Expand All @@ -27,7 +27,7 @@ on:
- "src/**"
- "test/**"
- "CMakeLists.txt"
- "conanfile.txt"
- "conanfile.py"

# https://stackoverflow.com/a/72408109
concurrency:
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
- name: Generate cache key
id: cache-key
run: |
hash="${{ hashFiles('conanfile.txt', '.github/workflows/codecov.yml') }}"
hash="${{ hashFiles('conanfile.py', '.github/workflows/codecov.yml') }}"
# This can be used by to always update a cache entry (useful e.g. for ccache)
current_date="$(date '+%s')"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/fuzzy-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
- "test/scripts/link_h5_dataset.py"
- "test/scripts/patch_hictkpy.py"
- "CMakeLists.txt"
- "conanfile.txt"
- "conanfile.py"
tags:
- 'v*.*.*'

Expand Down Expand Up @@ -145,7 +145,7 @@ jobs:
id: cache-key
working-directory: hictkpy
run: |
hash="${{ hashFiles('conanfile.txt') }}"
hash="${{ hashFiles('conanfile.py') }}"
echo "key=fuzzy-testing-$hash" >> $GITHUB_OUTPUT
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/macos-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
- "src/**"
- "test/**"
- "CMakeLists.txt"
- "conanfile.txt"
- "conanfile.py"
tags:
- 'v*.*.*'

Expand All @@ -25,7 +25,7 @@ on:
- "src/**"
- "test/**"
- "CMakeLists.txt"
- "conanfile.txt"
- "conanfile.py"

# https://stackoverflow.com/a/72408109
concurrency:
Expand Down Expand Up @@ -114,9 +114,9 @@ jobs:
compiler_version="${{ matrix.compiler_version }}"
build_type="${{ matrix.build_type }}"
conanfile_hash="${{ hashFiles('conanfile.txt') }}"
conanfile_hash="${{ hashFiles('conanfile.py') }}"
workflow_hash="${{ hashFiles('.github/workflows/macos-ci.yml') }}"
combined_hash="${{ hashFiles('conanfile.txt', '.github/workflows/macos-ci.yml') }}"
combined_hash="${{ hashFiles('conanfile.py', '.github/workflows/macos-ci.yml') }}"
# This can be used by to always update a cache entry (useful e.g. for ccache)
current_date="$(date '+%s')"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/run-clang-tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
- "test/**"
- ".clang-tidy"
- "CMakeLists.txt"
- "conanfile.txt"
- "conanfile.py"
tags:
- 'v*.*.*'

Expand All @@ -27,7 +27,7 @@ on:
- "test/**"
- ".clang-tidy"
- "CMakeLists.txt"
- "conanfile.txt"
- "conanfile.py"

# https://stackoverflow.com/a/72408109
concurrency:
Expand Down Expand Up @@ -64,7 +64,7 @@ jobs:
- name: Generate cache key
id: cache-key
run: |
hash="${{ hashFiles('conanfile.txt', '.github/workflows/run-clang-tidy.yml') }}"
hash="${{ hashFiles('conanfile.py', '.github/workflows/run-clang-tidy.yml') }}"
# This can be used by to always update a cache entry (useful e.g. for ccache)
current_date="$(date '+%s')"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ubuntu-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
- "src/**"
- "test/**"
- "CMakeLists.txt"
- "conanfile.txt"
- "conanfile.py"
tags:
- 'v*.*.*'

Expand All @@ -25,7 +25,7 @@ on:
- "src/**"
- "test/**"
- "CMakeLists.txt"
- "conanfile.txt"
- "conanfile.py"

# https://stackoverflow.com/a/72408109
concurrency:
Expand Down Expand Up @@ -187,9 +187,9 @@ jobs:
build_type="${{ matrix.build_type }}"
dev_mode="${{ matrix.developer_mode }}"
conanfile_hash="${{ hashFiles('conanfile.txt') }}"
conanfile_hash="${{ hashFiles('conanfile.py') }}"
workflow_hash="${{ hashFiles('.github/workflows/ubuntu-ci.yml') }}"
combined_hash="${{ hashFiles('conanfile.txt', '.github/workflows/ubuntu-ci.yml') }}"
combined_hash="${{ hashFiles('conanfile.py', '.github/workflows/ubuntu-ci.yml') }}"
# This can be used by to always update a cache entry (useful e.g. for ccache)
current_date="$(date '+%s')"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/windows-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
- "src/**"
- "test/**"
- "CMakeLists.txt"
- "conanfile.txt"
- "conanfile.py"
tags:
- 'v*.*.*'

Expand All @@ -25,7 +25,7 @@ on:
- "src/**"
- "test/**"
- "CMakeLists.txt"
- "conanfile.txt"
- "conanfile.py"

# https://stackoverflow.com/a/72408109
concurrency:
Expand Down Expand Up @@ -92,9 +92,9 @@ jobs:
compiler="${{ matrix.compiler-name }}"
build_type="${{ matrix.build_type }}"
conanfile_hash="${{ hashFiles('conanfile.txt') }}"
conanfile_hash="${{ hashFiles('conanfile.py') }}"
workflow_hash="${{ hashFiles('.github/workflows/windows-ci.yml') }}"
combined_hash="${{ hashFiles('conanfile.txt', '.github/workflows/windows-ci.yml') }}"
combined_hash="${{ hashFiles('conanfile.py', '.github/workflows/windows-ci.yml') }}"
# This can be used by to always update a cache entry (useful e.g. for ccache)
current_date="$(date '+%s')"
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ RUN conan install /tmp/conanfile.txt \
# Build hictk deps using Conan
RUN mkdir -p "$src_dir"

COPY conanfile.txt "$src_dir"
RUN conan install "$src_dir/conanfile.txt" \
COPY conanfile.py "$src_dir"
RUN conan install "$src_dir/conanfile.py" \
--build=missing \
-pr:b="$CONAN_DEFAULT_PROFILE_PATH" \
-pr:h="$CONAN_DEFAULT_PROFILE_PATH" \
Expand Down
74 changes: 74 additions & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Copyright (C) 2023 Roberto Rossini <roberros@uio.no>
#
# SPDX-License-Identifier: MIT

from conan import ConanFile
from conan.tools.build import check_min_cppstd


required_conan_version = ">=1.53.0"


class NCHGConan(ConanFile):
name = "hictk"
description = "Blazing fast toolkit to work with .hic and .cool files."
license = "MIT"
topics = ("hictk", "bioinformatics")
homepage = "https://github.com/paulsengroup/hictk"
url = "https://github.com/paulsengroup/hictk"
package_type = "header-library"
settings = "os", "arch", "compiler", "build_type"

options = {
"shared": [True, False],
"fPIC": [True, False],
}

default_options = {
"shared": False,
"fPIC": True,
}

generators = "CMakeDeps"

@property
def _min_cppstd(self):
return 17

def requirements(self):
self.requires("bshoshany-thread-pool/4.1.0#be1802a8768416a6c9b1393cf0ce5e9c")
self.requires("catch2/3.5.4#d346ca291f8f62040fd9c1a891654711")
self.requires("cli11/2.4.1#afacffd31f631bbb8b7c7d6425fe7a66")
self.requires("concurrentqueue/1.0.4#1e48e1c712bcfd892087c9c622a51502")
self.requires("eigen/3.4.0#2e192482a8acff96fe34766adca2b24c")
self.requires("fast_float/6.1.1#e29acaa3d0543dee343abe3f6815346e")
self.requires("fmt/10.2.1#9199a7a0611866dea5c8849a77467b25")
self.requires("hdf5/1.14.3#31ccd8d4de83844f5db48471df1944a1")
self.requires("highfive/2.9.0#c57477beed8b0110fadeb6da8f48bcc5")
self.requires("libdeflate/1.19#3ea74a4549efc14d4b1202dc4bfbf602")
self.requires("parallel-hashmap/1.3.11#1e67f4855a3f7cdeb977cc472113baf7")
self.requires("readerwriterqueue/1.0.6#aaa5ff6fac60c2aee591e9e51b063b83")
self.requires("span-lite/0.11.0#519fd49fff711674cfed8cd17d4ed422")
self.requires("spdlog/1.13.0#8e88198fd5b9ee31d329431a6d0ccaa2")
self.requires("zstd/1.5.6#67383dae85d33f43823e7751a6745ea1")

def validate(self):
if self.settings.get_safe("compiler.cppstd"):
check_min_cppstd(self, self._min_cppstd)

def configure(self):
if self.settings.compiler in ["clang", "gcc"]:
self.settings.compiler.libcxx = "libstdc++11"

self.options["fmt"].header_only = True
self.options["hdf5"].enable_cxx = False
self.options["hdf5"].hl = False
self.options["hdf5"].threadsafe = False
self.options["hdf5"].parallel = False
self.options["hictk"].with_eigen = False
self.options["highfive"].with_boost = False
self.options["highfive"].with_eigen = False
self.options["highfive"].with_opencv = False
self.options["highfive"].with_xtensor = False
self.options["spdlog"].header_only = True
self.options["zstd"].build_programs = False
36 changes: 0 additions & 36 deletions conanfile.txt

This file was deleted.

2 changes: 1 addition & 1 deletion setup_conan_environments.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ trap "cd '$PWD'" EXIT
git_root="$(readlink -f "$(git rev-parse --show-toplevel)")"

wd="$git_root/conan-envs"
conanfile="$git_root/conanfile.txt"
conanfile="$git_root/conanfile.py"

for compiler in gcc clang; do
for build_type in Debug Release RelWithDebInfo; do
Expand Down
2 changes: 1 addition & 1 deletion test/packaging/test_find_package/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Test to ensure hictk can be included in a project through `find_package()`.

```bash
# Build and install hictk
conan install conanfile.txt --output-folder build/
conan install conanfile.py --output-folder build/
cmake -DCMAKE_BUILD_TYPE=Release -S ../../../ -B hictk_build -DHICTK_ENABLE_TESTING=OFF -DHICTK_BUILD_TOOLS=OFF -DCMAKE_PREFIX_PATH="$PWD/build" -DCMAKE_INSTALL_PREFIX=hictk_install
cmake --build hictk_build/
cmake --install hictk_build/
Expand Down

0 comments on commit 4075162

Please sign in to comment.