-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconanfile.py
More file actions
130 lines (112 loc) · 5.57 KB
/
conanfile.py
File metadata and controls
130 lines (112 loc) · 5.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# conanfile.py
# =============================================================================
# fq-compressor - Conan 2.x Package Configuration
# =============================================================================
# Dependency management for fq-compressor project.
#
# Usage:
# conan install . --build=missing --output-folder=build
# cmake --preset conan-release # or use CMakePresets.json
#
# Dependencies are organized by purpose:
# - CLI parsing: CLI11
# - Logging: Quill (with fmt)
# - Compression: zlib-ng, bzip2, xz_utils, zstd, libdeflate
# - Checksums: xxHash
# - Parallel processing: oneTBB
# - Testing: GTest with RapidCheck
# =============================================================================
from conan import ConanFile
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
class FQCompressorConan(ConanFile):
name = "fqcompressor"
version = "0.1.0"
license = "MIT" # Project-authored code; vendored third-party code keeps its own license
author = "LessUp <jiashuai.mail@gmail.com>"
url = "https://github.com/LessUp/fq-compressor"
description = "High-performance FASTQ compressor with random access support"
topics = ("bioinformatics", "fastq", "compression", "genomics", "archival")
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False], "fPIC": [True, False]}
default_options = {"shared": False, "fPIC": True}
exports_sources = "CMakeLists.txt", "src/*", "include/*", "cmake/*", "tests/*"
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
def configure(self):
# onetbb requires hwloc to always be built as shared library.
self.options["hwloc/*"].shared = True
def layout(self):
cmake_layout(self)
def requirements(self):
# =========================================================================
# CLI Parsing (Requirement 6.1)
# =========================================================================
# CLI11: Modern, header-only command line parser
self.requires("cli11/2.4.2")
# =========================================================================
# Logging (Requirement 4.2)
# =========================================================================
# Quill: Low-latency asynchronous logging library
self.requires("quill/11.0.2")
# fmt: Modern formatting library (required by Quill)
self.requires("fmt/12.1.0")
# =========================================================================
# Compression Libraries (Requirement 1.1.1)
# =========================================================================
# zlib-ng: High-performance zlib replacement for gzip support
self.requires("zlib-ng/2.3.2")
# bzip2: bzip2 compression support
self.requires("bzip2/1.0.8")
# xz_utils (liblzma): xz/LZMA compression support
self.requires("xz_utils/5.4.5")
# zstd: Fast compression algorithm (for Medium/Long reads)
self.requires("zstd/1.5.7")
# libdeflate: Fast gzip/deflate compression
self.requires("libdeflate/1.25")
# =========================================================================
# Checksums (Requirement 5.1, 5.2)
# =========================================================================
# xxHash: Extremely fast non-cryptographic hash algorithm
self.requires("xxhash/0.8.3")
# =========================================================================
# Parallel Processing (Requirement 4.1)
# =========================================================================
# oneTBB: Intel Threading Building Blocks for parallel pipelines
self.requires("onetbb/2022.3.0")
def build_requirements(self):
# =========================================================================
# Testing Frameworks
# =========================================================================
# GTest: Google Test framework for unit testing
self.test_requires("gtest/1.12.1")
# RapidCheck: Property-based testing framework
# NOTE: Temporarily disabled due to C++23 incompatibility (uses deprecated std::aligned_storage)
# self.test_requires("rapidcheck/cci.20230815")
def generate(self):
"""Generate CMake toolchain and dependency files."""
from conan.tools.cmake import CMakeDeps
# Generate CMake toolchain file (conan_toolchain.cmake)
tc = CMakeToolchain(self)
# Enable position-independent code for shared library compatibility
tc.variables["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True)
# Fix CMake version compatibility for older packages like rapidcheck
tc.variables["CMAKE_POLICY_VERSION_MINIMUM"] = "3.5"
tc.generate()
# Generate CMake find_package config files for all dependencies
deps = CMakeDeps(self)
deps.generate()
def build(self):
"""Build the project using CMake."""
cmake = CMake(self)
cmake.configure()
cmake.build()
def package(self):
"""Package the built artifacts."""
cmake = CMake(self)
cmake.install()
def package_info(self):
"""Define package information for consumers."""
self.cpp_info.libs = ["fqc_core", "fqc_cli"]
self.cpp_info.set_property("cmake_file_name", "FQCompressor")
self.cpp_info.set_property("cmake_target_name", "FQCompressor::FQCompressor")