Integrate Conan into build systems

Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-12-28 21:16:58 +00:00
parent a26e61b318
commit 7ff22dcc57
7 changed files with 94 additions and 22 deletions

View File

@@ -31,13 +31,25 @@ jobs:
ovmf \
mtools \
xorriso \
imagemagick
imagemagick \
python3 \
python3-pip
# Install Conan
pip3 install conan
# Configure Conan
conan profile detect --force
- name: Install Conan dependencies
run: |
conan install . --build=missing
- name: Configure CMake
run: |
mkdir -p build
cd build
cmake ..
cmake .. -DCMAKE_TOOLCHAIN_FILE=../build/Release/generators/conan_toolchain.cmake
- name: Build bootloader and kernel
run: |

View File

@@ -29,13 +29,25 @@ jobs:
qemu-system-x86 \
ovmf \
mtools \
xorriso
xorriso \
python3 \
python3-pip
# Install Conan
pip3 install conan
# Configure Conan
conan profile detect --force
- name: Install Conan dependencies
run: |
conan install . --build=missing
- name: Configure CMake
run: |
mkdir -p build
cd build
cmake ..
cmake .. -DCMAKE_TOOLCHAIN_FILE=../build/Release/generators/conan_toolchain.cmake
- name: Build bootloader and kernel
run: |

View File

@@ -22,13 +22,23 @@ jobs:
set -e # Exit on any error
sudo apt-get update
sudo apt-get install -y build-essential cmake
sudo apt-get install -y build-essential cmake python3 python3-pip
# Install Conan
pip3 install conan
# Configure Conan
conan profile detect --force
- name: Install Conan dependencies
run: |
conan install . --build=missing
- name: Configure CMake
run: |
mkdir -p build
cd build
cmake ..
cmake .. -DCMAKE_TOOLCHAIN_FILE=../build/Release/generators/conan_toolchain.cmake
- name: Build unit tests
run: |

View File

@@ -32,7 +32,7 @@ RUN apt-get update && apt-get install -y \
mtools \
xorriso \
dosfstools \
# Python for build scripts
# Python for build scripts and Conan
python3 \
python3-pip \
# Additional utilities
@@ -41,6 +41,12 @@ RUN apt-get update && apt-get install -y \
file \
&& rm -rf /var/lib/apt/lists/*
# Install Conan package manager
RUN pip3 install --no-cache-dir conan
# Detect and configure Conan profile
RUN conan profile detect --force
# Create directory structure for dependencies
RUN mkdir -p /metalos/deps/firmware \
/metalos/deps/ovmf \

View File

@@ -90,8 +90,15 @@ ninja qemu
### Conan (With Package Management)
```bash
# First time: install Conan and setup profile
pip3 install conan
conan profile detect --force
# Install dependencies and generate toolchain
conan install . --build=missing
# Configure and build
mkdir build && cd build
conan install .. --build=missing
cmake .. -DCMAKE_TOOLCHAIN_FILE=../build/Release/generators/conan_toolchain.cmake -G Ninja
ninja
```

View File

@@ -36,6 +36,7 @@ cmake --build . --target qemu
The Docker image includes:
- **Build tools**: GCC, NASM, CMake, Meson
- **Conan**: Package manager for C/C++ dependencies
- **QEMU**: For testing with UEFI firmware
- **OVMF**: UEFI firmware for QEMU
- **Dependency management**: Scripts to download AMD firmware, Mesa RADV, QT6
@@ -80,12 +81,21 @@ If you prefer to build natively without Docker:
- UEFI firmware for QEMU
- Required for UEFI boot testing
7. **Conan** (for dependency management)
- Package manager for C/C++ projects
- Version 2.0 or later
- Optional but recommended
### Installing Prerequisites on Ubuntu/Debian
```bash
# Install basic build tools
sudo apt-get update
sudo apt-get install -y build-essential nasm qemu-system-x86 ovmf mtools xorriso
sudo apt-get install -y build-essential nasm qemu-system-x86 ovmf mtools xorriso cmake python3 python3-pip
# Install Conan (optional but recommended)
pip3 install conan
conan profile detect --force
# Install cross-compiler prerequisites
sudo apt-get install -y libgmp-dev libmpfr-dev libmpc-dev texinfo
@@ -97,13 +107,21 @@ sudo apt-get install -y libgmp-dev libmpfr-dev libmpc-dev texinfo
### Installing Prerequisites on Arch Linux
```bash
sudo pacman -S base-devel nasm qemu-full edk2-ovmf mtools xorriso
sudo pacman -S base-devel nasm qemu-full edk2-ovmf mtools xorriso cmake python python-pip
# Install Conan (optional but recommended)
pip install conan
conan profile detect --force
```
### Installing Prerequisites on macOS
```bash
brew install nasm qemu x86_64-elf-gcc x86_64-elf-binutils
brew install nasm qemu x86_64-elf-gcc x86_64-elf-binutils cmake python3
# Install Conan (optional but recommended)
pip3 install conan
conan profile detect --force
```
## Building the Bootloader

View File

@@ -22,9 +22,18 @@ ninja qemu # Test in QEMU
### Using Conan + CMake
```bash
# First time: install Conan and setup profile
pip3 install conan
conan profile detect --force
# Install dependencies (generates toolchain files)
conan install . --build=missing
# Configure with Conan toolchain
mkdir build && cd build
conan install .. --build=missing
cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake
cmake .. -DCMAKE_TOOLCHAIN_FILE=../build/Release/generators/conan_toolchain.cmake
# Build
cmake --build .
```
@@ -160,18 +169,16 @@ conan profile detect --force
#### Build Commands
```bash
# Create build directory
mkdir build && cd build
# Install dependencies (currently none, but ready for future)
conan install .. --build=missing
# Install dependencies (generates toolchain in build/Release/generators/)
conan install . --build=missing
# Alternative: Install with specific settings
conan install .. --build=missing -s build_type=Debug
conan install .. --build=missing -s build_type=Release
conan install . --build=missing -s build_type=Debug
conan install . --build=missing -s build_type=Release
# Configure with Conan-generated toolchain
cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake
# Create build directory and configure with Conan-generated toolchain
mkdir build && cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=../build/Release/generators/conan_toolchain.cmake
# Build
cmake --build .