From 03603ff7f5e60dbad148c8355ccb69b573faa8fa Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sat, 25 Feb 2023 10:26:21 +0200 Subject: [PATCH] Define custom conan profile. --- appveyor.yml | 51 ++++++++++++++++++---------- qbs/imports/conan/ConanfileProbe.qbs | 5 +++ valentina.qbs | 2 ++ 3 files changed, 40 insertions(+), 18 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index b4324210e..9d02505cb 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -346,39 +346,53 @@ for: - dir "C:\Qt\Tools" - conan config home - type %HOMEPATH%\.conan2\settings.yml - - conan profile new valentina + - conan profile detect --name valentina - ps: | + if ($env:ARCH -eq "x64") { + $arch="arch=x86_64" + } else { + $arch="arch=x86" + } + if ($env:COMPILER -eq "msvc") { & qbs-setup-toolchains.exe --type msvc $env:MSVC_PATH\cl.exe $env:COMPILER & qbs-config.exe profiles.qt6.baseProfile $env:COMPILER - & conan profile update settings.compiler=msvc valentina - & conan profile update settings.compiler.cppstd=17 valentina - & conan profile update settings.compiler.version=192 valentina - & conan profile update settings.compiler.runtime=static valentina - & conan profile update settings.compiler.runtime_type=Release valentina + + $profile = @" + [settings] + build_type=Release + compiler=msvc + compiler.runtime_type=Release + compiler.version=192 + os=Windows + $arch + "@ } else { & qbs-setup-toolchains.exe --type mingw $env:MINGW_PATH\g++.exe $env:COMPILER & qbs-config.exe profiles.qt6.baseProfile $env:COMPILER - & conan profile update settings.compiler=gcc valentina - & conan profile update settings.compiler.cppstd=gnu17 valentina - & conan profile update settings.compiler.libcxx=libstdc++11 valentina - & conan profile update settings.compiler.version=$env:GCC_VERSION valentina + + $profile = @" + [settings] + build_type=Release + compiler=gcc + compiler.cppstd=gnu17 + compiler.libcxx=libstdc++11 + compiler.version=$env:GCC_VERSION + os=Windows + $arch + "@ } - if ($env:ARCH -eq "x64") { - & conan profile update settings.arch=x86_64 valentina - } else { - & conan profile update settings.arch=x86 valentina - } - - conan profile update settings.os=Windows valentina - - conan profile update settings.build_type=Release valentina + + $profile | Out-File -FilePath "$env:HOMEPATH\.conan2\profiles\valentina" + - qbs-config --list profiles build_script: - conan install . -s os=Windows --build=xerces-c/3.2.4 - - qbs build -f valentina.qbs -d %APPVEYOR_BUILD_FOLDER%\build --command-echo-mode command-line config:release qbs.installRoot:%APPVEYOR_BUILD_FOLDER%\build\install-root\valentina profile:qt6 project.enableConan:true modules.buildconfig.enableCcache:false + - qbs build -f valentina.qbs -d %APPVEYOR_BUILD_FOLDER%\build --command-echo-mode command-line config:release qbs.installRoot:%APPVEYOR_BUILD_FOLDER%\build\install-root\valentina profile:qt6 project.enableConan:true modules.buildconfig.enableCcache:false project.conanProfiles:[valentina] test_script: - qbs -p autotest-runner -d %APPVEYOR_BUILD_FOLDER%\build profile:qt6 config:release @@ -497,6 +511,7 @@ for: - sudo xcode-select -p - brew update > /dev/null - rm '/usr/local/bin/ccmake' + - rm '/usr/local/bin/cmake' - brew install --force coreutils qbs cmake - | if [[ "$ENABLE_CONAN" == "true" ]]; then diff --git a/qbs/imports/conan/ConanfileProbe.qbs b/qbs/imports/conan/ConanfileProbe.qbs index 21c3e153c..c3b561a7a 100644 --- a/qbs/imports/conan/ConanfileProbe.qbs +++ b/qbs/imports/conan/ConanfileProbe.qbs @@ -45,6 +45,7 @@ Probe { property var options property var settings property bool verbose: false + property stringList profiles: [] // Output property var dependencies @@ -105,6 +106,10 @@ Probe { for (var i = 0; i < additionalArguments.length; i++) args.push(additionalArguments[i]); + for (var i = 0; i < profiles.length; i++) { + args = args.concat(["-pr", profiles[i]]); + } + generatedFilesPath = FileInfo.cleanPath(_projectBuildDirectory + "/genconan/" + Utilities.getHash(args.join())); diff --git a/valentina.qbs b/valentina.qbs index 05603e423..f80699895 100644 --- a/valentina.qbs +++ b/valentina.qbs @@ -6,6 +6,7 @@ Project { property bool enableConan: false property string minimumMacosVersion: undefined + property stringList conanProfiles: [] // Temporary probe until qbs doesn't support conan 2.0 ConanfileProbe { @@ -13,6 +14,7 @@ Project { condition: enableConan conanfilePath: project.sourceDirectory + "/conanfile.py" verbose: true + profiles: conanProfiles } references: [