From 4a904e8e56729e7a15ba52c7e7aec780e15a013a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 28 Dec 2025 21:22:58 +0000 Subject: [PATCH] Fix build type handling in Conan integration Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com> --- README.md | 6 +++++- docs/BUILD.md | 12 ++++++++++-- docs/BUILD_SYSTEMS.md | 21 ++++++++++++++++----- scripts/test-conan-build.sh | 13 +++++++++---- 4 files changed, 40 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 4cd9406..95d45af 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/docs/BUILD.md b/docs/BUILD.md index 5a359f0..f28521e 100644 --- a/docs/BUILD.md +++ b/docs/BUILD.md @@ -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 diff --git a/docs/BUILD_SYSTEMS.md b/docs/BUILD_SYSTEMS.md index 96e79f1..1464e8f 100644 --- a/docs/BUILD_SYSTEMS.md +++ b/docs/BUILD_SYSTEMS.md @@ -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//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 . diff --git a/scripts/test-conan-build.sh b/scripts/test-conan-build.sh index 4238120..6b81d0d 100755 --- a/scripts/test-conan-build.sh +++ b/scripts/test-conan-build.sh @@ -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 ""