1
Fork 0
mirror of https://github.com/redstrate/Novus.git synced 2025-04-20 03:37:46 +00:00

Add scripts for building on Windows

This commit is contained in:
NotNite 2024-04-25 14:03:04 -04:00 committed by Joshua Goins
parent 2844231996
commit 080cf69fab
4 changed files with 182 additions and 2 deletions

5
.gitignore vendored
View file

@ -5,4 +5,7 @@
build/*
.idea/
.directory
.clang-format
.clang-format
# Windows
local/
prefix/

View file

@ -51,4 +51,15 @@ Now begin building the project:
$ cmake --build build
```
If the build was successful, the tool binaries will be found in `./build/bin`.
If the build was successful, the tool binaries will be found in `./build/bin`.
## Windows
Install the following:
* [Qt 6.6](https://doc.qt.io/qt-6/get-and-install-qt.html) (with support for the HTTP Server and WebSockets)
* [Vulkan SDK](https://vulkan.lunarg.com/sdk/home#windows)
* [Visual Studio Build Tools](https://visualstudio.microsoft.com/downloads/) (for a C++ compiler)
* CMake (can be installed with the Visual Studio Build Tools)
Afterwards, run `.\scripts\windows-setup.ps1` and `.\scripts\windows-build.ps1` in PowerShell.

19
scripts/windows-build.ps1 Normal file
View file

@ -0,0 +1,19 @@
$ErrorActionPreference = "Stop"
$PSNativeCommandUseErrorActionPreference = $true
$LocalDir = "./local"
$BuildDir = "./build"
$PrefixDir = (Get-Location).Path + "/prefix"
cmake -B "$BuildDir" "-DCMAKE_PREFIX_PATH=$PrefixDir" "-DCMAKE_CXX_COMPILER=cl" "-DCMAKE_C_COMPILER=cl" "-DCMAKE_BUILD_TYPE=Debug" "-S" . "-DCMAKE_INSTALL_PREFIX=$BuildDir"
cmake --build "$BuildDir" --config Debug --target install
Copy-Item -Path "$PrefixDir/bin/KF6ItemViews.dll" -Destination "$BuildDir/bin"
Copy-Item -Path "$PrefixDir/bin/KF6IconWidgets.dll" -Destination "$BuildDir/bin"
Copy-Item -Path "$PrefixDir/bin/KF6GuiAddons.dll" -Destination "$BuildDir/bin"
Copy-Item -Path "$PrefixDir/bin/KF6ColorScheme.dll" -Destination "$BuildDir/bin"
Copy-Item -Path "$PrefixDir/bin/intl-8.dll" -Destination "$BuildDir/bin"
Copy-Item -Path "$PrefixDir/bin/KF6IconThemes.dll" -Destination "$BuildDir/bin"
Copy-Item -Path "$PrefixDir/bin/iconv.dll" -Destination "$BuildDir/bin"
Copy-Item -Path "$PrefixDir/bin/zlibd.dll" -Destination "$BuildDir/bin"
Copy-Item -Path "$env:QTDIR/bin/Qt6PrintSupportd.dll" -Destination "$BuildDir/bin"

147
scripts/windows-setup.ps1 Normal file
View file

@ -0,0 +1,147 @@
$ErrorActionPreference = "Stop"
$PSNativeCommandUseErrorActionPreference = $true
$LocalDir = "./local"
$BuildDir = "$LocalDir/build"
$PrefixDir = (Get-Location).Path + "/prefix"
function Configure($Name, $Args = "") {
cmake -B "$BuildDir-$Name" "-DCMAKE_PREFIX_PATH=$PrefixDir" "-DCMAKE_CXX_COMPILER=cl" "-DCMAKE_C_COMPILER=cl" "-DCMAKE_BUILD_TYPE=Debug" "-S" "$LocalDir/$Name" "-DCMAKE_INSTALL_PREFIX=$PrefixDir" $Args
if ($LASTEXITCODE -ne 0) {
throw "Failed to configure $Name"
}
}
if (!(Test-Path $LocalDir)) {
New-Item -ItemType Directory -Path $LocalDir
}
# Setup Windows dependencies
Invoke-WebRequest https://xiv.zone/distrib/dependencies/gettext.zip -OutFile "$LocalDir/gettext.zip"
Expand-Archive -Path "$LocalDir/gettext.zip" -DestinationPath $PrefixDir -Force
Invoke-WebRequest https://xiv.zone/distrib/dependencies/iconv.zip -OutFile "$LocalDir/iconv.zip"
Expand-Archive -Path "$LocalDir/iconv.zip" -DestinationPath $PrefixDir -Force
Invoke-WebRequest https://cfhcable.dl.sourceforge.net/project/gnuwin32/gperf/3.0.1/gperf-3.0.1-bin.zip -OutFile "$LocalDir/gperf.zip"
Expand-Archive -Path "$LocalDir/gperf.zip" -DestinationPath $PrefixDir -Force
# Build zlib
git clone "https://github.com/madler/zlib.git" "$LocalDir/zlib"
Configure "zlib" "-DBUILD_TESTING=OFF"
cmake --build "$BuildDir-zlib" --config Debug --target install
# Build Extra CMake Modules
git clone https://invent.kde.org/frameworks/extra-cmake-modules.git "$LocalDir/extra-cmake-modules"
Configure "extra-cmake-modules" "-DBUILD_TESTING=OFF"
cmake --build "$BuildDir-extra-cmake-modules" --config Debug --target install
cmake --install "$BuildDir-extra-cmake-modules" --config Debug
# Build KI18n
git clone https://invent.kde.org/frameworks/ki18n.git "$LocalDir/ki18n"
# Workaround for Windows
Configure "ki18n" "-DBUILD_TESTING=OFF"
(Get-Content -ReadCount 0 "$BuildDir-ki18n/cmake/build-pofiles.cmake") -replace 'FATAL_ERROR', 'WARNING' | Set-Content "$BuildDir-ki18n/cmake/build-pofiles.cmake"
cmake --build "$BuildDir-ki18n" --config Debug --target install
# Build KCoreAddons
git clone https://invent.kde.org/frameworks/kcoreaddons.git "$LocalDir/kcoreaddons"
Configure "kcoreaddons" "-DBUILD_TESTING=OFF"
cmake --build "$BuildDir-kcoreaddons" --config Debug --target install
# Build KConfig
git clone https://invent.kde.org/frameworks/kconfig.git "$LocalDir/kconfig"
Configure "kconfig" "-DBUILD_TESTING=OFF"
cmake --build "$BuildDir-kconfig" --config Debug --target install
# Build KArchive
git clone https://invent.kde.org/frameworks/karchive.git "$LocalDir/karchive"
Configure "karchive" "-DBUILD_TESTING=OFF" "-DWITH_BZIP2=OFF" "-DWITH_LIBLZMA=OFF" "-DWITH_LIBZSTD=OFF"
cmake --build "$BuildDir-karchive" --config Debug --target install
# Build KItemViews
git clone https://invent.kde.org/frameworks/kitemviews.git "$LocalDir/kitemviews"
Configure "kitemviews" "-DBUILD_TESTING=OFF"
cmake --build "$BuildDir-kitemviews" --config Debug --target install
# Build KCodecs
git clone https://invent.kde.org/frameworks/kcodecs.git "$LocalDir/kcodecs"
Configure "kcodecs" "-DBUILD_TESTING=OFF"
cmake --build "$BuildDir-kcodecs" --config Debug --target install
# Build KGuiAddons
git clone https://invent.kde.org/frameworks/kguiaddons.git "$LocalDir/kguiaddons"
Configure "kguiaddons" "-DBUILD_TESTING=OFF"
cmake --build "$BuildDir-kguiaddons" --config Debug --target install
# Build KWidgetsAddons
git clone https://invent.kde.org/frameworks/kwidgetsaddons.git "$LocalDir/kwidgetsaddons"
Configure "kwidgetsaddons" "-DBUILD_TESTING=OFF"
cmake --build "$BuildDir-kwidgetsaddons" --config Debug --target install
# Build KColorScheme
git clone https://invent.kde.org/frameworks/kcolorscheme.git "$LocalDir/kcolorscheme"
Configure "kcolorscheme" "-DBUILD_TESTING=OFF"
# Workaround for Windows
(Get-Content -ReadCount 0 "$PrefixDir/lib/cmake/KF6I18n/build-pofiles.cmake") -replace 'FATAL_ERROR', 'WARNING' | Set-Content "$PrefixDir/lib/cmake/KF6I18n/build-pofiles.cmake"
cmake --build "$BuildDir-kcolorscheme" --config Debug --target install
# Build KConfigWidgets
git clone https://invent.kde.org/frameworks/kconfigwidgets.git "$LocalDir/kconfigwidgets"
Configure "kconfigwidgets" "-DBUILD_TESTING=OFF"
cmake --build "$BuildDir-kconfigwidgets" --config Debug --target install
# Build KIconThemes
git clone https://invent.kde.org/frameworks/kiconthemes.git "$LocalDir/kiconthemes"
Configure "kiconthemes" "-DBUILD_TESTING=OFF"
cmake --build "$BuildDir-kiconthemes" --config Debug --target install
# Build Sonnet
git clone https://invent.kde.org/frameworks/sonnet.git "$LocalDir/sonnet"
Configure "sonnet" "-DBUILD_TESTING=OFF"
cmake --build "$BuildDir-sonnet" --config Debug --target install
# Build KCompletion
git clone https://invent.kde.org/frameworks/kcompletion.git "$LocalDir/kcompletion"
Configure "kcompletion" "-DBUILD_TESTING=OFF"
cmake --build "$BuildDir-kcompletion" --config Debug --target install
# Build KTextWidgets
git clone https://invent.kde.org/frameworks/ktextwidgets.git "$LocalDir/ktextwidgets"
Configure "ktextwidgets" "-DBUILD_TESTING=OFF" "-DWITH_TEXT_TO_SPEECH=OFF"
cmake --build "$BuildDir-ktextwidgets" --config Debug --target install
# Build KXmlGui
git clone https://invent.kde.org/frameworks/kxmlgui.git "$LocalDir/kxmlgui"
Configure "kxmlgui" "-DBUILD_TESTING=OFF" "-DFORCE_DISABLE_KGLOBALACCEL=ON"
cmake --build "$BuildDir-kxmlgui" --config Debug --target install
# Build glm
git clone https://github.com/g-truc/glm.git "$LocalDir/glm"
Configure "glm" "-DGLM_BUILD_TESTS=OFF"
cmake --build "$BuildDir-glm" --config Debug --target install
# Build Corrosion
git clone https://github.com/corrosion-rs/corrosion.git "$LocalDir/corrosion"
Configure "corrosion" "-DCORROSION_BUILD_TESTS=OFF"
cmake --build "$BuildDir-corrosion" --config Debug --target install
# Build nlohmann
git clone https://github.com/nlohmann/json.git "$LocalDir/json"
Configure "json" "-DJSON_BuildTests=OFF"
cmake --build "$BuildDir-json" --config Debug --target install
# Build stb
git clone https://github.com/nothings/stb.git "$LocalDir/stb"
mv $LocalDir/stb/* $PrefixDir/include
# Build SPIRV-Cross
git clone https://github.com/KhronosGroup/SPIRV-Cross.git "$LocalDir/SPIRV-Cross"
Configure "SPIRV-Cross"
cmake --build "$BuildDir-SPIRV-Cross" --config Debug --target install
# Build SPIRV-Headers
git clone https://github.com/KhronosGroup/SPIRV-Headers.git "$LocalDir/SPIRV-Headers"
Configure "SPIRV-Headers"
cmake --build "$BuildDir-SPIRV-Headers" --config Debug --target install