From 8c0a19d0c53d8cf21725cbec577f5362452f5d35 Mon Sep 17 00:00:00 2001 From: Rachel Powers <508861+Ryex@users.noreply.github.com> Date: Mon, 31 Jul 2023 00:52:27 -0700 Subject: [PATCH] feat(windows builds): add CMakePresets.json and `installqt.ps1` - with default windows builds, make setting up even in visual studio a brease. - install qt on windows to `./libraries/Qt` Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com> --- .gitignore | 2 + CMakePresets.json | 99 +++++++++++++++++++++++++++++++++++++++++++++++ installQT.ps1 | 23 +++++++++++ 3 files changed, 124 insertions(+) create mode 100644 CMakePresets.json create mode 100644 installQT.ps1 diff --git a/.gitignore b/.gitignore index b5523f685..8a6ce8ffa 100644 --- a/.gitignore +++ b/.gitignore @@ -56,3 +56,5 @@ flatbuild # Snap *.snap +libraries/Qt/ +aqtinstall.log diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 000000000..5fcac805d --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,99 @@ +{ + "version": 5, + "cmakeMinimumRequired": { + "major": 3, + "minor": 15, + "patch": 0 + }, + "include": [], + "configurePresets": [ + { + "name": "windows_default", + "displayName": "MSVC Debug", + "description": "MSVC build using Visual Studio generator", + "generator": "Visual Studio 17 2022", + "binaryDir": "${sourceDir}/build/", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_INSTALL_PREFIX": "install", + "Launcher_QT_VERSION_MAJOR": "6", + "CMAKE_PREFIX_PATH": "${sourceDir}/libraries/Qt/6.5.1/msvc2019_64/lib/cmake", + "Launcher_BUILD_ARTIFACT": "Windows-MSVC-Qt6", + "Launcher_BUILD_PLATFORM": "custom", + "CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreadedDLL", + "CMAKE_CXX_COMPILER_LAUNCHER": "ccache", + "CMAKE_EXPORT_COMPILE_COMMANDS": "yes" + }, + "environment": { + "CXX_FLAGS": "" + }, + "vendor": {} + }, + { + "name": "windows_debug_ninja", + "displayName": "MSVC Debug Ninja", + "description": "MSVC build using Ninja generator", + "generator": "Ninja", + "binaryDir": "${sourceDir}/build/", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_INSTALL_PREFIX": "install", + "Launcher_QT_VERSION_MAJOR": "6", + "CMAKE_PREFIX_PATH": "${sourceDir}/libraries/Qt/6.5.1/msvc2019_64/lib/cmake", + "Launcher_BUILD_ARTIFACT": "Windows-MSVC-Qt6", + "Launcher_BUILD_PLATFORM": "custom", + "CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreadedDLL", + "CMAKE_CXX_COMPILER_LAUNCHER": "ccache", + "CMAKE_EXPORT_COMPILE_COMMANDS": "yes" + }, + "environment": { + "CXX_FLAGS": "" + }, + "vendor": {} + }, + { + "name": "windows_release", + "displayName": "MSVC Release", + "description": "MSVC build using Ninja generator", + "generator": "Visual Studio 17 2022", + "binaryDir": "${sourceDir}/build/", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release", + "CMAKE_INSTALL_PREFIX": "install", + "Launcher_QT_VERSION_MAJOR": "6", + "CMAKE_PREFIX_PATH": "${sourceDir}/libraries/Qt/6.5.1/msvc2019_64/lib/cmake", + "Launcher_BUILD_ARTIFACT": "Windows-MSVC-Qt6", + "Launcher_BUILD_PLATFORM": "custom", + "CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreadedDLL", + "CMAKE_CXX_COMPILER_LAUNCHER": "ccache" + }, + "environment": { + "CXX_FLAGS": "" + }, + "vendor": {} + } + ], + "buildPresets": [ + { + "name": "windows_default", + "configurePreset": "windows_default" + }, + { + "name": "windows_release", + "configurePreset": "windows_release" + } + ], + "testPresets": [ + { + "name": "windows_default", + "configurePreset": "windows_default", + "output": { + "outputOnFailure": true + }, + "execution": { + "noTestsAction": "error", + "stopOnFailure": true + } + } + ] +} diff --git a/installQT.ps1 b/installQT.ps1 new file mode 100644 index 000000000..f5c1650d9 --- /dev/null +++ b/installQT.ps1 @@ -0,0 +1,23 @@ +$aqt_url = "https://github.com/miurahr/aqtinstall/releases/latest/download/aqt.exe" +$qt_path = ( Join-Path -Path "$PSScriptRoot/libraries" -ChildPath "Qt" ) +New-Item -ItemType Directory -Path $qt_path -ErrorAction SilentlyContinue +$aqt_path = ( Join-Path -Path $qt_path -ChildPath "aqt.exe" ) + +if (!([System.IO.File]::Exists($aqt_path))) { + Start-BitsTransfer -Source $aqt_url -Destination $aqt_path +} +# Invoke-WebRequest -Uri $aqt_url -OutFile $aqt_path +# +$qt_ver = "6.5.1" +$system_arch = (Get-CimInstance -Class Win32_ComputerSystem).SystemType +$qt_arch = Switch ($system_arch) { + {$_ -match "x64" } { "win64_msvc2019_64" } + {$_ -match "ARM" } { "win64_msvc2019_arm64" } +} + +$aqt_install_args = @("install-qt", "windows", "desktop", $qt_ver, $qt_arch, "-m", "all", "--outputdir", $qt_path ) + +# call_aqt $aqt_install_args +$p = Start-Process -FilePath $aqt_path -ArgumentList $aqt_install_args -Wait + +