Fix build type handling in Conan integration

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

View File

@@ -94,13 +94,17 @@ ninja qemu
pip3 install conan
conan profile detect --force
# Install dependencies and generate toolchain
# Install dependencies and generate toolchain (Release build by default)
conan install . --build=missing
# Configure and build
mkdir build && cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=../build/Release/generators/conan_toolchain.cmake -G Ninja
ninja
# Note: For Debug build, use:
# conan install . --build=missing -s build_type=Debug
# cmake .. -DCMAKE_TOOLCHAIN_FILE=../build/Debug/generators/conan_toolchain.cmake -G Ninja
```
### Docker Build (Recommended for Consistency)

View File

@@ -368,8 +368,16 @@ If CMake can't find the Conan toolchain:
# 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
# The toolchain location depends on the build type:
# - Release (default): build/Release/generators/conan_toolchain.cmake
# - Debug: build/Debug/generators/conan_toolchain.cmake
# For Release build (default):
cmake .. -DCMAKE_TOOLCHAIN_FILE=../build/Release/generators/conan_toolchain.cmake
# For Debug build:
conan install . --build=missing -s build_type=Debug
cmake .. -DCMAKE_TOOLCHAIN_FILE=../build/Debug/generators/conan_toolchain.cmake
```
### Cross-Compiler Not Found

View File

@@ -26,7 +26,7 @@ ninja qemu # Test in QEMU
pip3 install conan
conan profile detect --force
# Install dependencies (generates toolchain files)
# Install dependencies (generates toolchain files - Release by default)
conan install . --build=missing
# Configure with Conan toolchain
@@ -35,6 +35,10 @@ cmake .. -DCMAKE_TOOLCHAIN_FILE=../build/Release/generators/conan_toolchain.cmak
# Build
cmake --build .
# Note: The toolchain path matches the build type:
# - Release (default): build/Release/generators/conan_toolchain.cmake
# - Debug: build/Debug/generators/conan_toolchain.cmake (use -s build_type=Debug)
```
## Build System Comparison
@@ -169,17 +173,24 @@ conan profile detect --force
#### Build Commands
```bash
# Install dependencies (generates toolchain in build/Release/generators/)
# Install dependencies (generates toolchain in build/<BuildType>/generators/)
# Default is Release build type
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
# Alternative: Install with specific build type
conan install . --build=missing -s build_type=Debug # Generates in build/Debug/generators/
conan install . --build=missing -s build_type=Release # Generates in build/Release/generators/
# Create build directory and configure with Conan-generated toolchain
# Note: Toolchain path must match the build type used in conan install
mkdir build && cd build
# For Release build (default)
cmake .. -DCMAKE_TOOLCHAIN_FILE=../build/Release/generators/conan_toolchain.cmake
# Or for Debug build
cmake .. -DCMAKE_TOOLCHAIN_FILE=../build/Debug/generators/conan_toolchain.cmake
# Build
cmake --build .

View File

@@ -43,18 +43,23 @@ 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"
TOOLCHAIN_PATH=""
if [ -f "build/Release/generators/conan_toolchain.cmake" ]; then
TOOLCHAIN_PATH="build/Release/generators/conan_toolchain.cmake"
elif [ -f "build/Debug/generators/conan_toolchain.cmake" ]; then
TOOLCHAIN_PATH="build/Debug/generators/conan_toolchain.cmake"
else
echo "Error: conan_toolchain.cmake not found in build/Release/generators/ or build/Debug/generators/"
exit 1
fi
echo "✓ Conan toolchain generated"
echo "✓ Conan toolchain generated at: $TOOLCHAIN_PATH"
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
cmake .. -DCMAKE_TOOLCHAIN_FILE="../$TOOLCHAIN_PATH"
cd ..
echo "✓ CMake configuration successful"
echo ""