diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..38286b4
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,19 @@
+FROM ubuntu:24.04
+
+RUN apt-get update && \
+ apt-get install -y dotnet-sdk-8.0 python3 git build-essential
+
+WORKDIR /tmp
+COPY .config/dotnet-tools.json .config/dotnet-tools.json
+COPY SDL3-CS/SDL3-CS.csproj SDL3-CS/SDL3-CS.csproj
+RUN dotnet tool restore && \
+ dotnet restore --ucr SDL3-CS/SDL3-CS.csproj
+
+WORKDIR /
+RUN echo '#!/bin/bash' >> entrypoint.sh && \
+ echo 'export LD_LIBRARY_PATH="$(echo ~/.nuget/packages/libclang.runtime.*/*/runtimes/*/native):$(echo ~/.nuget/packages/libclangsharp.runtime.*/*/runtimes/*/native):${LD_LIBRARY_PATH:-}"' >> entrypoint.sh && \
+ echo 'export CPLUS_INCLUDE_PATH="$(echo /usr/lib/gcc/*/*/include):/usr/include:${CPLUS_INCLUDE_PATH:-}"' >> entrypoint.sh && \
+ echo 'python3 SDL3-CS/generate_bindings.py "$@"' >> entrypoint.sh && \
+ chmod +x entrypoint.sh
+
+ENTRYPOINT ["/entrypoint.sh"]
\ No newline at end of file
diff --git a/SDL3-CS/SDL3-CS.csproj b/SDL3-CS/SDL3-CS.csproj
index 04e55fd..dd15bdd 100644
--- a/SDL3-CS/SDL3-CS.csproj
+++ b/SDL3-CS/SDL3-CS.csproj
@@ -25,7 +25,15 @@
-
+
+
+
+ all
+
+
+
+ all
+
diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs
index addb1b8..de63476 100644
--- a/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs
+++ b/SDL3-CS/SDL3/ClangSharp/SDL_audio.g.cs
@@ -28,7 +28,6 @@ using System.Runtime.InteropServices;
namespace SDL
{
- [NativeTypeName("int")]
public enum SDL_AudioFormat : uint
{
SDL_AUDIO_UNKNOWN = 0x0000U,
diff --git a/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs b/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs
index b963cec..aae40df 100644
--- a/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs
+++ b/SDL3-CS/SDL3/ClangSharp/SDL_pixels.g.cs
@@ -89,7 +89,6 @@ namespace SDL
SDL_PACKEDLAYOUT_1010102,
}
- [NativeTypeName("int")]
public enum SDL_PixelFormat : uint
{
SDL_PIXELFORMAT_UNKNOWN = 0,
@@ -240,7 +239,6 @@ namespace SDL
SDL_CHROMA_LOCATION_TOPLEFT = 3,
}
- [NativeTypeName("int")]
public enum SDL_Colorspace : uint
{
SDL_COLORSPACE_UNKNOWN = 0,
diff --git a/SDL3-CS/SDL3/SDL_stdinc.rsp b/SDL3-CS/SDL3/SDL_stdinc.rsp
index a4253b3..9dd6b9a 100644
--- a/SDL3-CS/SDL3/SDL_stdinc.rsp
+++ b/SDL3-CS/SDL3/SDL_stdinc.rsp
@@ -6,6 +6,7 @@
SDL_SLOW_MEMCPY
SDL_SLOW_MEMMOVE
SDL_SLOW_MEMSET
+SDL_DISABLE_ALLOCA
# Prevent SDL from using compiler intrinsics __builtin_mul_overflow and __builtin_add_overflow.
--additional
diff --git a/SDL3-CS/generate_bindings.py b/SDL3-CS/generate_bindings.py
index 90f3239..d855256 100644
--- a/SDL3-CS/generate_bindings.py
+++ b/SDL3-CS/generate_bindings.py
@@ -24,6 +24,7 @@ Example:
import json
import pathlib
+import platform
import re
import subprocess
import sys
@@ -260,6 +261,13 @@ base_command = [
"char=byte",
"wchar_t *=IntPtr", # wchar_t has a platform-defined size
"bool=SDLBool", # treat bool as C# helper type
+ "__va_list=byte*",
+ "__va_list_tag=byte",
+ "Sint64=long",
+ "Uint64=ulong",
+
+ "--with-type",
+ "*=int", # all enum types should be ints by default
"--nativeTypeNamesToStrip",
"unsigned int",
@@ -268,9 +276,18 @@ base_command = [
"SDL_FUNCTION_POINTER_IS_VOID_POINTER",
"SDL_SINT64_C(c)=c ## LL",
"SDL_UINT64_C(c)=c ## ULL",
+ "SDL_DECLSPEC=", # Not supported by llvm
+ # Undefine platform-specific macros - these will be defined on a per-case basis later.
"--additional",
"--undefine-macro=_WIN32",
+ "--undefine-macro=linux",
+ "--undefine-macro=__linux",
+ "--undefine-macro=__linux__",
+ "--undefine-macro=unix",
+ "--undefine-macro=__unix",
+ "--undefine-macro=__unix__",
+ "--undefine-macro=__APPLE__",
]
@@ -346,6 +363,11 @@ def should_skip(solo_headers: list[Header], header: Header):
def main():
solo_headers = [make_header_fuzzy(header_name) for header_name in sys.argv[1:]]
+ if platform.system() != "Windows":
+ base_command.extend([
+ "--include-directory", csproj_root / "include"
+ ])
+
prepare_sdl_source()
sdl_api = get_sdl_api_dump()
diff --git a/SDL3-CS/include/process.h b/SDL3-CS/include/process.h
new file mode 100644
index 0000000..9791d02
--- /dev/null
+++ b/SDL3-CS/include/process.h
@@ -0,0 +1 @@
+// dummy process.h when building for SDL_PLATFORM_WINDOWS on non-windows systems