aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--coin/platform_configs/cmake_platforms.yaml4
-rw-r--r--coin/provisioning/common/windows/install-ffmpeg.ps1122
2 files changed, 80 insertions, 46 deletions
diff --git a/coin/platform_configs/cmake_platforms.yaml b/coin/platform_configs/cmake_platforms.yaml
index add0169d..6e41a238 100644
--- a/coin/platform_configs/cmake_platforms.yaml
+++ b/coin/platform_configs/cmake_platforms.yaml
@@ -172,7 +172,7 @@ Configurations:
Environment variables: [
'Path=C:\llvm-mingw\bin;{{.Env.Path}}',
'CMAKE_ARGS=-DOPENSSL_ROOT_DIR={{.Env.OPENSSL_INCLUDE_x64}}\.. -DPostgreSQL_ROOT={{.Env.POSTGRESQL_LIB_x64}}\..',
- 'NON_QTBASE_CMAKE_ARGS=-DFEATURE_system_tiff=OFF',
+ 'NON_QTBASE_CMAKE_ARGS=-DFEATURE_system_tiff=OFF -DFFMPEG_DIR={{.Env.FFMPEG_DIR_LLVM_MINGW}}',
'LLVM_INSTALL_DIR=C:\llvm-mingw'
]
-
@@ -184,7 +184,7 @@ Configurations:
Environment variables: [
'Path=C:\llvm-mingw\bin;{{.Env.Path}}',
'CMAKE_ARGS=-DOPENSSL_ROOT_DIR={{.Env.OPENSSL_INCLUDE_x64}}\.. -DPostgreSQL_ROOT={{.Env.POSTGRESQL_LIB_x64}}\..',
- 'NON_QTBASE_CMAKE_ARGS=-DFEATURE_system_tiff=OFF',
+ 'NON_QTBASE_CMAKE_ARGS=-DFEATURE_system_tiff=OFF -DFFMPEG_DIR={{.Env.FFMPEG_DIR_LLVM_MINGW}}',
'LLVM_INSTALL_DIR=C:\llvm-mingw'
]
-
diff --git a/coin/provisioning/common/windows/install-ffmpeg.ps1 b/coin/provisioning/common/windows/install-ffmpeg.ps1
index 73b7444f..4953c774 100644
--- a/coin/provisioning/common/windows/install-ffmpeg.ps1
+++ b/coin/provisioning/common/windows/install-ffmpeg.ps1
@@ -58,62 +58,96 @@ Verify-Checksum $download_location $sha1
Extract-7Zip $download_location $unzip_location
Remove $download_location
-function CheckExitCode {
- param ($p)
-
- if ($p.ExitCode) {
- Write-host "Process failed with exit code: $($p.ExitCode)"
- exit 1
- }
-}
-
$config = Get-Content "$PSScriptRoot\..\shared\ffmpeg_config_options.txt"
Write-Host "FFmpeg configuration $config"
-Write-Host "Configure and compile ffmpeg for MINGW"
-$mingw = [System.Environment]::GetEnvironmentVariable("MINGW1120", [System.EnvironmentVariableTarget]::Machine)
-$env:PATH += ";$mingw\bin"
-$env:MSYS2_PATH_TYPE = "inherit"
-$env:MSYSTEM = "MINGW"
-$cmd = "cd /c/$ffmpeg_name"
-$cmd += "&& mkdir -p build/mingw && cd build/mingw"
-$cmd += "&& ../../configure --prefix=installed $config"
-$cmd += "&& make install -j"
+function InstallFfmpeg {
+ Param (
+ [string]$buildSystem,
+ [string]$msystem,
+ [string]$additionalPath,
+ [string]$ffmpegDirEnvVar,
+ [string]$toolchain
+ )
+
+ Write-Host "Configure and compile ffmpeg for $buildSystem"
-$build = Start-Process -NoNewWindow -Wait -PassThru -ErrorAction Stop -FilePath "$msys" -ArgumentList ("-lc", "`"$cmd`"")
-CheckExitCode $build
+ $oldPath = $env:PATH
-Set-EnvironmentVariable "FFMPEG_DIR_MINGW" "C:\$ffmpeg_name\build\mingw\installed"
+ if ($additionalPath) { $env:PATH = "$additionalPath;$env:PATH" }
+ $env:MSYS2_PATH_TYPE = "inherit"
+ $env:MSYSTEM = $msystem
+ $cmd = "cd /c/$ffmpeg_name"
+ $cmd += " && mkdir -p build/$buildSystem && cd build/$buildSystem"
+ $cmd += " && ../../configure --prefix=installed $config"
+ if ($toolchain) { $cmd += " --toolchain=$toolchain" }
+ $cmd += " && make install -j"
-Write-Host "Enter VisualStudio developer shell"
-$vsPath = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional"
-try {
- Import-Module "$vsPath\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
- Enter-VsDevShell -VsInstallPath $vsPath -DevCmdArguments "-arch=x64 -no_logo"
-} catch {
- Write-host "Failed to enter VisualStudio DevShell"
- exit 1
+ Write-Host "MSYS cmd:"
+ Write-Host $cmd
+ $buildResult = Start-Process -NoNewWindow -Wait -PassThru -ErrorAction Stop -FilePath "$msys" -ArgumentList ("-lc", "`"$cmd`"")
+
+ $env:PATH = $oldPath
+
+ if ($buildResult.ExitCode) {
+ Write-Host "Failed to build ffmpeg for $buildSystem"
+ return $false
+ }
+
+ Set-EnvironmentVariable $ffmpegDirEnvVar "C:\$ffmpeg_name\build\$buildSystem\installed"
+ return $true
}
-Write-Host "Configure and compile ffmpeg for MSVC"
-$env:MSYSTEM = "MSYS"
-$env:MSYS2_PATH_TYPE = "inherit"
+function InstallMingwFfmpeg {
+ $mingwPath = [System.Environment]::GetEnvironmentVariable("MINGW1120", [System.EnvironmentVariableTarget]::Machine)
+ return InstallFfmpeg -buildSystem "mingw" -msystem "MINGW" -additionalPath "$mingwPath\bin" -ffmpegDirEnvVar "FFMPEG_DIR_MINGW"
+}
-$cmd = "CC=cl;"
-$cmd += "cd /c/$ffmpeg_name"
-$cmd += "&& mkdir -p build/msvc && cd build/msvc"
-$cmd += "&& ../../configure --toolchain=msvc --prefix=installed $config"
-$cmd += "&& make install -j"
-$build = Start-Process -NoNewWindow -Wait -PassThru -ErrorAction Stop -FilePath "$msys" -ArgumentList ("-lc", "`"$cmd`"")
-CheckExitCode $build
+function InstallMsvcFfmpeg {
+ $vsPath = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional"
+ #$vsPath = "C:\Program Files\Microsoft Visual Studio\2022\Professional"
+
+ Write-Host "Enter VisualStudio developer shell"
+ try {
+ Import-Module "$vsPath\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
+ Enter-VsDevShell -VsInstallPath $vsPath -DevCmdArguments "-arch=x64 -no_logo"
+ } catch {
+ Write-Host "Failed to enter VisualStudio DevShell"
+ return $false
+ }
+
+ $result = InstallFfmpeg -buildSystem "msvc" -msystem "MSYS" -toolchain "msvc" -ffmpegDirEnvVar "FFMPEG_DIR_MSVC"
+
+ if ($result) {
+ # As ffmpeg build system creates lib*.a file we have to rename them to *.lib files to be recognized by WIN32
+ Write-Host "Rename libraries lib*.a -> *.lib"
+ try {
+ $msvcDir = [System.Environment]::GetEnvironmentVariable("FFMPEG_DIR_MSVC", [System.EnvironmentVariableTarget]::Machine)
+ Get-ChildItem "$msvcDir\lib\lib*.a" | Rename-Item -NewName { $_.Name -replace 'lib(\w+).a$', '$1.lib' }
+ } catch {
+ Write-Host "Failed to rename libraries lib*.a -> *.lib"
+ return $false
+ }
+ }
+
+ return $result
+}
+
+
+function InstallLlvmMingwFfmpeg {
+ return InstallFfmpeg -buildSystem "llvm-mingw" -msystem "CLANG64" -ffmpegDirEnvVar "FFMPEG_DIR_LLVM_MINGW" -additionalPath "C:\llvm-mingw\bin"
+}
-$ffmpeg_mscv_install = "C:\$ffmpeg_name\build\msvc\installed"
+$mingwRes = InstallMingwFfmpeg
+$msvcRes = InstallMsvcFfmpeg
+$llvmMingwRes = InstallLlvmMingwFfmpeg
-# As ffmpeg build system creates lib*.a file we have to rename them to *.lib files to be recognized by WIN32
-Write-Host "Rename libraries lib*.a -> *.lib"
-Get-ChildItem "$ffmpeg_mscv_install\lib\lib*.a" | Rename-Item -NewName { $_.Name -replace 'lib(\w+).a$', '$1.lib' }
+Write-Host "Ffmpeg installation results:"
+Write-Host " mingw:" $(if ($mingwRes) { "OK" } else { "FAIL" })
+Write-Host " msvc:" $(if ($msvcRes) { "OK" } else { "FAIL" })
+Write-Host " llvm-mingw:" $(if ($llvmMingwRes) { "OK" } else { "FAIL" })
-Set-EnvironmentVariable "FFMPEG_DIR_MSVC" $ffmpeg_mscv_install
+exit $(if ($mingwRes -and $msvcRes -and $llvmMingwRes) { 0 } else { 1 })