mirror of https://github.com/ppy/SDL3-CS.git
Add dockerfile + generation wrapper script
This commit is contained in:
parent
ee98235385
commit
5227b62690
|
|
@ -0,0 +1,11 @@
|
||||||
|
FROM ubuntu:24.04
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
dotnet-sdk-8.0 \
|
||||||
|
python3 \
|
||||||
|
git \
|
||||||
|
build-essential
|
||||||
|
|
||||||
|
RUN ln -s /usr/bin/python3 /usr/bin/python
|
||||||
|
|
||||||
|
SHELL ["/bin/bash", "-c"]
|
||||||
|
|
@ -26,6 +26,14 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0"/>
|
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0"/>
|
||||||
|
|
||||||
|
<PackageReference Include="libclang" Version="17.0.4">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
</PackageReference>
|
||||||
|
|
||||||
|
<PackageReference Include="libClangSharp" Version="17.0.4">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
SDL_SLOW_MEMCPY
|
SDL_SLOW_MEMCPY
|
||||||
SDL_SLOW_MEMMOVE
|
SDL_SLOW_MEMMOVE
|
||||||
SDL_SLOW_MEMSET
|
SDL_SLOW_MEMSET
|
||||||
|
SDL_DISABLE_ALLOCA
|
||||||
|
|
||||||
# Prevent SDL from using compiler intrinsics __builtin_mul_overflow and __builtin_add_overflow.
|
# Prevent SDL from using compiler intrinsics __builtin_mul_overflow and __builtin_add_overflow.
|
||||||
--additional
|
--additional
|
||||||
|
|
|
||||||
|
|
@ -260,12 +260,27 @@ base_command = [
|
||||||
"char=byte",
|
"char=byte",
|
||||||
"wchar_t *=IntPtr", # wchar_t has a platform-defined size
|
"wchar_t *=IntPtr", # wchar_t has a platform-defined size
|
||||||
"bool=SDLBool", # treat bool as C# helper type
|
"bool=SDLBool", # treat bool as C# helper type
|
||||||
|
"__va_list=byte*",
|
||||||
|
|
||||||
"--define-macro",
|
"--define-macro",
|
||||||
"SDL_FUNCTION_POINTER_IS_VOID_POINTER",
|
"SDL_FUNCTION_POINTER_IS_VOID_POINTER",
|
||||||
|
"SDL_DECLSPEC=", # Not supported by llvm
|
||||||
|
|
||||||
|
# Undefine platform-specific macros - these will be defined on a per-case basis later.
|
||||||
"--additional",
|
"--additional",
|
||||||
"--undefine-macro=_WIN32",
|
"--undefine-macro=_WIN32",
|
||||||
|
"--undefine-macro=linux",
|
||||||
|
"--undefine-macro=__linux",
|
||||||
|
"--undefine-macro=__linux__",
|
||||||
|
"--undefine-macro=unix",
|
||||||
|
"--undefine-macro=__unix",
|
||||||
|
"--undefine-macro=__unix__",
|
||||||
|
"--undefine-macro=__APPLE__",
|
||||||
|
# GCC and LLVM use `long int` => int64, whereas MSVC uses `long long int` => int64.
|
||||||
|
# In terms of C# code gen, it's more accurate if we disable these to force LL, so
|
||||||
|
# that they're transformed to longs instead of ints.
|
||||||
|
"--undefine-macro=__LP64__",
|
||||||
|
"--undefine-macro=_LP64",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
pushd "$(dirname "$0")/../" >/dev/null
|
||||||
|
|
||||||
|
dotnet tool restore
|
||||||
|
dotnet restore --ucr SDL3-CS/SDL3-CS.csproj
|
||||||
|
|
||||||
|
export LD_LIBRARY_PATH="$(echo ~/.nuget/packages/libclang.runtime.*/*/runtimes/*/native):$(echo ~/.nuget/packages/libclangsharp.runtime.*/*/runtimes/*/native):${LD_LIBRARY_PATH:-}"
|
||||||
|
export CPLUS_INCLUDE_PATH="$(echo /usr/lib/gcc/*/*/include):/usr/include:${CPLUS_INCLUDE_PATH:-}"
|
||||||
|
|
||||||
|
python3 SDL3-CS/generate_bindings.py
|
||||||
|
|
||||||
|
popd >/dev/null
|
||||||
Loading…
Reference in New Issue