mirror of
https://github.com/johndoe6345789/MetalOS.git
synced 2026-04-24 13:45:02 +00:00
Add Conan integration test script and enhanced documentation
Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
@@ -320,8 +320,58 @@ mkdir build && cd build
|
||||
cmake ..
|
||||
```
|
||||
|
||||
## Testing Conan Integration
|
||||
|
||||
To verify that Conan is properly integrated and working:
|
||||
|
||||
```bash
|
||||
# Run the Conan integration test
|
||||
./scripts/test-conan-build.sh
|
||||
```
|
||||
|
||||
This test script will:
|
||||
1. Verify Conan installation
|
||||
2. Check/create Conan profile
|
||||
3. Install dependencies
|
||||
4. Generate Conan toolchain
|
||||
5. Configure CMake with Conan
|
||||
6. Validate the integration
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Conan Not Found
|
||||
If you get "conan: command not found":
|
||||
```bash
|
||||
# Install Conan
|
||||
pip3 install conan
|
||||
|
||||
# Verify installation
|
||||
conan --version
|
||||
|
||||
# Create profile
|
||||
conan profile detect --force
|
||||
```
|
||||
|
||||
### Conan Profile Issues
|
||||
If Conan complains about missing profile:
|
||||
```bash
|
||||
# Detect and create default profile
|
||||
conan profile detect --force
|
||||
|
||||
# Verify profile exists
|
||||
conan profile show default
|
||||
```
|
||||
|
||||
### Conan Toolchain Not Found
|
||||
If CMake can't find the Conan toolchain:
|
||||
```bash
|
||||
# Make sure to run conan install first
|
||||
conan install . --build=missing
|
||||
|
||||
# The toolchain will be at: build/Release/generators/conan_toolchain.cmake
|
||||
# Use it with: cmake .. -DCMAKE_TOOLCHAIN_FILE=../build/Release/generators/conan_toolchain.cmake
|
||||
```
|
||||
|
||||
### Cross-Compiler Not Found
|
||||
If you get errors about missing cross-compiler:
|
||||
1. Check that x86_64-elf-gcc is in your PATH
|
||||
|
||||
@@ -194,13 +194,19 @@ conan build . --build-folder=build
|
||||
- ✅ Version management
|
||||
- ✅ Cross-platform package management
|
||||
- ✅ Integration with CMake and other build systems
|
||||
- ✅ **Recommended for CI/CD** - ensures consistent builds
|
||||
|
||||
#### Disadvantages
|
||||
- ❌ Requires Python and Conan
|
||||
- ❌ Additional complexity
|
||||
- ❌ Currently overkill (we have no dependencies yet)
|
||||
- ❌ Additional setup step
|
||||
- ❌ Learning curve
|
||||
|
||||
#### When to Use
|
||||
- ✅ **CI/CD pipelines** (all workflows now use Conan)
|
||||
- ✅ **Production builds** requiring reproducibility
|
||||
- ✅ **When adding external dependencies** (QT6, Mesa RADV in the future)
|
||||
- ✅ **Cross-platform development** needing consistent dependencies
|
||||
|
||||
---
|
||||
|
||||
## Which Build System Should I Use?
|
||||
@@ -221,26 +227,31 @@ cd build-ninja && ninja && ninja qemu
|
||||
- Configure your IDE to use the CMakeLists.txt
|
||||
|
||||
### For CI/CD
|
||||
**Use: Make or CMake**
|
||||
**Use: Conan + CMake (Recommended)**
|
||||
```bash
|
||||
# GitHub Actions, GitLab CI, etc.
|
||||
make all && make test
|
||||
|
||||
# Or with CMake
|
||||
cmake -B build -G Ninja
|
||||
# All MetalOS CI workflows now use Conan
|
||||
conan install . --build=missing
|
||||
cmake -B build -DCMAKE_TOOLCHAIN_FILE=build/Release/generators/conan_toolchain.cmake
|
||||
cmake --build build
|
||||
ctest --test-dir build
|
||||
```
|
||||
|
||||
Benefits:
|
||||
- ✅ Reproducible builds across different CI runners
|
||||
- ✅ Consistent dependency versions
|
||||
- ✅ Future-proof for when we add dependencies
|
||||
|
||||
### For Cross-Platform Development
|
||||
**Use: CMake + Ninja**
|
||||
**Use: Conan + CMake + Ninja**
|
||||
```bash
|
||||
# Works on Linux, macOS, Windows
|
||||
cmake -G Ninja -B build
|
||||
conan install . --build=missing
|
||||
cmake -G Ninja -B build -DCMAKE_TOOLCHAIN_FILE=build/Release/generators/conan_toolchain.cmake
|
||||
cmake --build build
|
||||
```
|
||||
|
||||
### For Projects with Dependencies (Future)
|
||||
### For Projects with Dependencies (Current & Future)
|
||||
**Use: Conan + CMake**
|
||||
```bash
|
||||
# When we add QT6, Mesa RADV, etc.
|
||||
|
||||
72
scripts/test-conan-build.sh
Executable file
72
scripts/test-conan-build.sh
Executable file
@@ -0,0 +1,72 @@
|
||||
#!/bin/bash
|
||||
# Test script for Conan integration
|
||||
# This script tests that Conan is properly integrated and can build MetalOS
|
||||
|
||||
set -e # Exit on any error
|
||||
|
||||
echo "=========================================="
|
||||
echo "MetalOS Conan Integration Test"
|
||||
echo "=========================================="
|
||||
echo ""
|
||||
|
||||
# Check if Conan is installed
|
||||
echo "1. Checking Conan installation..."
|
||||
if ! command -v conan &> /dev/null; then
|
||||
echo "Error: Conan is not installed"
|
||||
echo "Install with: pip3 install conan"
|
||||
exit 1
|
||||
fi
|
||||
conan --version
|
||||
echo "✓ Conan is installed"
|
||||
echo ""
|
||||
|
||||
# Check if Conan profile exists
|
||||
echo "2. Checking Conan profile..."
|
||||
if ! conan profile show default &> /dev/null; then
|
||||
echo "Creating default Conan profile..."
|
||||
conan profile detect --force
|
||||
fi
|
||||
echo "✓ Conan profile exists"
|
||||
echo ""
|
||||
|
||||
# Clean any previous build artifacts
|
||||
echo "3. Cleaning previous build artifacts..."
|
||||
rm -rf build build-conan-test CMakeUserPresets.json
|
||||
echo "✓ Clean complete"
|
||||
echo ""
|
||||
|
||||
# Install dependencies with Conan
|
||||
echo "4. Installing dependencies with Conan..."
|
||||
conan install . --build=missing
|
||||
echo "✓ Dependencies installed"
|
||||
echo ""
|
||||
|
||||
# Verify toolchain was generated
|
||||
echo "5. Verifying Conan toolchain generation..."
|
||||
if [ ! -f "build/Release/generators/conan_toolchain.cmake" ]; then
|
||||
echo "Error: conan_toolchain.cmake not found"
|
||||
exit 1
|
||||
fi
|
||||
echo "✓ Conan toolchain generated"
|
||||
echo ""
|
||||
|
||||
# Configure with CMake using Conan toolchain
|
||||
echo "6. Configuring CMake with Conan toolchain..."
|
||||
mkdir -p build-conan-test
|
||||
cd build-conan-test
|
||||
cmake .. -DCMAKE_TOOLCHAIN_FILE=../build/Release/generators/conan_toolchain.cmake
|
||||
cd ..
|
||||
echo "✓ CMake configuration successful"
|
||||
echo ""
|
||||
|
||||
# Clean up test build directory
|
||||
echo "7. Cleaning up test artifacts..."
|
||||
rm -rf build-conan-test build CMakeUserPresets.json
|
||||
echo "✓ Cleanup complete"
|
||||
echo ""
|
||||
|
||||
echo "=========================================="
|
||||
echo "Conan Integration Test: PASSED ✓"
|
||||
echo "=========================================="
|
||||
echo ""
|
||||
echo "Conan is properly integrated and working!"
|
||||
Reference in New Issue
Block a user