Skip to content

Commit

Permalink
Merge branch 'dev' into snow
Browse files Browse the repository at this point in the history
  • Loading branch information
Exist authored and Exist committed Sep 14, 2024
2 parents 09e6ffc + edeba24 commit f91f6cd
Show file tree
Hide file tree
Showing 62 changed files with 1,489 additions and 1,070 deletions.
7 changes: 4 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[submodule "extern/CommonLibSSE-NG"]
path = extern/CommonLibSSE-NG
url = https://github.com/alandtse/CommonLibVR.git
[submodule "extern/NVAPI"]
path = extern/NVAPI
url = https://github.com/NVIDIA/nvapi.git

[submodule "extern/Streamline"]
path = extern/Streamline
url = https://github.com/FlayaN/Streamline.git
7 changes: 2 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ find_package(cppwinrt CONFIG REQUIRED)
find_package(unordered_dense CONFIG REQUIRED)
find_package(efsw CONFIG REQUIRED)
find_package(Tracy CONFIG REQUIRED)

set(NVAPI_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/extern/nvapi/" CACHE STRING "Path to NVAPI include headers/shaders" )
set(NVAPI_LIBRARY "${CMAKE_SOURCE_DIR}/extern/nvapi/amd64/nvapi64.lib" CACHE STRING "Path to NVAPI .lib file")
add_subdirectory(${CMAKE_SOURCE_DIR}/cmake/Streamline)

target_compile_definitions(
${PROJECT_NAME}
Expand All @@ -58,7 +56,6 @@ target_include_directories(
PRIVATE
${BSHOSHANY_THREAD_POOL_INCLUDE_DIRS}
${CLIB_UTIL_INCLUDE_DIRS}
${NVAPI_INCLUDE_DIR}
)

target_link_libraries(
Expand All @@ -78,7 +75,7 @@ target_link_libraries(
unordered_dense::unordered_dense
efsw::efsw
Tracy::TracyClient
${NVAPI_LIBRARY}
Streamline
)

# https://gitlab.kitware.com/cmake/cmake/-/issues/24922#note_1371990
Expand Down
31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM mcr.microsoft.com/windows/servercore:ltsc2022 AS base
SHELL ["cmd", "/S", "/C"]

RUN powershell -NoProfile -Command "Set-ExecutionPolicy Bypass -Scope Process -Force; \
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; \
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')); \
choco install curl git 7zip -y; \
choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' -y"

RUN \
curl -SL --output vs_buildtools.exe https://aka.ms/vs/17/release/vs_buildtools.exe \
&& (start /w vs_buildtools.exe --quiet --wait --norestart --nocache \
--installPath "%ProgramFiles(x86)%\\Microsoft Visual Studio\\2022\\BuildTools" \
--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 \
--add Microsoft.VisualStudio.Component.Windows11SDK.26100 \
--remove Microsoft.VisualStudio.Component.Windows10SDK.10240 \
--remove Microsoft.VisualStudio.Component.Windows10SDK.10586 \
--remove Microsoft.VisualStudio.Component.Windows10SDK.14393 \
--remove Microsoft.VisualStudio.Component.Windows81SDK \
|| IF "%ERRORLEVEL%"=="3010" EXIT 0) \
&& del /q vs_buildtools.exe

RUN git clone https://github.com/microsoft/vcpkg.git C:/vcpkg && \
cd C:/vcpkg && \
bootstrap-vcpkg.bat

RUN setx /M VCPKG_ROOT "C:/vcpkg" && mkdir C:\skyrim-community-shaders

WORKDIR C:/skyrim-community-shaders

ENTRYPOINT ["powershell", "-File", "C:/skyrim-community-shaders/containerbuild.ps1"]
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ SKSE core plugin for community-driven advanced graphics modifications.
- Run `cmake`
- Close the cmd window

Or, in powershell run:
```pwsh
& "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" amd64
```

## Clone and Build
Open terminal (e.g., PowerShell) and run the following commands:

Expand Down Expand Up @@ -64,12 +69,33 @@ When using custom preset you can call BuildRelease.bat with an parameter to spec

When switching between different presets you might need to remove the build folder

### Build with Docker
For those who prefer to not install Visual Studio or other build dependencies on their machine, this encapsulates it. This uses Windows Containers, so no WSL for now.
1. Install [Docker](https://www.docker.com/products/docker-desktop/) first if not already there.
2. In a shell of your choice run to switch to Windows containers and create the build container:
```pwsh
& 'C:\Program Files\Docker\Docker\DockerCli.exe' -SwitchWindowsEngine; `
docker build -t skyrim-community-shaders .
```
3. Then run the build:
```pwsh
docker run -it --rm -v .:C:/skyrim-community-shaders skyrim-community-shaders:latest
```
4. Retrieve the generated build files from the `build/aio` folder.
5. In subsequent builds only run the build step (3.)

## License

### Default

[GPL-3.0-or-later](COPYING) WITH [Modding Exception AND GPL-3.0 Linking Exception (with Corresponding Source)](EXCEPTIONS.md).
Specifically, the Modded Code is Skyrim (and its variants) and Modding Libraries include [SKSE](https://skse.silverlock.org/) and Commonlib (and variants).
Specifically, the Modded Code includes:
* Skyrim (and its variants)
* Hardware drivers to enable additional functionality provided via proprietary SDKs, such as [Nvidia DLSS](https://developer.nvidia.com/rtx/dlss/get-started), [AMD FidelityFX FSR3](https://gpuopen.com/fidelityfx-super-resolution-3/), and [Intel XeSS](https://github.com/intel/xess)

The Modding Libraries include:
* [SKSE](https://skse.silverlock.org/)
* Commonlib (and variants).

### Shaders

Expand Down
10 changes: 10 additions & 0 deletions cmake/Streamline/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
cmake_minimum_required(VERSION 3.21)

add_library(Streamline INTERFACE)

target_include_directories(
Streamline INTERFACE ${CMAKE_SOURCE_DIR}/extern/Streamline/include)

if(MSVC)
target_compile_options(Streamline INTERFACE /wd5103)
endif()
32 changes: 32 additions & 0 deletions containerbuild.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
param (
[string]$preset = "ALL" # Default value for preset is "ALL"
)

Write-Host "Starting build..."

# Setup
& "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" amd64

if (-Not (Test-Path -Path "CMakeUserPresets.json")) {
Copy-Item -Path "CMakeUserPresets.json.template" -Destination "CMakeUserPresets.json"
(Get-Content -Path "CMakeUserPresets.json") -replace 'F:/MySkyrimModpack/mods/CommunityShaders;F:/SteamLibrary/steamapps/common/SkyrimVR/Data;F:/SteamLibrary/steamapps/common/Skyrim Special Edition/Data', 'C:/skyrim-community-shaders/build' | Set-Content -Path "CMakeUserPresets.json"
Write-Host "CMakeUserPresets.json created and modified."
} else {
Write-Host "CMakeUserPresets.json already exists. No action taken."
}

# Generate
cmake -S . --preset=$preset --check-stamp-file build/$preset/CMakeFiles/generate.stamp
if ($LASTEXITCODE -ne 0) {
Write-Host "CMake configuration failed."
exit 1
}

# Build
cmake --build build/$preset --config Release
if ($LASTEXITCODE -ne 0) {
Write-Host "Build failed."
exit 1
}

Write-Host "Build completed successfully."
1 change: 0 additions & 1 deletion extern/NVAPI
Submodule NVAPI deleted from 3a83ef
1 change: 1 addition & 0 deletions extern/Streamline
Submodule Streamline added at f465f4
Loading

0 comments on commit f91f6cd

Please sign in to comment.