Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,6 @@ CheckOptions:
readability-identifier-naming.NamespaceCase: lower_case
readability-identifier-naming.ParameterCase: lower_case
readability-identifier-naming.VariableCase: lower_case

readability-identifier-length.IgnoredVariableNames: _
---
2 changes: 1 addition & 1 deletion .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "[email protected]:bl-sdk/common_dotfiles.git",
"commit": "fb06ff8c773806b3f8cc69dbda60c0a7b481c6de",
"commit": "597ec422d3b5692927f325b9b5c2ae42288e8cc5",
"checkout": null,
"context": {
"cookiecutter": {
Expand Down
6 changes: 6 additions & 0 deletions .devcontainer/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Ignore any custom folders outside of our predefined ones, to let you create your own
# One use might be using your own container mapping the install path onto your actual game folder
*/
!clang-cross
!llvm-mingw
!mingw
65 changes: 65 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
FROM alpine:latest AS clang-cross
CMD ["/bin/bash"]
RUN <<EOF
apk add --no-cache \
bash \
clang \
clang-extra-tools \
cmake \
git \
lld \
llvm \
msitools \
ninja \
openssh \
perl \
python3 \
py3-requests
git clone https://github.com/mstorsjo/msvc-wine.git
msvc-wine/vsdownload.py \
--accept-license \
--dest /win-sdk \
Microsoft.VisualStudio.Workload.VCTools \
--arch x86 x64
msvc-wine/install.sh /win-sdk
rm -r msvc-wine
EOF

# llvm-mingw comes with pre-built ubuntu binaries, so using that
FROM ubuntu:latest AS llvm-mingw
CMD ["/bin/bash"]
RUN <<EOF
apt-get update
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC \
apt-get install -y \
cmake \
git \
msitools \
ninja-build \
python-is-python3 \
python3 \
python3-requests \
wget \
xz-utils
wget -nv https://github.com/mstorsjo/llvm-mingw/releases/download/20250114/llvm-mingw-20250114-msvcrt-ubuntu-20.04-x86_64.tar.xz
tar -xf llvm-mingw-20250114-msvcrt-ubuntu-20.04-x86_64.tar.xz
rm llvm-mingw-20250114-msvcrt-ubuntu-20.04-x86_64.tar.xz
mv llvm-mingw-20250114-msvcrt-ubuntu-20.04-x86_64 /llvm-mingw
EOF
ENV PATH="/llvm-mingw/bin:$PATH"

FROM alpine:latest AS mingw
CMD ["/bin/bash"]
RUN <<EOF
apk add --no-cache \
bash \
cmake \
git \
i686-mingw-w64-gcc \
mingw-w64-gcc \
msitools \
ninja \
openssh \
py3-requests \
python3
EOF
7 changes: 7 additions & 0 deletions .devcontainer/clang-cross/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "clang-cross",
"build": {
"dockerfile": "../Dockerfile",
"target": "clang-cross"
}
}
7 changes: 7 additions & 0 deletions .devcontainer/llvm-mingw/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "llvm-mingw",
"build": {
"dockerfile": "../Dockerfile",
"target": "llvm-mingw"
}
}
7 changes: 7 additions & 0 deletions .devcontainer/mingw/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "mingw",
"build": {
"dockerfile": "../Dockerfile",
"target": "mingw"
}
}
103 changes: 36 additions & 67 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ on:
type: string
required: false

env:
LLVM_MINGW_VERSION: llvm-mingw-20240619-msvcrt-ubuntu-20.04-x86_64
LLVM_MINGW_DOWNLOAD: https://github.com/mstorsjo/llvm-mingw/releases/download/20240619/llvm-mingw-20240619-msvcrt-ubuntu-20.04-x86_64.tar.xz

jobs:
build-windows:
runs-on: windows-latest
Expand Down Expand Up @@ -62,87 +58,60 @@ jobs:
name: ${{ matrix.preset }}
path: out/install/${{ matrix.preset }}/


build-ubuntu:
runs-on: ubuntu-24.04
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
preset: [
"clang-cross-x86-release",
"clang-cross-x64-release",
"llvm-mingw-x86-release",
"llvm-mingw-x64-release",
"mingw-x86-release",
"mingw-x64-release",
]
toolchain:
- preset: clang-cross-x86-release
container: clang-cross
- preset: clang-cross-x64-release
container: clang-cross
- preset: llvm-mingw-x86-release
container: llvm-mingw
- preset: llvm-mingw-x64-release
container: llvm-mingw
- preset: mingw-x86-release
container: mingw
- preset: mingw-x64-release
container: mingw

steps:
- name: Setup CMake and Ninja
uses: lukka/get-cmake@latest

- name: Setup apt packages
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: msitools
version: ${{ runner.os }}-apt

- name: Setup LLVM MinGW
if: startswith(matrix.preset, 'llvm-mingw')
run: |
wget -nv ${{ env.LLVM_MINGW_DOWNLOAD }}
tar -xf ${{ env.LLVM_MINGW_VERSION }}.tar.xz -C ~/
echo $(readlink -f ~/${{ env.LLVM_MINGW_VERSION }}/bin) >> $GITHUB_PATH

- name: Setup MinGW
if: startswith(matrix.preset, 'mingw')
uses: egor-tensin/setup-mingw@v2
with:
platform: ${{ fromJSON('["x86", "x64"]')[contains(matrix.preset, 'x64')] }}

- name: Setup Clang
if: startswith(matrix.preset, 'clang-cross')
uses: egor-tensin/setup-clang@v1

- name: Restore win sdk cache
if: startswith(matrix.preset, 'clang-cross')
uses: actions/cache@v4
id: cache-win-sdk
with:
path: ~/win-sdk
key: ${{ runner.os }}-win-sdk

- name: Setup win sdk
if: startswith(matrix.preset, 'clang-cross') && steps.cache-win-sdk.outputs.cache-hit != 'true'
run: |
git clone https://github.com/mstorsjo/msvc-wine.git
msvc-wine/vsdownload.py --accept-license --dest ~/win-sdk Microsoft.VisualStudio.Workload.VCTools
msvc-wine/install.sh ~/win-sdk
rm -r msvc-wine

- name: Checkout repository and submodules
uses: actions/checkout@v4
with:
submodules: recursive

- name: Configure CMake
working-directory: ${{ env.GITHUB_WORKSPACE }}
# The extra msvc wine arg won't do anything if we're not cross compiling
run: >
cmake .
--preset ${{ matrix.preset }}
-G Ninja
-DMSVC_WINE_ENV_SCRIPT=$(readlink -f ~)/win-sdk/bin/${{ fromJSON('["x86", "x64"]')[contains(matrix.preset, 'x64')] }}/msvcenv.sh
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build
working-directory: ${{ env.GITHUB_WORKSPACE }}
run: cmake --build out/build/${{ matrix.preset }} --target install
uses: devcontainers/[email protected]
with:
cacheFrom: ghcr.io/bl-sdk/${{ matrix.toolchain.container }}:latest
configFile: .devcontainer/${{ matrix.toolchain.container }}/devcontainer.json
push: never
# The git watcher cmake thinks something's unsafe? Doesn't happen to me locally.
runCmd: |
git config --global --add safe.directory `pwd`

set -e

cmake . --preset ${{ matrix.toolchain.preset }} -G Ninja
cmake --build out/build/${{ matrix.toolchain.preset }} --target install

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.preset }}
path: out/install/${{ matrix.preset }}/
name: ${{ matrix.toolchain.preset }}
path: out/install/${{ matrix.toolchain.preset }}/

# ==============================================================================

Expand Down
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
.vs
.vscode
.idea

# C/C++ excludes
.cache/clangd
.gdbinit
out

# User scripts with templates
postbuild
postbuild.bat

# CMake (from https://github.com/github/gitignore/blob/main/CMake.gitignore)
CMakeLists.txt.user
CMakeCache.txt
Expand Down
9 changes: 9 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,14 @@ extend-exclude = [
".typos.toml"
]

[default]
extend-ignore-re = [
# Ignore markdown links to github commits/trees
"\\[[0-9a-fA-F]+?\\]\\(https://github.com/.+?/.+?/(commit|tree)/.+?\\)",
]

[default.extend-identifiers]
llibgcc_s_seh = "llibgcc_s_seh"

[default.extend-words]
UE = "UE"
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.24)

project(pluginloader VERSION 1.0.3)
project(pluginloader VERSION 1.0.4)

add_library(_pluginloader_base INTERFACE)
set(CMAKE_EXPORT_COMPILE_COMMANDS True)
Expand Down
6 changes: 6 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"cacheVariables": {
"MSVC_WINE_ENV_SCRIPT": "/win-sdk/bin/x86/msvcenv.sh"
},
"toolchainFile": "common_cmake/clang-cross-x86.cmake"
},
{
Expand All @@ -47,6 +50,9 @@
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"cacheVariables": {
"MSVC_WINE_ENV_SCRIPT": "/win-sdk/bin/x64/msvcenv.sh"
},
"toolchainFile": "common_cmake/clang-cross-x64.cmake"
},
{
Expand Down
7 changes: 7 additions & 0 deletions src/proxy/d3d11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ FARPROC d3d11_on_12_create_device_ptr = nullptr;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-function-type"
#endif
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wcast-function-type-mismatch"
#endif

DLL_EXPORT HRESULT D3D11CoreCreateDevice(void* fact,
void* adapt,
Expand Down Expand Up @@ -81,6 +85,9 @@ DLL_EXPORT HRESULT D3D11On12CreateDevice(void* pDevice,
ppDevice, ppImmediateContext, pChosenFeatureLevel);
}

#if defined(__clang__)
#pragma clang diagnostic pop
#endif
#if defined(__MINGW32__)
#pragma GCC diagnostic pop
#endif
Expand Down
Loading
Loading