aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonrad Kujawa <konrad.kujawa@qt.io>2023-08-10 14:59:03 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-11-24 05:45:00 +0000
commit7b0f3dcfefa8e4038b6c2c0cbe0b91badb672a87 (patch)
treef615ffdfe040d51b29d32bc80f4143a1524d63ff
parentfb0b54a3560c9cac0dba93df398b53ae903be3a6 (diff)
Add provisioning of gRPC on Windows machines
Enable native_grpc feature on msvc developer-builds. Fixes: QTBUG-109072 Change-Id: I64914d4bf0f26b907a98508f88587cbc8cb947b3 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io> (cherry picked from commit 9707535fc1c7394aead73d21653548bce69161e5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--coin/platform_configs/cmake_platforms.yaml19
-rw-r--r--coin/provisioning/common/windows/grpc.ps159
-rw-r--r--coin/provisioning/common/windows/protobuf.ps112
-rw-r--r--coin/provisioning/qtci-windows-10_21H2-x86_64/93-grpc.ps11
-rw-r--r--coin/provisioning/qtci-windows-10_22H2-x86_64/93-grpc.ps11
-rw-r--r--coin/provisioning/qtci-windows-11_21H2-x86_64/93-grpc.ps11
-rw-r--r--coin/provisioning/qtci-windows-11_22H2-x86_64/93-grpc.ps11
7 files changed, 28 insertions, 66 deletions
diff --git a/coin/platform_configs/cmake_platforms.yaml b/coin/platform_configs/cmake_platforms.yaml
index 97b5d4d9..e178e4f7 100644
--- a/coin/platform_configs/cmake_platforms.yaml
+++ b/coin/platform_configs/cmake_platforms.yaml
@@ -70,7 +70,6 @@ Configurations:
'LLVM_INSTALL_DIR={{.Env.LLVM_INSTALL_DIR_msvc}}',
'NON_QTBASE_CMAKE_ARGS=-DFFMPEG_DIR={{.Env.FFMPEG_DIR_MSVC}} -DFEATURE_native_grpc=OFF',
'Protobuf_ROOT={{.Env.Protobuf_ROOT_msvc}}',
- 'gRPC_ROOT={{.Env.gRPC_ROOT_msvc}}',
]
-
Id: 'windows-11_22h2-msvc2019'
@@ -83,7 +82,6 @@ Configurations:
'NON_QTBASE_CMAKE_ARGS=-DFFMPEG_DIR={{.Env.FFMPEG_DIR_MSVC}} -DFEATURE_native_grpc=OFF',
'LLVM_INSTALL_DIR={{.Env.LLVM_INSTALL_DIR_msvc}}',
'Protobuf_ROOT={{.Env.Protobuf_ROOT_msvc}}',
- 'gRPC_ROOT={{.Env.gRPC_ROOT_msvc}}',
]
-
Id: 'windows-10_22h2-msvc2022'
@@ -93,10 +91,9 @@ Configurations:
Configure arguments: '-debug-and-release -force-debug-info -headersclean -nomake examples -qt-zlib'
Environment variables: [
'CMAKE_ARGS=-DFEATURE_msvc_obj_debug_info=ON -DOPENSSL_ROOT_DIR={{.Env.OPENSSL_INCLUDE_x64}}\.. -DPostgreSQL_ROOT={{.Env.POSTGRESQL_LIB_x64}}\.. -DMySQL_ROOT={{.Env.ENV_MySQL_ROOT}} -DMySQL_LIBRARY_DIR={{.Env.ENV_MySQL_LIBRARY_DIR}}',
- 'NON_QTBASE_CMAKE_ARGS=-DFFMPEG_DIR={{.Env.FFMPEG_DIR_MSVC}}',
+ 'NON_QTBASE_CMAKE_ARGS=-DFFMPEG_DIR={{.Env.FFMPEG_DIR_MSVC}} -DFEATURE_native_grpc=OFF',
'LLVM_INSTALL_DIR={{.Env.LLVM_INSTALL_DIR_msvc}}',
'Protobuf_ROOT={{.Env.Protobuf_ROOT_msvc}}',
- 'gRPC_ROOT={{.Env.gRPC_ROOT_msvc}}',
]
-
Id: 'windows-11_22h2-msvc2022'
@@ -106,10 +103,9 @@ Configurations:
Configure arguments: '-debug-and-release -force-debug-info -headersclean -nomake examples -qt-zlib'
Environment variables: [
'CMAKE_ARGS=-DFEATURE_msvc_obj_debug_info=ON -DOPENSSL_ROOT_DIR={{.Env.OPENSSL_INCLUDE_x64}}\.. -DPostgreSQL_ROOT={{.Env.POSTGRESQL_LIB_x64}}\..',
- 'NON_QTBASE_CMAKE_ARGS=-DFFMPEG_DIR={{.Env.FFMPEG_DIR_MSVC}}',
+ 'NON_QTBASE_CMAKE_ARGS=-DFFMPEG_DIR={{.Env.FFMPEG_DIR_MSVC}} -DFEATURE_native_grpc=OFF',
'LLVM_INSTALL_DIR={{.Env.LLVM_INSTALL_DIR_msvc}}',
'Protobuf_ROOT={{.Env.Protobuf_ROOT_msvc}}',
- 'gRPC_ROOT={{.Env.gRPC_ROOT_msvc}}',
]
-
Id: 'windows-10_22h2-msvc2019-developer-build'
@@ -138,7 +134,6 @@ Configurations:
'OPENSSL_INCLUDE_x64={{.Env.OPENSSL_INCLUDE_x64_arm64}}',
'OPENSSL_LIB_x64={{.Env.OPENSSL_LIB_x64_arm64}}',
'Protobuf_ROOT={{.Env.Protobuf_ROOT_msvc}}',
- 'gRPC_ROOT={{.Env.gRPC_ROOT_msvc}}',
]
-
Id: 'windows-11_22h2-msvc2019-developer-build'
@@ -164,7 +159,6 @@ Configurations:
'TARGET_CMAKE_ARGS=-DFEATURE_msvc_obj_debug_info=ON',
'NON_QTBASE_TARGET_CMAKE_ARGS=-DFEATURE_native_grpc=OFF',
'Protobuf_ROOT={{.Env.Protobuf_ROOT_msvc}}',
- 'gRPC_ROOT={{.Env.gRPC_ROOT_msvc}}',
]
-
Id: 'rhel-8.8'
@@ -221,7 +215,6 @@ Configurations:
'NON_QTBASE_CMAKE_ARGS=-DFFMPEG_DIR={{.Env.FFMPEG_DIR_MINGW}} -DFEATURE_native_grpc=OFF -DCMAKE_IGNORE_PREFIX_PATH=C:/strawberry/c',
'LLVM_INSTALL_DIR={{.Env.LLVM_INSTALL_DIR_mingw}}',
'Protobuf_ROOT={{.Env.Protobuf_ROOT_mingw}}',
- 'gRPC_ROOT={{.Env.gRPC_ROOT_mingw}}',
]
-
Id: 'windows-10_22h2-llvm'
@@ -235,7 +228,6 @@ Configurations:
'NON_QTBASE_CMAKE_ARGS=-DFFMPEG_DIR={{.Env.FFMPEG_DIR_LLVM_MINGW}} -DCMAKE_IGNORE_PREFIX_PATH=C:/strawberry/c',
'LLVM_INSTALL_DIR=C:\llvm-mingw',
'Protobuf_ROOT={{.Env.Protobuf_ROOT_llvm_mingw}}',
- 'gRPC_ROOT={{.Env.gRPC_ROOT_llvm_mingw}}',
]
-
Id: 'windows-11_22h2-llvm'
@@ -249,7 +241,6 @@ Configurations:
'NON_QTBASE_CMAKE_ARGS=-DFFMPEG_DIR={{.Env.FFMPEG_DIR_LLVM_MINGW}} -DCMAKE_IGNORE_PREFIX_PATH=C:/strawberry/c',
'LLVM_INSTALL_DIR=C:\llvm-mingw',
'Protobuf_ROOT={{.Env.Protobuf_ROOT_llvm_mingw}}',
- 'gRPC_ROOT={{.Env.gRPC_ROOT_llvm_mingw}}',
]
-
Id: 'windows-10_22h2-mingw11-developer-build'
@@ -260,10 +251,9 @@ Configurations:
Environment variables: [
'Path={{.Env.MINGW1120}}\bin;{{.Env.Path}}',
'CMAKE_ARGS=-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DOPENSSL_ROOT_DIR={{.Env.OPENSSL_INCLUDE_x64}}\.. -DCMAKE_IGNORE_PREFIX_PATH=C:/strawberry/c',
- 'NON_QTBASE_CMAKE_ARGS=-DFFMPEG_DIR={{.Env.FFMPEG_DIR_MINGW}} -DCMAKE_IGNORE_PREFIX_PATH=C:/strawberry/c',
+ 'NON_QTBASE_CMAKE_ARGS=-DFFMPEG_DIR={{.Env.FFMPEG_DIR_MINGW}} -DCMAKE_IGNORE_PREFIX_PATH=C:/strawberry/c -DFEATURE_native_grpc=OFF',
'LLVM_INSTALL_DIR={{.Env.LLVM_INSTALL_DIR_mingw}}',
'Protobuf_ROOT={{.Env.Protobuf_ROOT_mingw}}',
- 'gRPC_ROOT={{.Env.gRPC_ROOT_mingw}}',
]
-
Id: 'windows-11_22h2-mingw11-developer-build'
@@ -274,10 +264,9 @@ Configurations:
Environment variables: [
'Path={{.Env.MINGW1120}}\bin;{{.Env.Path}}',
'CMAKE_ARGS=-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DOPENSSL_ROOT_DIR={{.Env.OPENSSL_INCLUDE_x64}}\.. -DCMAKE_IGNORE_PREFIX_PATH=C:/strawberry/c',
- 'NON_QTBASE_CMAKE_ARGS=-DFFMPEG_DIR={{.Env.FFMPEG_DIR_MINGW}} -DCMAKE_IGNORE_PREFIX_PATH=C:/strawberry/c',
+ 'NON_QTBASE_CMAKE_ARGS=-DFFMPEG_DIR={{.Env.FFMPEG_DIR_MINGW}} -DCMAKE_IGNORE_PREFIX_PATH=C:/strawberry/c -DFEATURE_native_grpc=OFF',
'LLVM_INSTALL_DIR={{.Env.LLVM_INSTALL_DIR_mingw}}',
'Protobuf_ROOT={{.Env.Protobuf_ROOT_mingw}}',
- 'gRPC_ROOT={{.Env.gRPC_ROOT_mingw}}',
]
-
Id: 'focal-arm64-debian-pkg-packaging'
diff --git a/coin/provisioning/common/windows/grpc.ps1 b/coin/provisioning/common/windows/grpc.ps1
index 49fe945f..51b871e3 100644
--- a/coin/provisioning/common/windows/grpc.ps1
+++ b/coin/provisioning/common/windows/grpc.ps1
@@ -20,23 +20,20 @@ function build-install-grpc {
)
$installPrefix = "C:\Utils\grpc"
$installPath = "${installPrefix}-$Postfix"
+ $envVariableName = "Protobuf_ROOT_$Postfix"
+ $protobufRoot = (Get-Item -Path "Env:$envVariableName").Value
Write-Output "Configuring and building gRPC for $CXX"
$oldCC = $env:CC
$oldCXX = $env:CXX
$env:CC = $CC
$env:CXX = $CXX
- $Protobuf_ROOT="C:\Utils\protobuf-$Postfix"
- if (!(Test-Path $Protobuf_ROOT -ErrorAction SilentlyContinue)) {
- throw "Protobuf is missing, expected at `"$Protobuf_ROOT`"."
- }
- $OPENSSL_ROOT_DIR="C:\openssl"
- if (!(Test-Path $OPENSSL_ROOT_DIR -ErrorAction SilentlyContinue)) {
- throw "OpenSSL is missing, expected at `"$OPENSSL_ROOT_DIR`"."
- }
Remove build-grpc
mkdir build-grpc
Push-Location build-grpc
$configureOptions = @(
+ # add postfix for multi-config
+ "-DCMAKE_DEBUG_POSTFIX=d"
+ "-DCMAKE_RELWITHDEBINFO_POSTFIX=rd"
# plugins
"-DgRPC_BUILD_GRPC_CSHARP_PLUGIN=OFF"
"-DgRPC_BUILD_GRPC_NODE_PLUGIN=OFF"
@@ -48,12 +45,11 @@ function build-install-grpc {
"-DgRPC_BUILD_CSHARP_EXT=OFF"
# general
"-DgRPC_BUILD_TESTS=OFF"
- "-DgRPC_PROTOBUF_PROVIDER=`"package`""
- "-DgRPC_SSL_PROVIDER=`"package`""
- "-DOPENSSL_ROOT_DIR=`"$OPENSSL_ROOT_DIR`""
+ "-DgRPC_PROTOBUF_PROVIDER=package"
+ "-DgRPC_SSL_PROVIDER=package"
# protobuf
"-DProtobuf_USE_STATIC_LIBS=ON"
- "-DProtobuf_ROOT=`"$Protobuf_ROOT`""
+ "-DCMAKE_PREFIX_PATH=$protobufRoot"
)
cmake .. -G"Ninja Multi-Config" -DCMAKE_CONFIGURATION_TYPES="$BuildType" -DCMAKE_INSTALL_PREFIX="$installPath" $extraCMakeArgs $configureOptions
$result = $LASTEXITCODE
@@ -66,7 +62,7 @@ function build-install-grpc {
}
$env:CC = $oldCC
$env:CXX = $oldCXX
- Set-EnvironmentVariable "gRPC_ROOT_$Postfix" "$InstallPath"
+ Set-EnvironmentVariable "gRPC_ROOT_$Postfix" "$installPath"
Pop-Location
Remove build-grpc
if ($result -ne 0) {
@@ -111,44 +107,15 @@ Verify-Checksum $targetFile $sha1
Extract-7Zip $targetFile $basedir
Remove $targetFile
-Push-Location $basedir
-
-# Create a new top-level CMakeLists.txt file so we can set a modern policy
-# for find_package calls
-Write-Output "cmake_minimum_required(VERSION 3.5.1)`nproject(grpc LANGUAGES C CXX)`ncmake_policy(SET CMP0074 NEW)`nadd_subdirectory(grpc-$version)" | Out-File CMakeLists.txt -Encoding utf8
-
-### MinGW
-
-# Check if mingw is where we expect it to be and add it to path:
-$mingwPath = "C:\MINGW1120\mingw64\bin"
-if (!(Test-Path $mingwPath)) {
- throw "Cannot find mingw in $mingwPath, something is configured wrong"
-}
-
-$oldPath = $env:Path
-$env:Path = "$mingwPath;$env:Path"
-build-install-grpc -CC "gcc" -CXX "g++" -BuildType "Release" -Postfix "mingw"
-$env:Path = $oldPath
-
-### LLVM MinGW
-
-# $llvmMingwPath = "C:\llvm-mingw"
-# if (!(Test-Path $llvmMingwPath)) {
-# throw "Cannot find llvm-mingw in $llvmMingwPath, something is configured wrong"
-# }
-
-$oldPath = $env:Path
-$env:Path = "$llvmMingwPath\bin;$env:Path"
-# build-install-grpc -CC "clang" -CXX "clang++" -BuildType "Release" -Postfix "llvm_mingw"
-$env:Path = $oldPath
+Push-Location $targetDir
-### MSVC
+### gRPC supports only MSVC compiler
EnterVSDevShell
-build-install-grpc -CC "cl" -CXX "cl" -BuildType "Release" -Postfix "msvc"
+# We pass along an extra argument to stop gRPC linking with the static runtime to match Protobuf config
+build-install-grpc -CC "cl" -CXX "cl" -BuildType "Release;RelWithDebInfo;Debug" -Postfix "msvc" -ExtraArguments @("-DgRPC_MSVC_STATIC_RUNTIME=OFF")
-$env:Path = $oldPath
Pop-Location
Remove $basedir
diff --git a/coin/provisioning/common/windows/protobuf.ps1 b/coin/provisioning/common/windows/protobuf.ps1
index 910be44b..05439dc2 100644
--- a/coin/provisioning/common/windows/protobuf.ps1
+++ b/coin/provisioning/common/windows/protobuf.ps1
@@ -28,14 +28,16 @@ function build-install-protobuf {
$env:CXX = $CXX
mkdir build
Push-Location build
- cmake .. -G"Ninja Multi-Config" -DCMAKE_CONFIGURATION_TYPES="$BuildType" -DCMAKE_INSTALL_PREFIX="$installPath" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_WITH_ZLIB=OFF $ExtraArguments
+ cmake .. -G"Ninja Multi-Config" -DCMAKE_CONFIGURATION_TYPES="$BuildType" -DCMAKE_INSTALL_PREFIX="$installPath" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_WITH_ZLIB=OFF -DCMAKE_DEBUG_POSTFIX="d" -DCMAKE_RELWITHDEBINFO_POSTFIX="rd" $ExtraArguments
# ninja install:all # This is broken and does not work
foreach ($config in $BuildType.split(";")) {
ninja -f "build-$config.ninja" install
}
$env:CC = $oldCC
$env:CXX = $oldCXX
- Set-EnvironmentVariable "Protobuf_ROOT_$Postfix" "$InstallPath"
+ Set-EnvironmentVariable "Protobuf_ROOT_$Postfix" "$installPath"
+ # Set environment variable without "Machine" scope to be used by grpc.ps1 script
+ [Environment]::SetEnvironmentVariable("Protobuf_ROOT_$Postfix", "$installPath")
Pop-Location
Remove build
}
@@ -87,7 +89,7 @@ if (!(Test-Path $mingwPath)) {
$oldPath = $env:Path
$env:Path = "$mingwPath;$env:Path"
-build-install-protobuf -CC "gcc" -CXX "g++" -BuildType "Release" -Postfix "mingw"
+build-install-protobuf -CC "gcc" -CXX "g++" -BuildType "Release;RelWithDebInfo;Debug" -Postfix "mingw"
$env:Path = $oldPath
### LLVM MinGW
@@ -99,7 +101,7 @@ if (!(Test-Path $llvmMingwPath)) {
$oldPath = $env:Path
$env:Path = "$llvmMingwPath\bin;$env:Path"
-build-install-protobuf -CC "clang" -CXX "clang++" -BuildType "Release" -Postfix "llvm_mingw"
+build-install-protobuf -CC "clang" -CXX "clang++" -BuildType "Release;RelWithDebInfo;Debug" -Postfix "llvm_mingw"
$env:Path = $oldPath
### MSVC
@@ -107,7 +109,7 @@ $env:Path = $oldPath
EnterVSDevShell
# We pass along an extra argument to stop protobuf linking with the static runtime
-build-install-protobuf -CC "cl" -CXX "cl" -BuildType "Release" -Postfix "msvc" -ExtraArguments @("-Dprotobuf_MSVC_STATIC_RUNTIME=OFF")
+build-install-protobuf -CC "cl" -CXX "cl" -BuildType "Release;RelWithDebInfo;Debug" -Postfix "msvc" -ExtraArguments @("-Dprotobuf_MSVC_STATIC_RUNTIME=OFF")
$env:Path = $oldPath
Pop-Location
diff --git a/coin/provisioning/qtci-windows-10_21H2-x86_64/93-grpc.ps1 b/coin/provisioning/qtci-windows-10_21H2-x86_64/93-grpc.ps1
new file mode 100644
index 00000000..7d0b471d
--- /dev/null
+++ b/coin/provisioning/qtci-windows-10_21H2-x86_64/93-grpc.ps1
@@ -0,0 +1 @@
+. "$PSScriptRoot\..\common\windows\grpc.ps1"
diff --git a/coin/provisioning/qtci-windows-10_22H2-x86_64/93-grpc.ps1 b/coin/provisioning/qtci-windows-10_22H2-x86_64/93-grpc.ps1
new file mode 100644
index 00000000..7d0b471d
--- /dev/null
+++ b/coin/provisioning/qtci-windows-10_22H2-x86_64/93-grpc.ps1
@@ -0,0 +1 @@
+. "$PSScriptRoot\..\common\windows\grpc.ps1"
diff --git a/coin/provisioning/qtci-windows-11_21H2-x86_64/93-grpc.ps1 b/coin/provisioning/qtci-windows-11_21H2-x86_64/93-grpc.ps1
new file mode 100644
index 00000000..7d0b471d
--- /dev/null
+++ b/coin/provisioning/qtci-windows-11_21H2-x86_64/93-grpc.ps1
@@ -0,0 +1 @@
+. "$PSScriptRoot\..\common\windows\grpc.ps1"
diff --git a/coin/provisioning/qtci-windows-11_22H2-x86_64/93-grpc.ps1 b/coin/provisioning/qtci-windows-11_22H2-x86_64/93-grpc.ps1
new file mode 100644
index 00000000..7d0b471d
--- /dev/null
+++ b/coin/provisioning/qtci-windows-11_22H2-x86_64/93-grpc.ps1
@@ -0,0 +1 @@
+. "$PSScriptRoot\..\common\windows\grpc.ps1"