From cd4b7a8a7b69aceb0a398ac057f3c4330b8a7330 Mon Sep 17 00:00:00 2001 From: Rachel Powers <508861+Ryex@users.noreply.github.com> Date: Mon, 31 Jul 2023 21:24:37 -0700 Subject: [PATCH] feat(CmakePreset): add presets for every platform Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com> --- CMakePresets.json | 275 ++++++++++++++++++++++++++++++++++++++- libraries/installQt.ps1 | 1 + libraries/installQt5.ps1 | 16 +++ 3 files changed, 290 insertions(+), 2 deletions(-) create mode 100644 libraries/installQt5.ps1 diff --git a/CMakePresets.json b/CMakePresets.json index 8413c758f..885209e5b 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -20,7 +20,8 @@ "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_MSVC_RUNTIME_LIBRARY": "MultiThreadedDLL", + "FORCE_BUNDLED_LIBS": "ON" }, "environment": { "CXX_FLAGS": "" @@ -41,6 +42,7 @@ "Launcher_BUILD_ARTIFACT": "Windows-MSVC-Qt6", "Launcher_BUILD_PLATFORM": "custom", "CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreadedDLL", + "FORCE_BUNDLED_LIBS": "ON", "CMAKE_EXPORT_COMPILE_COMMANDS": "yes" }, "environment": { @@ -61,7 +63,214 @@ "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_MSVC_RUNTIME_LIBRARY": "MultiThreadedDLL", + "ENABLE_LTO": "ON", + "FORCE_BUNDLED_LIBS": "ON" + }, + "environment": { + "CXX_FLAGS": "" + }, + "vendor": {} + }, + { + "name": "windows_legacy_debug", + "displayName": "MSVC x86 Qt5 Release", + "description": "MSVC x85 Qt5 release build Visual Studio generator", + "generator": "Visual Studio 17 2022", + "architecture": "win32", + "binaryDir": "${sourceDir}/build/", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_INSTALL_PREFIX": "install", + "Launcher_QT_VERSION_MAJOR": "5", + "CMAKE_PREFIX_PATH": "${sourceDir}/libraries/Qt/5.15.2/msvc2019/lib/cmake", + "Launcher_BUILD_ARTIFACT": "Windows-Legacy-MSVC-Qt5", + "Launcher_BUILD_PLATFORM": "custom", + "CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreadedDLL", + "FORCE_BUNDLED_LIBS": "ON" + }, + "environment": { + "CXX_FLAGS": "" + }, + "vendor": {} + }, + { + "name": "windows_legacy_release", + "displayName": "MSVC x86 Qt5 Release", + "description": "MSVC x85 Qt5 release build Visual Studio generator", + "generator": "Visual Studio 17 2022", + "architecture": "win32", + "binaryDir": "${sourceDir}/build/", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release", + "CMAKE_INSTALL_PREFIX": "install", + "Launcher_QT_VERSION_MAJOR": "5", + "CMAKE_PREFIX_PATH": "${sourceDir}/libraries/Qt/5.15.2/msvc2019/lib/cmake", + "Launcher_BUILD_ARTIFACT": "Windows-Legacy-MSVC-Qt5", + "Launcher_BUILD_PLATFORM": "custom", + "CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreadedDLL", + "ENABLE_LTO": "ON", + "FORCE_BUNDLED_LIBS": "ON" + }, + "environment": { + "CXX_FLAGS": "" + }, + "vendor": {} + }, + { + "name": "macos_default", + "displayName": "MacOS Debug Ninja", + "description": "MacOS build using Ninja generator", + "generator": "Ninja", + "binaryDir": "${sourceDir}/build/", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_INSTALL_PREFIX": "install", + "Launcher_QT_VERSION_MAJOR": "6", + "Launcher_BUILD_ARTIFACT": "MacOS-Qt6", + "Launcher_BUILD_PLATFORM": "custom", + "CMAKE_OSX_ARCHITECTURES": "x86_64;arm64", + "CMAKE_EXPORT_COMPILE_COMMANDS": "yes" + }, + "environment": { + "CXX_FLAGS": "" + }, + "vendor": {} + }, + { + "name": "macos_release", + "displayName": "MacOS Debug Ninja", + "description": "MacOS build using Ninja generator", + "generator": "Ninja", + "binaryDir": "${sourceDir}/build/", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release", + "CMAKE_INSTALL_PREFIX": "install", + "Launcher_QT_VERSION_MAJOR": "6", + "Launcher_BUILD_ARTIFACT": "MacOS-Qt6", + "Launcher_BUILD_PLATFORM": "custom", + "CMAKE_OSX_ARCHITECTURES": "x86_64;arm64", + "ENABLE_LTO": "ON", + "CMAKE_EXPORT_COMPILE_COMMANDS": "yes" + }, + "environment": { + "CXX_FLAGS": "" + }, + "vendor": {} + }, + { + "name": "macos_legacy_debug", + "displayName": "MacOS Qt5 Debug Ninja", + "description": "MacOS Qt5 build using Ninja generator", + "generator": "Ninja", + "binaryDir": "${sourceDir}/build/", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_INSTALL_PREFIX": "install", + "Launcher_QT_VERSION_MAJOR": "5", + "Launcher_BUILD_ARTIFACT": "MacOS-Qt6", + "Launcher_BUILD_PLATFORM": "custom", + "CMAKE_OSX_ARCHITECTURES": "x86_64;arm64", + "CMAKE_EXPORT_COMPILE_COMMANDS": "yes" + }, + "environment": { + "CXX_FLAGS": "" + }, + "vendor": {} + }, + { + "name": "macos_legacy_release", + "displayName": "MacOS Qt5 Release Ninja", + "description": "MacOS Qt5 release build using Ninja generator", + "generator": "Ninja", + "binaryDir": "${sourceDir}/build/", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release", + "CMAKE_INSTALL_PREFIX": "install", + "Launcher_QT_VERSION_MAJOR": "5", + "Launcher_BUILD_ARTIFACT": "MacOS-Qt6", + "Launcher_BUILD_PLATFORM": "custom", + "CMAKE_OSX_ARCHITECTURES": "x86_64;arm64", + "ENABLE_LTO": "ON", + "CMAKE_EXPORT_COMPILE_COMMANDS": "yes" + }, + "environment": { + "CXX_FLAGS": "" + }, + "vendor": {} + }, + { + "name": "linux_default", + "displayName": "Linux Debug Ninja", + "description": "Linux build using Ninja generator", + "generator": "Ninja", + "binaryDir": "${sourceDir}/build/", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_INSTALL_PREFIX": "install", + "Launcher_QT_VERSION_MAJOR": "6", + "Launcher_BUILD_ARTIFACT": "Linux-Qt6", + "Launcher_BUILD_PLATFORM": "custom", + "CMAKE_EXPORT_COMPILE_COMMANDS": "yes" + }, + "environment": { + "CXX_FLAGS": "" + }, + "vendor": {} + }, + { + "name": "linux_release", + "displayName": "Linux Release Ninja", + "description": "Linux build using Ninja generator", + "generator": "Ninja", + "binaryDir": "${sourceDir}/build/", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_INSTALL_PREFIX": "install", + "Launcher_QT_VERSION_MAJOR": "6", + "Launcher_BUILD_ARTIFACT": "Linux-Qt6", + "Launcher_BUILD_PLATFORM": "custom", + "ENABLE_LTO": "ON", + "CMAKE_EXPORT_COMPILE_COMMANDS": "yes" + }, + "environment": { + "CXX_FLAGS": "" + }, + "vendor": {} + }, + { + "name": "linux_qt5_debug", + "displayName": "Linux Qt5 Debug Ninja", + "description": "Linux Qt5 build using Ninja generator", + "generator": "Ninja", + "binaryDir": "${sourceDir}/build/", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_INSTALL_PREFIX": "install", + "Launcher_QT_VERSION_MAJOR": "5", + "Launcher_BUILD_ARTIFACT": "Linux-Qt5", + "Launcher_BUILD_PLATFORM": "custom", + "CMAKE_EXPORT_COMPILE_COMMANDS": "yes" + }, + "environment": { + "CXX_FLAGS": "" + }, + "vendor": {} + }, + { + "name": "linux_qt5_release", + "displayName": "Linux Qt5 Release Ninja", + "description": "Linux Qt5 build using Ninja generator", + "generator": "Ninja", + "binaryDir": "${sourceDir}/build/", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_INSTALL_PREFIX": "install", + "Launcher_QT_VERSION_MAJOR": "5", + "Launcher_BUILD_ARTIFACT": "Linux-Qt5", + "Launcher_BUILD_PLATFORM": "custom", + "ENABLE_LTO": "ON", + "CMAKE_EXPORT_COMPILE_COMMANDS": "yes" }, "environment": { "CXX_FLAGS": "" @@ -81,6 +290,46 @@ { "name": "windows_release", "configurePreset": "windows_release" + }, + { + "name": "windows_legacy_debug", + "configurePreset": "windows_legacy_debug" + }, + { + "name": "windows_legacy_release", + "configurePreset": "windows_legacy_release" + }, + { + "name": "macos_default", + "configurePreset": "macos_default" + }, + { + "name": "macos_release", + "configurePreset": "macos_release" + }, + { + "name": "macos_legacy_debug", + "configurePreset": "macos_legacy_debug" + }, + { + "name": "macos_legacy_release", + "configurePreset": "macos_legacy_release" + }, + { + "name": "linux_default", + "configurePreset": "linux_default" + }, + { + "name": "linux_release", + "configurePreset": "linux_release" + }, + { + "name": "linux_qt5_debug", + "configurePreset": "linux_qt5_debug" + }, + { + "name": "linux_qt5_release", + "configurePreset": "linux_qt5_release" } ], "testPresets": [ @@ -94,6 +343,28 @@ "noTestsAction": "error", "stopOnFailure": true } + }, + { + "name": "macos_default", + "configurePreset": "macos_default", + "output": { + "outputOnFailure": true + }, + "execution": { + "noTestsAction": "error", + "stopOnFailure": true + } + }, + { + "name": "linux_default", + "configurePreset": "linux_default", + "output": { + "outputOnFailure": true + }, + "execution": { + "noTestsAction": "error", + "stopOnFailure": true + } } ] } diff --git a/libraries/installQt.ps1 b/libraries/installQt.ps1 index 83a2be05c..b2c31e0dd 100644 --- a/libraries/installQt.ps1 +++ b/libraries/installQt.ps1 @@ -12,6 +12,7 @@ $system_arch = (Get-CimInstance -Class Win32_ComputerSystem).SystemType $qt_arch = Switch ($system_arch) { {$_ -match "x64" } { "win64_msvc2019_64" } {$_ -match "ARM" } { "win64_msvc2019_arm64" } + default { throw "System architecture unsupported by this script." } } $aqt_install_args = @("install-qt", "windows", "desktop", $qt_ver, $qt_arch, "-m", "all", "--outputdir", $qt_path ) diff --git a/libraries/installQt5.ps1 b/libraries/installQt5.ps1 new file mode 100644 index 000000000..0dc8ddc73 --- /dev/null +++ b/libraries/installQt5.ps1 @@ -0,0 +1,16 @@ +$aqt_url = "https://github.com/miurahr/aqtinstall/releases/latest/download/aqt.exe" +$qt_path = ( Join-Path -Path "$PSScriptRoot" -ChildPath "Qt" ) +New-Item -ItemType Directory -Path $qt_path -ErrorAction SilentlyContinue +$aqt_path = ( Join-Path -Path $qt_path -ChildPath "aqt.exe" ) + +if (!(Test-Path -Path $aqt_path)) { + Invoke-WebRequest -Uri $aqt_url -OutFile $aqt_path +} + +$qt_ver = "5.15.2" +$qt_arch = "win32_msvc2019" +$aqt_install_args = @("install-qt", "windows", "desktop", $qt_ver, $qt_arch, "-m", "all", "--outputdir", $qt_path ) + +$p = Start-Process -FilePath $aqt_path -ArgumentList $aqt_install_args -Wait + +