diff --git a/.gitignore b/.gitignore index 6f97f1d8d4..d070d94681 100644 --- a/.gitignore +++ b/.gitignore @@ -60,3 +60,4 @@ eden-windows-msvc artifacts *.AppImage* /install* +vulkansdk*.exe diff --git a/docs/Deps.md b/docs/Deps.md index 8ab6a68ebe..cfea5d481d 100644 --- a/docs/Deps.md +++ b/docs/Deps.md @@ -5,7 +5,7 @@ To build Eden, you MUST have a C++ compiler. - GCC 12 also requires Clang 14+ * On Windows, we support: - **[MSVC](https://visualstudio.microsoft.com/downloads/)** (default) - - It's STRONGLY RECOMMENDED to use the *Community* option + - It's STRONGLY RECOMMENDED to use the **Community** option and **Visual Studio 2022** - You need to install: **[Desktop development with C++](https://learn.microsoft.com/en-us/cpp/build/vscpp-step-0-installation?view=msvc-170)** - **[clang-cl](https://learn.microsoft.com/en-us/cpp/build/clang-support-msbuild?view=msvc-180)** - You need to install: **C++ Clang tools for Windows** @@ -18,6 +18,7 @@ The following additional tools are also required: * **[CMake](https://www.cmake.org/)** 3.22+ - already included with the Android SDK * **[Git](https://git-scm.com/)** for version control - **[Windows installer](https://gitforwindows.org)** +* **[Python3](https://www.python.org/downloads/)** 3.10+ - necessary to download external repositories * On Windows, you must install the **[Vulkan SDK](https://vulkan.lunarg.com/sdk/home#windows)** as well - *A convenience script to install the latest SDK is provided in `tools/windows/install-vulkan-sdk.ps1`* diff --git a/tools/windows/install-vulkan-sdk.ps1 b/tools/windows/install-vulkan-sdk.ps1 index 7ac4e6c809..072b531201 100755 --- a/tools/windows/install-vulkan-sdk.ps1 +++ b/tools/windows/install-vulkan-sdk.ps1 @@ -7,7 +7,9 @@ $ErrorActionPreference = "Stop" # Check if running as administrator -if (-not ([bool](net session 2>$null))) { +try { + net session 1>$null 2>$null +} catch { Write-Host "This script must be run with administrator privileges!" Exit 1 } diff --git a/tools/windows/install-vulkan-sdk.sh b/tools/windows/install-vulkan-sdk.sh old mode 100755 new mode 100644 index ad97fb3d06..933d4ec708 --- a/tools/windows/install-vulkan-sdk.sh +++ b/tools/windows/install-vulkan-sdk.sh @@ -3,16 +3,10 @@ # SPDX-License-Identifier: GPL-3.0-or-later : "${VULKAN_SDK_VER:=1.4.328.1}" -: "${VULKAN_SDK:=C:/VulkanSDK/$VULKAN_SDK_VER}" +: "${VULKAN_ROOT:=C:/VulkanSDK/$VULKAN_SDK_VER}" EXE_FILE="vulkansdk-windows-X64-$VULKAN_SDK_VER.exe" URI="https://sdk.lunarg.com/sdk/download/$VULKAN_SDK_VER/windows/$EXE_FILE" -DESTINATION="./$EXE_FILE" - -if command -v cygpath >/dev/null 2>&1; then - VULKAN_ROOT_UNIX=$(cygpath -u "$VULKAN_SDK") -else - VULKAN_ROOT_UNIX="$VULKAN_SDK" -fi +VULKAN_ROOT_UNIX=$(cygpath -u "$VULKAN_ROOT") # Check if Vulkan SDK is already installed if [ -d "$VULKAN_ROOT_UNIX" ]; then @@ -21,18 +15,29 @@ if [ -d "$VULKAN_ROOT_UNIX" ]; then fi echo "Downloading Vulkan SDK $VULKAN_SDK_VER from $URI" -curl -L -o "$DESTINATION" "$URI" -chmod +x "$DESTINATION" +[ ! -f "./$EXE_FILE" ] && curl -L -o "./$EXE_FILE" "$URI" +chmod +x "./$EXE_FILE" echo "Finished downloading $EXE_FILE" echo "Installing Vulkan SDK $VULKAN_SDK_VER..." -"$DESTINATION" --root "$VULKAN_ROOT_UNIX" --accept-licenses --default-answer --confirm-command install +if net session > /dev/null 2>&1; then + ./$EXE_FILE --root "$VULKAN_ROOT" --accept-licenses --default-answer --confirm-command install +else + DESTINATION=$(cygpath -w "$PWD/$EXE_FILE") + powershell.exe -Command " + Start-Process \"$DESTINATION\" -Verb RunAs -ArgumentList @( + '--root', '$VULKAN_ROOT', + '--accept-licenses', + '--default-answer', + '--confirm-command', + 'install' + )" +fi echo "Finished installing Vulkan SDK $VULKAN_SDK_VER" # GitHub Actions integration -if [ "${GITHUB_ACTIONS:-false}" = "true" ]; then - echo "VULKAN_SDK=$VULKAN_SDK" >> "$GITHUB_ENV" - echo "$VULKAN_SDK/bin" >> "$GITHUB_PATH" -fi - +if [ \"${GITHUB_ACTIONS:-false}\" = \"true\" ]; then + echo \"VULKAN_SDK=$VULKAN_ROOT\" >> \"$GITHUB_ENV\" + echo \"$VULKAN_ROOT/bin\" >> \"$GITHUB_PATH\" +fi \ No newline at end of file diff --git a/tools/windows/load-msvc-env.ps1 b/tools/windows/load-msvc-env.ps1 index 5b5e87e5b5..465a1da314 100644 --- a/tools/windows/load-msvc-env.ps1 +++ b/tools/windows/load-msvc-env.ps1 @@ -1,11 +1,11 @@ # SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project # SPDX-License-Identifier: GPL-3.0-or-later -$osArch = [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture +$archRaw = $env:PROCESSOR_ARCHITECTURE switch ($osArch) { - "X64" { $arch = "x64" } - "Arm64" { $arch = "arm64" } + "AMD64" { $arch = "x64" } + "ARM64" { $arch = "arm64" } default { Write-Error "load-msvc-env.ps1: Unsupported architecture: $osArch" exit 1 diff --git a/tools/windows/load-msvc-env.sh b/tools/windows/load-msvc-env.sh old mode 100755 new mode 100644 index 5f40534f05..b729eaabfb --- a/tools/windows/load-msvc-env.sh +++ b/tools/windows/load-msvc-env.sh @@ -2,6 +2,44 @@ # SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project # SPDX-License-Identifier: GPL-3.0-or-later -# shellcheck disable=SC2154 -CLPATH=$(cygpath -u "$VCToolsInstallDir\\bin\\Host${VSCMD_ARG_HOST_ARCH}\\${VSCMD_ARG_TGT_ARCH}") -export PATH="$CLPATH:$PATH" +ARCH_RAW="$PROCESSOR_ARCHITECTURE" + +case "$ARCH_RAW" in + AMD64) ARCH="x64" ;; + ARM64) ARCH="arm64" ;; + *) echo "load-msvc-env.sh: Unsupported architecture: $ARCH_RAW"; exit 1 ;; +esac + +VS_BASE="" +for p in \ + "/c/Program Files/Microsoft Visual Studio/18/Community" \ + "/c/Program Files/Microsoft Visual Studio/17/Community" \ + "/c/Program Files/Microsoft Visual Studio/2022/Community" +do + echo "load-msvc-env.sh: $p" + if [ -d "$p/VC/Auxiliary/Build" ]; then + VS_BASE="$p" + break + fi +done + +if [ -z "$VS_BASE" ]; then + echo "load-msvc-env.sh: Could not locate Visual Studio installation." + exit 1 +fi + +MSVC_ROOT="$VS_BASE/VC/Tools/MSVC" +if [ ! -d "$MSVC_ROOT" ]; then + echo "load-msvc-env.sh: Could not locate MSVC tools: $MSVC_ROOT" + exit 1 +fi + +MSVC_VER=$(ls "$MSVC_ROOT" | sort -V | tail -n1) +BIN_PATH="$MSVC_ROOT/$MSVC_VER/bin/Host$ARCH/$ARCH" + +export PATH="$BIN_PATH:$PATH" + +echo "MSVC environment loaded:" +echo " VS path: $VS_BASE" +echo " MSVC ver: $MSVC_VER" +echo " Arch: $ARCH" \ No newline at end of file