From 0861b6aa4f5a23075dfcbb563d4291d652f04250 Mon Sep 17 00:00:00 2001 From: Dmitriy Date: Mon, 27 Oct 2025 14:36:29 +0400 Subject: [PATCH] Add support for linux and macos --- bindings/dotnet/Makefile | 13 +++++++++-- .../dotnet/src/Turso.Raw/Turso.Raw.csproj | 23 +++++++++++++++++-- bindings/dotnet/src/Turso.Raw/TursoInterop.cs | 11 +++++++-- .../dotnet/src/Turso.Tests/Turso.Tests.csproj | 2 -- 4 files changed, 41 insertions(+), 8 deletions(-) diff --git a/bindings/dotnet/Makefile b/bindings/dotnet/Makefile index caa2d2f17..d09acb8d0 100644 --- a/bindings/dotnet/Makefile +++ b/bindings/dotnet/Makefile @@ -1,14 +1,23 @@ all: echo "make [build|test|benchmark|build-production]" -build: +build-rust: cargo build --target-dir ./rs_compiled/ + +build-dotnet: dotnet build ./src/Turso/Turso.csproj -build-production: +build-rust-production: cargo build --release --target-dir ./rs_compiled/ + +build-dotnet-production: dotnet build -c Release ./src/Turso/Turso.csproj + +build: build-rust build-dotnet + +build-production: build-rust-production build-dotnet-production + test: build dotnet test ./src/Turso.Tests/Turso.Tests.csproj diff --git a/bindings/dotnet/src/Turso.Raw/Turso.Raw.csproj b/bindings/dotnet/src/Turso.Raw/Turso.Raw.csproj index 152b52adf..d7fa244a1 100644 --- a/bindings/dotnet/src/Turso.Raw/Turso.Raw.csproj +++ b/bindings/dotnet/src/Turso.Raw/Turso.Raw.csproj @@ -7,15 +7,34 @@ true + + OS_WINDOWS + + + OS_LINUX + + + OS_MAC + + Always - - + Always + + + Always + + + + + Always + + diff --git a/bindings/dotnet/src/Turso.Raw/TursoInterop.cs b/bindings/dotnet/src/Turso.Raw/TursoInterop.cs index d5172efae..48548ec20 100644 --- a/bindings/dotnet/src/Turso.Raw/TursoInterop.cs +++ b/bindings/dotnet/src/Turso.Raw/TursoInterop.cs @@ -6,8 +6,15 @@ namespace Turso.Raw; internal static class TursoInterop { - private const string DllName = "turso_dotnet.dll"; - + private const string DllName = +#if OS_WINDOWS + "turso_dotnet.dll"; +#elif OS_LINUX + "turso_dotnet.so"; +#elif OS_MAC + "turso_dotnet.dylib"; +#endif + [DllImport(DllName, EntryPoint = "db_open", CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr OpenDatabase(string path, out IntPtr errorPtr); diff --git a/bindings/dotnet/src/Turso.Tests/Turso.Tests.csproj b/bindings/dotnet/src/Turso.Tests/Turso.Tests.csproj index 346661967..fbcc1e957 100644 --- a/bindings/dotnet/src/Turso.Tests/Turso.Tests.csproj +++ b/bindings/dotnet/src/Turso.Tests/Turso.Tests.csproj @@ -23,9 +23,7 @@ - -