Metadata-Version: 2.4
Name: cross-compile-tool
Version: 0.1.5
Summary: A generic fast cross-compilation tool using Docker and Sysroots
Author-email: Benjamin Tan <tan.benjaminkx@gmail.com>
Keywords: ros2,cross-compilation,docker,sysroot,arm64,aarch64
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Build Tools
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Provides-Extra: ros
Requires-Dist: lark; extra == "ros"
Requires-Dist: catkin_pkg; extra == "ros"
Requires-Dist: empy; extra == "ros"

# cross-compile-tool

A blazing fast, generic cross-compilation utility for C++ and ROS 2. It uses Docker to generate an ARM64 sysroot and standard native tools (GCC/Ninja) for compilation.

## Prerequisites
- **Docker**: For building the sysroot & dev environments.
- **Cross Compiler**: `sudo apt install g++-aarch64-linux-gnu` (Only required for Host builds).

## Installation
```bash
# Recommended: Install in a virtual environment
pip install .
```

## Usage

The tool uses subcommands: `init`, `status`, `prep` (or `sysroot`), `build`, `clean`, `build-dev`, and `run-dev`.

### 1. Initialize (New Project)
Create a template `apt_packages.txt` for your dependencies.
```bash
cct init
```

### 2. Status check
Check the current environment and sysroot staleness.
```bash
cct status
```
### 3. Build (The Daily Driver)
Compiles your code. It automatically prepares the sysroot if it's missing.

```bash
# Basic usage (compiles current directory)
cct build

# Clean build
cct build --clean

# ROS 2 Specific: Build only selected packages
cct build --packages-select my_pkg1 my_pkg2
```

**Common Options:**
- `--packages-select`: Build specific packages only (colcon only).
- `--packages-up-to`: Build specified packages and their dependencies (colcon only).
- `--packages-ignore`: Skip specific packages during the build.
- `--clean`: Wipe build directory before compiling.
- `--build-tool [colcon|cmake]`: Force a specific tool (default: `auto`).

### 4. Docker-based Development
For a reproducible environment without installing cross-compilers on your host:

1. **Prepare Sysroot**: Run `cct prep` on your **Host** system to sync the target libraries.
2. **Build Dev Image**: Run `cct build-dev` to create the cross-compilation container.
3. **Enter Environment**: Run `cct run-dev` to start and enter the container.
4. **Compile**: Run `cct build` inside the container to compile your project.

*Note: Your project directory and sysroot are automatically mounted into the container.*

---

## 🛠 Advanced Features
- **Status Check**: `cct status` to verify environment and sysroot staleness.
- **Selective Build**: `cct build --packages-select pkg1` (colcon only).
- **Environment Variables**: Use `CCT_BASE_IMAGE` or `CCT_SYSROOT` to skip flags.
- **CI/CD**: Run `cct prep` on the runner host, then mount `sysroot_arm64` into your build.

## 🧹 Cleanup
```bash
cct clean          # Remove build/install artifacts
cct clean --all    # Also wipe the sysroot
```
