Ich versuche CMake Builds in AppVeyor zu integrieren. Unser Projekt ist Visual Studio für Windows, aber wir versuchen, CMake für Benutzer zu unterstützen, die es bevorzugen.
Unser .appveyor.yml
Skript ist unten gezeigt (und available online). Das Problem ist, dass die PowerShell nicht mit $env:image
übereinstimmt und schließlich die else
ausgeführt wird. Der else
ist ein MSBuild-Pfad und kein CMake-Pfad. Das Ergebnis wird im Bild (und available online) angezeigt. Beachten Sie in der folgenden Abbildung die Zeile Visual Studio, MSBuild
in Zeile 107. Dies wird vom Skript übernommen.
ich eingecheckt in auch einen Versuch mit $image -eq "Visual Studio 2017"
auch. Aber immer noch keine Übereinstimmung.
Ich könnte etwas sehr falsch machen. Ich bin kein AppVeyor-Experte und heute ist mein erster Tag mit PowerShell-Skripten (obwohl ich in anderen Umgebungen Skripterfahrung gesammelt habe).
Warum kann PowerShell nicht mit $env:image
in AppVeyor übereinstimmen?
# Appveyor's documentation is at https://www.appveyor.com/docs/build-phase/,
# and a sample configuration file is at https://www.appveyor.com/docs/appveyor-yml/.
# I have to admit its a bit complex and I don't fully understand it.
version: 1.0.{build}
clone_depth: 3
skip_tags: true
configuration:
- Debug
- Release
platform:
- Win32
- x64
image:
- Visual Studio 2017
- Visual Studio 2015
- Visual Studio 2013
environment:
matrix:
- BUILD_MODE: CMake
- BUILD_MODE: MSBuild
# Disable build through solution file
build: off
# Build through commands in script below
test_script:
- ps: >-
if($env:image -eq "Visual Studio 2017" -and $env:BUILD_MODE -eq "CMake")
{
echo "Visual Studio 2017, CMake"
mkdir cmake-build
cd cmake-build
if($env:configuration -eq "Debug")
{
cmake -G "Visual Studio 15 2017" -DCMAKE_BUILD_TYPE=Debug ../
}
else
{
cmake -G "Visual Studio 15 2017" -DCMAKE_BUILD_TYPE=Release ../
}
msbuild /t:Build cryptopp-static.vcxproj
msbuild /t:Build cryptopp.vcxproj
.\cryptest.exe v
.\cryptest.exe tv all
}
elseif($env:image -eq "Visual Studio 2015" -and $env:BUILD_MODE -eq "CMake")
{
echo "Visual Studio 2015, CMake"
mkdir cmake-build
cd cmake-build
if($env:configuration -eq "Debug")
{
cmake -G "Visual Studio 14 2015" -DCMAKE_BUILD_TYPE=Debug ../
}
else
{
cmake -G "Visual Studio 14 2015" -DCMAKE_BUILD_TYPE=Release ../
}
msbuild /t:Build cryptopp-static.vcxproj
msbuild /t:Build cryptopp.vcxproj
.\cryptest.exe v
.\cryptest.exe tv all
}
elseif($env:image -eq "Visual Studio 2013" -and $env:BUILD_MODE -eq "CMake")
{
echo "Visual Studio 2013, CMake"
mkdir cmake-build
cd cmake-build
if($env:configuration -eq "Debug")
{
cmake -G "Visual Studio 12 2013" -DCMAKE_BUILD_TYPE=Debug ../
}
else
{
cmake -G "Visual Studio 12 2013" -DCMAKE_BUILD_TYPE=Release ../
}
msbuild /t:Build cryptopp-static.vcxproj
msbuild /t:Build cryptopp.vcxproj
.\cryptest.exe v
.\cryptest.exe tv all
}
else
{
echo "Visual Studio, MSBuild"
msbuild /t:Build /p:platform="$env:platform" /p:configuration="$env:configuration" cryptlib.vcxproj
msbuild /t:Build /p:platform="$env:platform" /p:configuration="$env:configuration" cryptest.vcxproj
msbuild /t:CopyCryptestToRoot cryptest.vcxproj
.\cryptest.exe v
.\cryptest.exe tv all
}
notifications:
- provider: Email
to:
- [email protected]
on_build_success: true
on_build_failure: true
Wo haben Sie die Variable image image env definiert? –
@Mathias - Die Variable image stammt aus der AppVeyor-Umgebung. In AppVeyor greifen wir auf PowerShell-Variablen als '$ env: VARIABLE_NAME' zu. Siehe auch [Konfiguration erstellen] (https://www.appveyor.com/docs/build-configuration/) in der AppVeyor-Dokumentation. – jww
Haben Sie 'Get-ChildItem env:' versucht, um festzustellen, ob es tatsächlich als Umgebungsvariable in der Sitzung erstellt wird? Sie haben mit benutzerdefinierten Umgebungsvariablen zu tun, die möglicherweise nicht vorhanden sind. Nichts, das speziell für PowerShell ist, sondern das AppVeyor-Programm – TheIncorrigible1