mirror of
https://github.com/johndoe6345789/MetalOS.git
synced 2026-04-24 13:45:02 +00:00
Integrate Conan into build systems
Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
16
.github/workflows/qemu-test.yml
vendored
16
.github/workflows/qemu-test.yml
vendored
@@ -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: |
|
||||
|
||||
16
.github/workflows/release.yml
vendored
16
.github/workflows/release.yml
vendored
@@ -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: |
|
||||
|
||||
14
.github/workflows/unit-tests.yml
vendored
14
.github/workflows/unit-tests.yml
vendored
@@ -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: |
|
||||
|
||||
@@ -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 \
|
||||
|
||||
@@ -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
|
||||
```
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 .
|
||||
|
||||
Reference in New Issue
Block a user