|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +**Atom** is a foundational C++ library for astronomical software development. It provides a comprehensive set of modules for algorithmic operations, image processing, system integration, and more. The project is designed as a modular framework with optional components that can be selectively built based on requirements. |
| 8 | + |
| 9 | +## Build System |
| 10 | + |
| 11 | +### Primary Build Commands |
| 12 | + |
| 13 | +The project uses CMake as the primary build system with enhanced build scripts: |
| 14 | + |
| 15 | +- **Standard build**: `./scripts/build.sh` (Linux/macOS) or `scripts\build.bat` (Windows) |
| 16 | +- **Debug build**: `./scripts/build.sh --debug` |
| 17 | +- **Release with tests**: `./scripts/build.sh --release --tests --run-tests` |
| 18 | +- **Build with Python bindings**: `./scripts/build.sh --python` |
| 19 | +- **Build examples**: `./scripts/build.sh --examples` |
| 20 | +- **Clean build**: `./scripts/build.sh --clean` |
| 21 | + |
| 22 | +### Build System Features |
| 23 | + |
| 24 | +The enhanced build scripts support: |
| 25 | +- Multiple build types (debug, release, relwithdebinfo) |
| 26 | +- Parallel compilation with automatic CPU detection |
| 27 | +- System dependency installation |
| 28 | +- Package creation for distribution |
| 29 | +- Documentation generation with Doxygen |
| 30 | +- Cross-platform support (Linux, macOS, Windows) |
| 31 | + |
| 32 | +### Module-Based Building |
| 33 | + |
| 34 | +You can selectively build modules using CMake options: |
| 35 | +- `ATOM_BUILD_ALGORITHM=ON/OFF` - Algorithm and mathematical operations |
| 36 | +- `ATOM_BUILD_IMAGE=ON/OFF` - Image processing and computer vision |
| 37 | +- `ATOM_BUILD_ASYNC=ON/OFF` - Asynchronous operations |
| 38 | +- `ATOM_BUILD_CONNECTION=ON/OFF` - Network and communication |
| 39 | +- `ATOM_BUILD_ERROR=ON/OFF` - Error handling system |
| 40 | +- `ATOM_BUILD_UTILS=ON/OFF` - Utility functions |
| 41 | +- And more... |
| 42 | + |
| 43 | +### Testing |
| 44 | + |
| 45 | +- **Build tests**: `./scripts/build.sh --tests` |
| 46 | +- **Run tests**: `./scripts/build.sh --tests --run-tests` |
| 47 | +- **Run specific test categories**: Use CMake targets like `test_core_modules`, `test_io_modules` |
| 48 | + |
| 49 | +## Architecture |
| 50 | + |
| 51 | +### Module Structure |
| 52 | + |
| 53 | +Atom is organized into modular components under `atom/`: |
| 54 | + |
| 55 | +- **algorithm/**: Mathematical algorithms, cryptography, signal processing |
| 56 | +- **image/**: Complete image processing pipeline with astronomical format support (FITS, SER) |
| 57 | +- **async/**: Asynchronous programming primitives and concurrency utilities |
| 58 | +- **connection/**: Network communication (TCP, UDP, SSH) |
| 59 | +- **error/**: Comprehensive error handling and stack trace system |
| 60 | +- **io/**: Input/output operations and file system utilities |
| 61 | +- **system/**: System-level integration and platform-specific code |
| 62 | +- **utils/**: General utility functions and helpers |
| 63 | +- **web/**: HTTP client and web-related utilities |
| 64 | + |
| 65 | +### Key Dependencies |
| 66 | + |
| 67 | +- **OpenSSL**: Cryptographic operations (algorithm module) |
| 68 | +- **OpenCV**: Computer vision and image processing (image module) |
| 69 | +- **CFITSIO**: FITS file format support (image module, optional) |
| 70 | +- **Tesseract**: OCR capabilities (image module, optional) |
| 71 | +- **loguru**: Logging framework |
| 72 | +- **GTest**: Unit testing framework |
| 73 | + |
| 74 | +### Python Bindings |
| 75 | + |
| 76 | +Python bindings are available for most modules using pybind11: |
| 77 | +- Enable with `--python` flag or `ATOM_BUILD_PYTHON_BINDINGS=ON` |
| 78 | +- Bindings are located in `python/` directory |
| 79 | +- Each module has corresponding Python binding files |
| 80 | + |
| 81 | +## Development Workflow |
| 82 | + |
| 83 | +### Adding New Code |
| 84 | + |
| 85 | +1. **Module Selection**: Add code to appropriate module under `atom/` |
| 86 | +2. **Dependencies**: Update `CMakeLists.txt` for any new dependencies |
| 87 | +3. **Headers**: Place public headers in module root, implementation in subdirectories |
| 88 | +4. **Tests**: Add corresponding tests under `tests/[module]/` |
| 89 | +5. **Examples**: Consider adding examples under `example/[module]/` |
| 90 | + |
| 91 | +### Build Options |
| 92 | + |
| 93 | +The project supports extensive configuration via CMake options and command-line flags. Check the main `CMakeLists.txt` for complete list of available options. |
| 94 | + |
| 95 | +### Error Handling |
| 96 | + |
| 97 | +Atom uses a comprehensive error handling system centered in the `error` module. All modules should integrate with this system for consistent error reporting and stack trace generation. |
| 98 | + |
| 99 | +## Important Notes |
| 100 | + |
| 101 | +- **vcpkg**: Currently disabled due to network issues, but configuration is available |
| 102 | +- **C++ Standard**: Uses C++20 by default, C++23 when available |
| 103 | +- **Platform Support**: Windows (MSVC), Linux (GCC/Clang), macOS (Clang) |
| 104 | +- **Modular Design**: Each module can be built independently to reduce binary size |
| 105 | +- **Astronomical Focus**: Specialized support for astronomical image formats and processing |
| 106 | + |
| 107 | +## Common Development Tasks |
| 108 | + |
| 109 | +### Building a Single Module |
| 110 | +```bash |
| 111 | +cmake -B build -DATOM_BUILD_ALGORITHM=ON -DATOM_BUILD_TESTS=ON |
| 112 | +cmake --build build |
| 113 | +``` |
| 114 | + |
| 115 | +### Running Specific Tests |
| 116 | +```bash |
| 117 | +cd build |
| 118 | +ctest -R "algorithm_*" --output-on-failure |
| 119 | +``` |
| 120 | + |
| 121 | +### Building with All Features |
| 122 | +```bash |
| 123 | +./scripts/build.sh --release --python --examples --tests --docs --package |
| 124 | +``` |
0 commit comments