This directory contains Conan package recipes for TDinternal dependencies.
Fast LZMA2 compression library
- Type: Compiled library (static/shared)
- Build System: Makefile
- Location:
fast-lzma2/ - Status: ✅ Complete and tested
Key Features:
- Optimized LZMA2 compression algorithm
- Support for both static and shared libraries
- Cross-platform (Linux, macOS, Windows)
- x86_64 assembly optimizations
Usage:
find_package(fast-lzma2 REQUIRED CONFIG)
target_link_libraries(your_target fast-lzma2::fast-lzma2)C++ stub/mock library for unit testing
- Type: Header-only library
- Build System: None (header-only)
- Location:
cppstub/ - Status: ✅ Complete and tested
Key Features:
- Header-only (no compilation needed)
- Platform-specific address manipulation
- Simple stubbing API for unit tests
- Cross-platform support
Usage:
find_package(cppstub REQUIRED CONFIG)
target_link_libraries(your_target cppstub::cppstub)| Feature | fast-lzma2 | cppstub |
|---|---|---|
| Type | Compiled Library | Header-Only |
| Build System | Makefile | None |
| Platform Specific | Yes (binary) | Yes (headers) |
| Link Required | Yes | No |
| Use Case | Compression | Testing/Mocking |
| Package Size | Medium | Small |
Install both packages:
# Install fast-lzma2
cd fast-lzma2
conan create . --build=missing
# Install cppstub
cd ../cppstub
conan create . --build=missingVerify installation:
conan list "fast-lzma2/*"
conan list "cppstub/*"To use these packages in the TDinternal project:
Update cmake/conan.cmake to include proper macros:
# For fast-lzma2
macro(DEP_ext_fast_lzma2 tgt)
if(TARGET fast-lzma2::fast-lzma2)
target_link_libraries(${tgt} PUBLIC fast-lzma2::fast-lzma2)
endif()
endmacro()
# For cppstub
macro(DEP_ext_cppstub tgt)
if(TARGET cppstub::cppstub)
target_link_libraries(${tgt} PUBLIC cppstub::cppstub)
endif()
endmacro()In your main conanfile.py or conanfile.txt:
def requirements(self):
# Production dependency
self.requires("fast-lzma2/1.0.1")
# Test dependency
if self.options.get_safe("build_tests"):
self.requires("cppstub/1.0.0")// For compression
#include "fast-lzma2.h"
// For testing
#include <stub.h>
#include <addr_any.h>conan/
├── README.md # This file
├── fast-lzma2/ # Fast LZMA2 package
│ ├── conanfile.py
│ ├── README.md
│ ├── USAGE.md
│ ├── fast-lzma2/ # Source files
│ └── test_package/
└── cppstub/ # C++ Stub package
├── conanfile.py
├── README.md
├── SUMMARY.md
├── cppstub/ # Source files
└── test_package/
cd fast-lzma2
conan create . --build=missing
# Build shared library version
conan create . --build=missing -o fast-lzma2/*:shared=True
# Build Debug version
conan create . --build=missing -s build_type=Debugcd cppstub
conan create . --build=missing
# Note: cppstub is header-only, so build options don't affect itBoth packages include test_package directories that verify:
- Headers are accessible
- Libraries link correctly (fast-lzma2)
- Basic functionality works
Run tests:
# Automatically run during conan create
conan create . --build=missingThese packages replace the following external dependencies in cmake/external.cmake:
ext_fast_lzma2→ Now using Conan packagefast-lzma2/1.0.1ext_cppstub→ Now using Conan packagecppstub/1.0.0
- Reproducible Builds: Fixed versions across all environments
- Faster Setup: Pre-built binaries when available
- Easier Maintenance: Centralized package management
- Cross-Platform: Consistent behavior across Linux, macOS, Windows
- Dependency Management: Automatic resolution of transitive dependencies
Other dependencies that could be migrated to Conan:
- lz4
- cJSON
- googletest (gtest)
- zlib
- xz
- And more...
If Conan can't find the package:
# Check if package is installed
conan list "package-name/*"
# If not, create it
cd package-name
conan create . --build=missingIf you encounter build errors:
# Clean and rebuild
conan remove "package-name/*" -c
cd package-name
conan create . --build=missingMake sure your CMakeLists.txt includes:
find_package(package-name REQUIRED CONFIG)
target_link_libraries(your_target package-name::package-name)Each package maintains its original license:
- fast-lzma2: BSD-3-Clause / GPL-2.0 (dual license)
- cppstub: MIT
To add a new Conan package:
- Create a new directory:
mkdir conan/package-name - Create
conanfile.pywith package recipe - Add source files or download mechanism
- Create
test_package/for verification - Document in README.md
- Test with
conan create . --build=missing - Update this README with the new package