From c46dd91c170fc6aeb757e4732e7b0f504a77e660 Mon Sep 17 00:00:00 2001 From: glopesdev Date: Tue, 15 Jun 2021 09:54:28 +0100 Subject: [PATCH 1/3] Add support for nuget package generation Fixes #2 --- Directory.Build.props | 8 -------- examples/Directory.Build.props | 7 +++++-- liblsl.csproj | 11 ++++++++++- runtimes/README.md | 3 +++ 4 files changed, 18 insertions(+), 11 deletions(-) delete mode 100644 Directory.Build.props create mode 100644 runtimes/README.md diff --git a/Directory.Build.props b/Directory.Build.props deleted file mode 100644 index 84e162b..0000000 --- a/Directory.Build.props +++ /dev/null @@ -1,8 +0,0 @@ - - - Christian Kothe - netstandard2.0 - 1.12.2 - - - diff --git a/examples/Directory.Build.props b/examples/Directory.Build.props index 7a68623..b57ab75 100644 --- a/examples/Directory.Build.props +++ b/examples/Directory.Build.props @@ -1,6 +1,9 @@ - + Christian Kothe + netstandard2.0 + 1.12.2 8.0 - \ No newline at end of file + + diff --git a/liblsl.csproj b/liblsl.csproj index 9e7f251..0b9263b 100644 --- a/liblsl.csproj +++ b/liblsl.csproj @@ -7,6 +7,15 @@ 2.0 $(DefaultItemExcludes);examples/** lsl_csharp + Copyright © Christian Kothe 2021 + https://github.com/labstreaminglayer/liblsl-Csharp + MIT + LSL Lab Streaming Layer + true + win-x86;win-x64;osx-x64;linux-x64 - + + + + diff --git a/runtimes/README.md b/runtimes/README.md new file mode 100644 index 0000000..ccc3e7e --- /dev/null +++ b/runtimes/README.md @@ -0,0 +1,3 @@ +# Runtime Identifier Dependencies + +The NuGet package for the C# bindings includes binary distributions for major platform runtimes targeted by [liblsl](https://github.com/sccn/liblsl). To successfully build the package, these binaries need to be downloaded from [liblsl releases](https://github.com/sccn/liblsl/releases) and included in this folder following the RID naming conventions outlined in the [RID Catalog](https://docs.microsoft.com/en-us/dotnet/core/rid-catalog). \ No newline at end of file From 0f1627d47ad2dfc0d9d65bd00ee639657061d3df Mon Sep 17 00:00:00 2001 From: glopesdev Date: Wed, 16 Jun 2021 20:51:37 +0100 Subject: [PATCH 2/3] Add docs for architecture-specific folders --- runtimes/README.md | 64 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/runtimes/README.md b/runtimes/README.md index ccc3e7e..b275674 100644 --- a/runtimes/README.md +++ b/runtimes/README.md @@ -1,3 +1,65 @@ # Runtime Identifier Dependencies -The NuGet package for the C# bindings includes binary distributions for major platform runtimes targeted by [liblsl](https://github.com/sccn/liblsl). To successfully build the package, these binaries need to be downloaded from [liblsl releases](https://github.com/sccn/liblsl/releases) and included in this folder following the RID naming conventions outlined in the [RID Catalog](https://docs.microsoft.com/en-us/dotnet/core/rid-catalog). \ No newline at end of file +The NuGet package for the C# bindings includes binary distributions for major platform runtimes targeted by [liblsl](https://github.com/sccn/liblsl). To successfully build the package, these binaries need to be downloaded from [liblsl releases](https://github.com/sccn/liblsl/releases) and included in this folder following the RID naming conventions outlined in the [RID Catalog](https://docs.microsoft.com/en-us/dotnet/core/rid-catalog). + +The following [architecture-specific folders](https://docs.microsoft.com/en-us/nuget/create-packages/supporting-multiple-target-frameworks#architecture-specific-folders) are recommended: + +``` +\runtimes + \linux-x64 + \native + liblsl.so + liblsl.so.1.14.0 + \osx-x64 + \native + liblsl.dylib + liblsl.1.14.0.dylib + \win-x64 + \native + lsl.dll + \win-x86 + \native + lsl.dll +``` + +## Project files for dependent projects + +From Visual Studio 2019, both .NET Core (`dotnet`) and .NET Framework compilers will use the `RuntimeIdentifier` element of the new SDK csproj format to control which native dependencies to deploy to the final output folder. + +### .NET Core +In .NET Core, the default is to generate cross-platform deployments, which means that all the runtimes will be deployed to the final output folder. By inserting a specific `RuntimeIdentifier` a build targeting only the specified architecture is generated. + +```xml + + + + Exe + net5.0 + + + + + + + + +``` + +### .NET Framework +In legacy .NET framework projects, `RuntimeIdentifier` defaults to `win7-x86` which has the generic fallback to `win-x86`. Therefore, the above folder structure will automatically copy `lsl.dll` into the output folder of .NET Framework projects. + +```xml + + + + Exe + net472 + + + + + + + + +``` \ No newline at end of file From 02f845ac10945394657fe7a5de0604c0b08a4f83 Mon Sep 17 00:00:00 2001 From: myd7349 Date: Sat, 29 Mar 2025 17:15:22 +0800 Subject: [PATCH 3/3] Add NuGet packaging support --- .editorconfig | 17 ++- .github/workflows/dotnet-core.yaml | 29 ---- .github/workflows/dotnet.yaml | 88 +++++++++++ Directory.Build.props | 18 +++ Directory.Packages.props | 14 ++ liblsl.sln => LSL.Net.sln | 139 ++++++++++++------ README.md | 36 +++-- examples/Directory.Build.props | 26 +++- examples/HandleMetaData/HandleMetaData.csproj | 9 -- examples/LSLExamples.csproj | 18 --- examples/LSLExamples/LSLExamples.csproj | 12 ++ examples/{ => LSLExamples}/Main.cs | 0 examples/LSLVer/LSLVer.cs | 15 ++ examples/LSLVer/LSLVer.csproj | 2 + examples/ReceiveData/ReceiveData.csproj | 10 -- .../ReceiveDataInChunks.csproj | 10 -- .../ReceiveStringMarkers.csproj | 10 -- examples/SendData/SendData.csproj | 10 -- .../SendDataInChunks/SendDataInChunks.csproj | 10 -- .../SendStringMarkers.csproj | 10 -- img/vs2019_lsl_props.PNG | Bin 13342 -> 0 bytes liblsl.csproj | 21 --- runtimes/README.md | 65 -------- src/Directory.Build.props | 17 +++ src/LSL.Net.runtime/CopyNativeLib.targets | 47 ++++++ src/LSL.Net.runtime/Directory.Build.props | 28 ++++ src/LSL.Net.runtime/Directory.Build.targets | 74 ++++++++++ src/LSL.Net.runtime/LICENSE | 15 ++ src/LSL.Net.runtime/README.md | 75 ++++++++++ .../win-x64/LSL.Net.runtime.win-x64.csproj | 15 ++ .../net35/LSL.Net.runtime.win-x64.targets | 21 +++ .../win-x86/LSL.Net.runtime.win-x86.csproj | 15 ++ .../net35/LSL.Net.runtime.win-x86.targets | 21 +++ src/LSL.Net.slnf | 10 ++ src/LSL.Net/LSL.Net.csproj | 29 ++++ LSL.cs => src/LSL.Net/LSL.cs | 33 +++++ 36 files changed, 705 insertions(+), 264 deletions(-) delete mode 100644 .github/workflows/dotnet-core.yaml create mode 100644 .github/workflows/dotnet.yaml create mode 100644 Directory.Build.props create mode 100644 Directory.Packages.props rename liblsl.sln => LSL.Net.sln (63%) delete mode 100644 examples/LSLExamples.csproj create mode 100644 examples/LSLExamples/LSLExamples.csproj rename examples/{ => LSLExamples}/Main.cs (100%) create mode 100644 examples/LSLVer/LSLVer.cs create mode 100644 examples/LSLVer/LSLVer.csproj delete mode 100644 img/vs2019_lsl_props.PNG delete mode 100644 liblsl.csproj delete mode 100644 runtimes/README.md create mode 100644 src/Directory.Build.props create mode 100644 src/LSL.Net.runtime/CopyNativeLib.targets create mode 100644 src/LSL.Net.runtime/Directory.Build.props create mode 100644 src/LSL.Net.runtime/Directory.Build.targets create mode 100644 src/LSL.Net.runtime/LICENSE create mode 100644 src/LSL.Net.runtime/README.md create mode 100644 src/LSL.Net.runtime/win-x64/LSL.Net.runtime.win-x64.csproj create mode 100644 src/LSL.Net.runtime/win-x64/build/net35/LSL.Net.runtime.win-x64.targets create mode 100644 src/LSL.Net.runtime/win-x86/LSL.Net.runtime.win-x86.csproj create mode 100644 src/LSL.Net.runtime/win-x86/build/net35/LSL.Net.runtime.win-x86.targets create mode 100644 src/LSL.Net.slnf create mode 100644 src/LSL.Net/LSL.Net.csproj rename LSL.cs => src/LSL.Net/LSL.cs (98%) diff --git a/.editorconfig b/.editorconfig index d3422af..826d0fe 100644 --- a/.editorconfig +++ b/.editorconfig @@ -4,10 +4,23 @@ ############################### # All files [*] +charset = utf8 +indent_style = space indent_size = 4 insert_final_newline = true -charset = utf -indent_style = space +trim_trailing_whitespace = true + +############################### +# File Extension Settings # +############################### + +# Visual Studio Solution Files +[*.sln] +indent_style = tab + +# Visual Studio XML Project Files +[*.{csproj,vbproj,vcxproj.filters,proj,projitems,shproj}] +indent_size = 2 [*.{cs,csx,vb,vbx}] diff --git a/.github/workflows/dotnet-core.yaml b/.github/workflows/dotnet-core.yaml deleted file mode 100644 index 8fc56b0..0000000 --- a/.github/workflows/dotnet-core.yaml +++ /dev/null @@ -1,29 +0,0 @@ -name: .NET Core - -on: - push: - branches: '*' - pull_request: - branches: [ master ] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Install .NET Core - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 5.x - - name: Build and package liblsl - run: dotnet pack -c Release liblsl.csproj -o pkg - - name: Build and package examples - run: dotnet pack -c Release examples/LSLExamples.csproj -o pkg -# - name: Run examples -# run: dotnet run -p examples/LSLExamples.csproj - - name: Upload build artifacts - uses: actions/upload-artifact@v1 - with: - name: nuget pkg - path: pkg diff --git a/.github/workflows/dotnet.yaml b/.github/workflows/dotnet.yaml new file mode 100644 index 0000000..265b2ad --- /dev/null +++ b/.github/workflows/dotnet.yaml @@ -0,0 +1,88 @@ +name: LSL.Net + +on: + pull_request: + push: + branches: '*' + workflow_dispatch: + release: + types: [ published ] + +jobs: + build: + name: Build-${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ ubuntu-latest, windows-latest, macOS-latest ] + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install .NET SDK + uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + 5.0.x + 6.0.x + + - name: List installed .NET SDKs + run: dotnet --list-sdks + + - name: Build + run: dotnet build -c Release LSL.Net.sln + + - name: Pack + run: dotnet pack -c Release src/LSL.Net.slnf + + - name: Setup library path + if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }} + run: | + echo ${{ github.workspace }} + uname -a + if [[ "$OSTYPE" == "darwin"* ]]; then + echo "DYLD_LIBRARY_PATH=${{ github.workspace }}/examples/LSLVer/bin/Release/net6.0" >> "$GITHUB_ENV" + else + echo "LD_LIBRARY_PATH=${{ github.workspace }}/examples/LSLVer/bin/Release/net6.0" >> "$GITHUB_ENV" + fi + + - name: Run LSLVer + # LSL.Net.runtime for linux and macOS is not yet landed. + if: ${{ runner.os == 'Windows' }} + run: dotnet run -c Release -p examples/LSLVer/LSLVer.csproj -f net6.0 + + - name: Upload build artifacts + if: ${{ runner.os == 'Linux' }} + uses: actions/upload-artifact@v4 + with: + name: nuget-packages + path: "**/*.*nupkg" + + publish: + name: Publish + runs-on: ubuntu-latest + needs: build + if: github.event_name == 'release' + steps: + - name: Install .NET SDK + uses: actions/setup-dotnet@v4 + + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + name: nuget-packages + + - name: Push NuGet packages + run: | + dotnet nuget push **/*.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json + + - name: Release + uses: softprops/action-gh-release@v2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + generate_release_notes: true + files: | + **/*.nupkg + **/*.snupkg diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..8378018 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,18 @@ + + + net35;netstandard2.0;net5.0;net6.0 + latest + true + true + true + false + true + 1.16.2-preview.1 + + + + Christian Kothe + Christian Kothe + Copyright © Christian Kothe 2021-2025 + + diff --git a/Directory.Packages.props b/Directory.Packages.props new file mode 100644 index 0000000..294f949 --- /dev/null +++ b/Directory.Packages.props @@ -0,0 +1,14 @@ + + + true + + + + + + + + \ No newline at end of file diff --git a/liblsl.sln b/LSL.Net.sln similarity index 63% rename from liblsl.sln rename to LSL.Net.sln index 56fc09e..d6df6c9 100644 --- a/liblsl.sln +++ b/LSL.Net.sln @@ -1,10 +1,8 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29609.76 +# Visual Studio Version 17 +VisualStudioVersion = 17.12.35728.132 MinimumVisualStudioVersion = 15.0.26124.0 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "liblsl", "liblsl.csproj", "{9CF380F5-EB84-4A39-969E-7E6F5534F17F}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{2831BC99-EB85-43AC-AEDF-8A689B8268FC}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HandleMetaData", "examples\HandleMetaData\HandleMetaData.csproj", "{55625B73-07CD-4C9F-ABFB-FB3C5899A79F}" @@ -21,6 +19,18 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SendDataInChunks", "example EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SendStringMarkers", "examples\SendStringMarkers\SendStringMarkers.csproj", "{0847C79E-E4BD-4B67-8DB7-6873415815A6}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E771A42F-A73C-4C1E-B50E-58CA0A6A2113}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LSL.Net", "src\LSL.Net\LSL.Net.csproj", "{AFD9C248-E42F-4C6E-829E-712096292FE7}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "runtimes", "runtimes", "{55693EBC-5165-42D3-A433-69A4503F8867}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LSL.Net.runtime.win-x64", "src\LSL.Net.runtime\win-x64\LSL.Net.runtime.win-x64.csproj", "{C310E070-EA3B-4E65-A00B-549B980F0881}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LSL.Net.runtime.win-x86", "src\LSL.Net.runtime\win-x86\LSL.Net.runtime.win-x86.csproj", "{A2D6D146-96BF-431C-AEF8-3C21CC60206A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LSLVer", "examples\LSLVer\LSLVer.csproj", "{96CF8C5B-D343-4ECF-AC40-1F87891F046B}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -31,24 +41,12 @@ Global Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {9CF380F5-EB84-4A39-969E-7E6F5534F17F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9CF380F5-EB84-4A39-969E-7E6F5534F17F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9CF380F5-EB84-4A39-969E-7E6F5534F17F}.Debug|x64.ActiveCfg = Debug|Any CPU - {9CF380F5-EB84-4A39-969E-7E6F5534F17F}.Debug|x64.Build.0 = Debug|Any CPU - {9CF380F5-EB84-4A39-969E-7E6F5534F17F}.Debug|x86.ActiveCfg = Debug|Any CPU - {9CF380F5-EB84-4A39-969E-7E6F5534F17F}.Debug|x86.Build.0 = Debug|Any CPU - {9CF380F5-EB84-4A39-969E-7E6F5534F17F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9CF380F5-EB84-4A39-969E-7E6F5534F17F}.Release|Any CPU.Build.0 = Release|Any CPU - {9CF380F5-EB84-4A39-969E-7E6F5534F17F}.Release|x64.ActiveCfg = Release|Any CPU - {9CF380F5-EB84-4A39-969E-7E6F5534F17F}.Release|x64.Build.0 = Release|Any CPU - {9CF380F5-EB84-4A39-969E-7E6F5534F17F}.Release|x86.ActiveCfg = Release|Any CPU - {9CF380F5-EB84-4A39-969E-7E6F5534F17F}.Release|x86.Build.0 = Release|Any CPU {55625B73-07CD-4C9F-ABFB-FB3C5899A79F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {55625B73-07CD-4C9F-ABFB-FB3C5899A79F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {55625B73-07CD-4C9F-ABFB-FB3C5899A79F}.Debug|x64.ActiveCfg = Debug|Any CPU - {55625B73-07CD-4C9F-ABFB-FB3C5899A79F}.Debug|x64.Build.0 = Debug|Any CPU - {55625B73-07CD-4C9F-ABFB-FB3C5899A79F}.Debug|x86.ActiveCfg = Debug|Any CPU - {55625B73-07CD-4C9F-ABFB-FB3C5899A79F}.Debug|x86.Build.0 = Debug|Any CPU + {55625B73-07CD-4C9F-ABFB-FB3C5899A79F}.Debug|x64.ActiveCfg = Debug|x64 + {55625B73-07CD-4C9F-ABFB-FB3C5899A79F}.Debug|x64.Build.0 = Debug|x64 + {55625B73-07CD-4C9F-ABFB-FB3C5899A79F}.Debug|x86.ActiveCfg = Debug|x86 + {55625B73-07CD-4C9F-ABFB-FB3C5899A79F}.Debug|x86.Build.0 = Debug|x86 {55625B73-07CD-4C9F-ABFB-FB3C5899A79F}.Release|Any CPU.ActiveCfg = Release|Any CPU {55625B73-07CD-4C9F-ABFB-FB3C5899A79F}.Release|Any CPU.Build.0 = Release|Any CPU {55625B73-07CD-4C9F-ABFB-FB3C5899A79F}.Release|x64.ActiveCfg = Release|Any CPU @@ -57,10 +55,10 @@ Global {55625B73-07CD-4C9F-ABFB-FB3C5899A79F}.Release|x86.Build.0 = Release|Any CPU {98F76BEE-C774-44C0-BAF3-BFF4B429420B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {98F76BEE-C774-44C0-BAF3-BFF4B429420B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {98F76BEE-C774-44C0-BAF3-BFF4B429420B}.Debug|x64.ActiveCfg = Debug|Any CPU - {98F76BEE-C774-44C0-BAF3-BFF4B429420B}.Debug|x64.Build.0 = Debug|Any CPU - {98F76BEE-C774-44C0-BAF3-BFF4B429420B}.Debug|x86.ActiveCfg = Debug|Any CPU - {98F76BEE-C774-44C0-BAF3-BFF4B429420B}.Debug|x86.Build.0 = Debug|Any CPU + {98F76BEE-C774-44C0-BAF3-BFF4B429420B}.Debug|x64.ActiveCfg = Debug|x64 + {98F76BEE-C774-44C0-BAF3-BFF4B429420B}.Debug|x64.Build.0 = Debug|x64 + {98F76BEE-C774-44C0-BAF3-BFF4B429420B}.Debug|x86.ActiveCfg = Debug|x86 + {98F76BEE-C774-44C0-BAF3-BFF4B429420B}.Debug|x86.Build.0 = Debug|x86 {98F76BEE-C774-44C0-BAF3-BFF4B429420B}.Release|Any CPU.ActiveCfg = Release|Any CPU {98F76BEE-C774-44C0-BAF3-BFF4B429420B}.Release|Any CPU.Build.0 = Release|Any CPU {98F76BEE-C774-44C0-BAF3-BFF4B429420B}.Release|x64.ActiveCfg = Release|Any CPU @@ -69,10 +67,10 @@ Global {98F76BEE-C774-44C0-BAF3-BFF4B429420B}.Release|x86.Build.0 = Release|Any CPU {A0EF1C60-7461-415B-9C98-F28A3283258A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A0EF1C60-7461-415B-9C98-F28A3283258A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A0EF1C60-7461-415B-9C98-F28A3283258A}.Debug|x64.ActiveCfg = Debug|Any CPU - {A0EF1C60-7461-415B-9C98-F28A3283258A}.Debug|x64.Build.0 = Debug|Any CPU - {A0EF1C60-7461-415B-9C98-F28A3283258A}.Debug|x86.ActiveCfg = Debug|Any CPU - {A0EF1C60-7461-415B-9C98-F28A3283258A}.Debug|x86.Build.0 = Debug|Any CPU + {A0EF1C60-7461-415B-9C98-F28A3283258A}.Debug|x64.ActiveCfg = Debug|x64 + {A0EF1C60-7461-415B-9C98-F28A3283258A}.Debug|x64.Build.0 = Debug|x64 + {A0EF1C60-7461-415B-9C98-F28A3283258A}.Debug|x86.ActiveCfg = Debug|x86 + {A0EF1C60-7461-415B-9C98-F28A3283258A}.Debug|x86.Build.0 = Debug|x86 {A0EF1C60-7461-415B-9C98-F28A3283258A}.Release|Any CPU.ActiveCfg = Release|Any CPU {A0EF1C60-7461-415B-9C98-F28A3283258A}.Release|Any CPU.Build.0 = Release|Any CPU {A0EF1C60-7461-415B-9C98-F28A3283258A}.Release|x64.ActiveCfg = Release|Any CPU @@ -81,10 +79,10 @@ Global {A0EF1C60-7461-415B-9C98-F28A3283258A}.Release|x86.Build.0 = Release|Any CPU {8AB092B9-F671-4185-BB6C-543B6A2AE55A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8AB092B9-F671-4185-BB6C-543B6A2AE55A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8AB092B9-F671-4185-BB6C-543B6A2AE55A}.Debug|x64.ActiveCfg = Debug|Any CPU - {8AB092B9-F671-4185-BB6C-543B6A2AE55A}.Debug|x64.Build.0 = Debug|Any CPU - {8AB092B9-F671-4185-BB6C-543B6A2AE55A}.Debug|x86.ActiveCfg = Debug|Any CPU - {8AB092B9-F671-4185-BB6C-543B6A2AE55A}.Debug|x86.Build.0 = Debug|Any CPU + {8AB092B9-F671-4185-BB6C-543B6A2AE55A}.Debug|x64.ActiveCfg = Debug|x64 + {8AB092B9-F671-4185-BB6C-543B6A2AE55A}.Debug|x64.Build.0 = Debug|x64 + {8AB092B9-F671-4185-BB6C-543B6A2AE55A}.Debug|x86.ActiveCfg = Debug|x86 + {8AB092B9-F671-4185-BB6C-543B6A2AE55A}.Debug|x86.Build.0 = Debug|x86 {8AB092B9-F671-4185-BB6C-543B6A2AE55A}.Release|Any CPU.ActiveCfg = Release|Any CPU {8AB092B9-F671-4185-BB6C-543B6A2AE55A}.Release|Any CPU.Build.0 = Release|Any CPU {8AB092B9-F671-4185-BB6C-543B6A2AE55A}.Release|x64.ActiveCfg = Release|Any CPU @@ -93,10 +91,10 @@ Global {8AB092B9-F671-4185-BB6C-543B6A2AE55A}.Release|x86.Build.0 = Release|Any CPU {4DB5312C-5B29-4725-8EA0-3458AC36FB08}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4DB5312C-5B29-4725-8EA0-3458AC36FB08}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4DB5312C-5B29-4725-8EA0-3458AC36FB08}.Debug|x64.ActiveCfg = Debug|Any CPU - {4DB5312C-5B29-4725-8EA0-3458AC36FB08}.Debug|x64.Build.0 = Debug|Any CPU - {4DB5312C-5B29-4725-8EA0-3458AC36FB08}.Debug|x86.ActiveCfg = Debug|Any CPU - {4DB5312C-5B29-4725-8EA0-3458AC36FB08}.Debug|x86.Build.0 = Debug|Any CPU + {4DB5312C-5B29-4725-8EA0-3458AC36FB08}.Debug|x64.ActiveCfg = Debug|x64 + {4DB5312C-5B29-4725-8EA0-3458AC36FB08}.Debug|x64.Build.0 = Debug|x64 + {4DB5312C-5B29-4725-8EA0-3458AC36FB08}.Debug|x86.ActiveCfg = Debug|x86 + {4DB5312C-5B29-4725-8EA0-3458AC36FB08}.Debug|x86.Build.0 = Debug|x86 {4DB5312C-5B29-4725-8EA0-3458AC36FB08}.Release|Any CPU.ActiveCfg = Release|Any CPU {4DB5312C-5B29-4725-8EA0-3458AC36FB08}.Release|Any CPU.Build.0 = Release|Any CPU {4DB5312C-5B29-4725-8EA0-3458AC36FB08}.Release|x64.ActiveCfg = Release|Any CPU @@ -105,10 +103,10 @@ Global {4DB5312C-5B29-4725-8EA0-3458AC36FB08}.Release|x86.Build.0 = Release|Any CPU {4763E2F5-B238-4896-AC52-217555ACFF2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4763E2F5-B238-4896-AC52-217555ACFF2A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4763E2F5-B238-4896-AC52-217555ACFF2A}.Debug|x64.ActiveCfg = Debug|Any CPU - {4763E2F5-B238-4896-AC52-217555ACFF2A}.Debug|x64.Build.0 = Debug|Any CPU - {4763E2F5-B238-4896-AC52-217555ACFF2A}.Debug|x86.ActiveCfg = Debug|Any CPU - {4763E2F5-B238-4896-AC52-217555ACFF2A}.Debug|x86.Build.0 = Debug|Any CPU + {4763E2F5-B238-4896-AC52-217555ACFF2A}.Debug|x64.ActiveCfg = Debug|x64 + {4763E2F5-B238-4896-AC52-217555ACFF2A}.Debug|x64.Build.0 = Debug|x64 + {4763E2F5-B238-4896-AC52-217555ACFF2A}.Debug|x86.ActiveCfg = Debug|x86 + {4763E2F5-B238-4896-AC52-217555ACFF2A}.Debug|x86.Build.0 = Debug|x86 {4763E2F5-B238-4896-AC52-217555ACFF2A}.Release|Any CPU.ActiveCfg = Release|Any CPU {4763E2F5-B238-4896-AC52-217555ACFF2A}.Release|Any CPU.Build.0 = Release|Any CPU {4763E2F5-B238-4896-AC52-217555ACFF2A}.Release|x64.ActiveCfg = Release|Any CPU @@ -117,16 +115,64 @@ Global {4763E2F5-B238-4896-AC52-217555ACFF2A}.Release|x86.Build.0 = Release|Any CPU {0847C79E-E4BD-4B67-8DB7-6873415815A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0847C79E-E4BD-4B67-8DB7-6873415815A6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0847C79E-E4BD-4B67-8DB7-6873415815A6}.Debug|x64.ActiveCfg = Debug|Any CPU - {0847C79E-E4BD-4B67-8DB7-6873415815A6}.Debug|x64.Build.0 = Debug|Any CPU - {0847C79E-E4BD-4B67-8DB7-6873415815A6}.Debug|x86.ActiveCfg = Debug|Any CPU - {0847C79E-E4BD-4B67-8DB7-6873415815A6}.Debug|x86.Build.0 = Debug|Any CPU + {0847C79E-E4BD-4B67-8DB7-6873415815A6}.Debug|x64.ActiveCfg = Debug|x64 + {0847C79E-E4BD-4B67-8DB7-6873415815A6}.Debug|x64.Build.0 = Debug|x64 + {0847C79E-E4BD-4B67-8DB7-6873415815A6}.Debug|x86.ActiveCfg = Debug|x86 + {0847C79E-E4BD-4B67-8DB7-6873415815A6}.Debug|x86.Build.0 = Debug|x86 {0847C79E-E4BD-4B67-8DB7-6873415815A6}.Release|Any CPU.ActiveCfg = Release|Any CPU {0847C79E-E4BD-4B67-8DB7-6873415815A6}.Release|Any CPU.Build.0 = Release|Any CPU {0847C79E-E4BD-4B67-8DB7-6873415815A6}.Release|x64.ActiveCfg = Release|Any CPU {0847C79E-E4BD-4B67-8DB7-6873415815A6}.Release|x64.Build.0 = Release|Any CPU {0847C79E-E4BD-4B67-8DB7-6873415815A6}.Release|x86.ActiveCfg = Release|Any CPU {0847C79E-E4BD-4B67-8DB7-6873415815A6}.Release|x86.Build.0 = Release|Any CPU + {AFD9C248-E42F-4C6E-829E-712096292FE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AFD9C248-E42F-4C6E-829E-712096292FE7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AFD9C248-E42F-4C6E-829E-712096292FE7}.Debug|x64.ActiveCfg = Debug|Any CPU + {AFD9C248-E42F-4C6E-829E-712096292FE7}.Debug|x64.Build.0 = Debug|Any CPU + {AFD9C248-E42F-4C6E-829E-712096292FE7}.Debug|x86.ActiveCfg = Debug|Any CPU + {AFD9C248-E42F-4C6E-829E-712096292FE7}.Debug|x86.Build.0 = Debug|Any CPU + {AFD9C248-E42F-4C6E-829E-712096292FE7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AFD9C248-E42F-4C6E-829E-712096292FE7}.Release|Any CPU.Build.0 = Release|Any CPU + {AFD9C248-E42F-4C6E-829E-712096292FE7}.Release|x64.ActiveCfg = Release|Any CPU + {AFD9C248-E42F-4C6E-829E-712096292FE7}.Release|x64.Build.0 = Release|Any CPU + {AFD9C248-E42F-4C6E-829E-712096292FE7}.Release|x86.ActiveCfg = Release|Any CPU + {AFD9C248-E42F-4C6E-829E-712096292FE7}.Release|x86.Build.0 = Release|Any CPU + {C310E070-EA3B-4E65-A00B-549B980F0881}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C310E070-EA3B-4E65-A00B-549B980F0881}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C310E070-EA3B-4E65-A00B-549B980F0881}.Debug|x64.ActiveCfg = Debug|Any CPU + {C310E070-EA3B-4E65-A00B-549B980F0881}.Debug|x64.Build.0 = Debug|Any CPU + {C310E070-EA3B-4E65-A00B-549B980F0881}.Debug|x86.ActiveCfg = Debug|Any CPU + {C310E070-EA3B-4E65-A00B-549B980F0881}.Debug|x86.Build.0 = Debug|Any CPU + {C310E070-EA3B-4E65-A00B-549B980F0881}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C310E070-EA3B-4E65-A00B-549B980F0881}.Release|Any CPU.Build.0 = Release|Any CPU + {C310E070-EA3B-4E65-A00B-549B980F0881}.Release|x64.ActiveCfg = Release|Any CPU + {C310E070-EA3B-4E65-A00B-549B980F0881}.Release|x64.Build.0 = Release|Any CPU + {C310E070-EA3B-4E65-A00B-549B980F0881}.Release|x86.ActiveCfg = Release|Any CPU + {C310E070-EA3B-4E65-A00B-549B980F0881}.Release|x86.Build.0 = Release|Any CPU + {A2D6D146-96BF-431C-AEF8-3C21CC60206A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A2D6D146-96BF-431C-AEF8-3C21CC60206A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A2D6D146-96BF-431C-AEF8-3C21CC60206A}.Debug|x64.ActiveCfg = Debug|Any CPU + {A2D6D146-96BF-431C-AEF8-3C21CC60206A}.Debug|x64.Build.0 = Debug|Any CPU + {A2D6D146-96BF-431C-AEF8-3C21CC60206A}.Debug|x86.ActiveCfg = Debug|Any CPU + {A2D6D146-96BF-431C-AEF8-3C21CC60206A}.Debug|x86.Build.0 = Debug|Any CPU + {A2D6D146-96BF-431C-AEF8-3C21CC60206A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A2D6D146-96BF-431C-AEF8-3C21CC60206A}.Release|Any CPU.Build.0 = Release|Any CPU + {A2D6D146-96BF-431C-AEF8-3C21CC60206A}.Release|x64.ActiveCfg = Release|Any CPU + {A2D6D146-96BF-431C-AEF8-3C21CC60206A}.Release|x64.Build.0 = Release|Any CPU + {A2D6D146-96BF-431C-AEF8-3C21CC60206A}.Release|x86.ActiveCfg = Release|Any CPU + {A2D6D146-96BF-431C-AEF8-3C21CC60206A}.Release|x86.Build.0 = Release|Any CPU + {96CF8C5B-D343-4ECF-AC40-1F87891F046B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {96CF8C5B-D343-4ECF-AC40-1F87891F046B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {96CF8C5B-D343-4ECF-AC40-1F87891F046B}.Debug|x64.ActiveCfg = Debug|x64 + {96CF8C5B-D343-4ECF-AC40-1F87891F046B}.Debug|x64.Build.0 = Debug|x64 + {96CF8C5B-D343-4ECF-AC40-1F87891F046B}.Debug|x86.ActiveCfg = Debug|x86 + {96CF8C5B-D343-4ECF-AC40-1F87891F046B}.Debug|x86.Build.0 = Debug|x86 + {96CF8C5B-D343-4ECF-AC40-1F87891F046B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {96CF8C5B-D343-4ECF-AC40-1F87891F046B}.Release|Any CPU.Build.0 = Release|Any CPU + {96CF8C5B-D343-4ECF-AC40-1F87891F046B}.Release|x64.ActiveCfg = Release|x64 + {96CF8C5B-D343-4ECF-AC40-1F87891F046B}.Release|x64.Build.0 = Release|x64 + {96CF8C5B-D343-4ECF-AC40-1F87891F046B}.Release|x86.ActiveCfg = Release|x86 + {96CF8C5B-D343-4ECF-AC40-1F87891F046B}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -139,6 +185,11 @@ Global {4DB5312C-5B29-4725-8EA0-3458AC36FB08} = {2831BC99-EB85-43AC-AEDF-8A689B8268FC} {4763E2F5-B238-4896-AC52-217555ACFF2A} = {2831BC99-EB85-43AC-AEDF-8A689B8268FC} {0847C79E-E4BD-4B67-8DB7-6873415815A6} = {2831BC99-EB85-43AC-AEDF-8A689B8268FC} + {AFD9C248-E42F-4C6E-829E-712096292FE7} = {E771A42F-A73C-4C1E-B50E-58CA0A6A2113} + {55693EBC-5165-42D3-A433-69A4503F8867} = {E771A42F-A73C-4C1E-B50E-58CA0A6A2113} + {C310E070-EA3B-4E65-A00B-549B980F0881} = {55693EBC-5165-42D3-A433-69A4503F8867} + {A2D6D146-96BF-431C-AEF8-3C21CC60206A} = {55693EBC-5165-42D3-A433-69A4503F8867} + {96CF8C5B-D343-4ECF-AC40-1F87891F046B} = {2831BC99-EB85-43AC-AEDF-8A689B8268FC} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {3C10DB2A-2433-4783-82DF-C6433CBD211B} diff --git a/README.md b/README.md index 6f67ec0..b7a131c 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,32 @@ -# C# bindings +# LSL.Net -The is the C# interface to the lab streaming layer. To use it, you need to include the file LSL.cs in your project, and make sure that the appropriate lsl library (e.g. lsl.dll) is findable (e.g., in your application's root directory or in a system path). If LSL.cs fails to find the lsl shared library for your target platform, edit LSL.cs and update the libname line with the library name for your target platform. As of liblsl 1.14, this should be the same for all targets: `const string libname = "lsl";` +LSL.Net is a cross-platform C# binding of [Lab Streaming Layer](https://github.com/sccn/labstreaminglayer). -## Using Visual Studio 2019 +## Usage -* Make sure you have the .NET desktop development pack installed. -* Open the liblsl.sln file. If you are asked to upgrade then go ahead. -* Add lsl.dll to your solution. - * In the solution explorer, right click on the `liblsl` target and choose `Add > Existing Item ...`. - * In the new explorer window, change the `Add` dropdown button to `Add as Link` and change the file types/extensions to `all files (*.*)`. Browse to where you have lsl.dll ([previously downloaded from here](https://github.com/sccn/liblsl/releases)) and select it. -* Click on the lsl.dll entry now in the solution explorer to view its properties. -* Set "Build Action" to "Content" and "Copy to Output Directory" to "Copy if newer". +LSL.Net is available as a convenient NuGet package. You can install LSL.Net using any of the following methods: -![Visual Studio lsl.dll properties](img/vs2019_lsl_props.PNG) +.NET CLI: -From now on, whenever a target in the solution is built, lsl.dll will be copied into the build directory. +``` +dotnet add package LSL.Net --version +``` + +NuGet package manager: + +``` +Install-Package LSL.Net -Version +``` + +PackageReference: + +``` + +``` + +Replace `` with the specific version number of LSL.Net you wish to use. + +In addition to installing LSL.Net, you will need to install the appropriate liblsl runtime package(s) for your target platform(s). There are separate NuGet packages that contain liblsl native binaries for the most common platforms, named [```LSL.Net.runtime.[RID]```](https://www.nuget.org/packages?q=LSL.Net.runtime), where `[RID]` represents the runtime identifier for the specific platform. For details on runtime identifiers, refer to the [.NET RID catalog](https://learn.microsoft.com/en-us/dotnet/core/rid-catalog). You can find the list of available native packages and their platform mappings in the [LSL.Net.runtime README](https://github.com/labstreaminglayer/liblsl-Csharp/blob/master/src/LSL.Net.runtime/README.md). # C# Example Programs diff --git a/examples/Directory.Build.props b/examples/Directory.Build.props index b57ab75..f1821f1 100644 --- a/examples/Directory.Build.props +++ b/examples/Directory.Build.props @@ -1,9 +1,27 @@ + + - Christian Kothe - netstandard2.0 - 1.12.2 + Exe + false 8.0 + AnyCPU;x86;x64 + false - + + + + + + + + + + + + + + + + diff --git a/examples/HandleMetaData/HandleMetaData.csproj b/examples/HandleMetaData/HandleMetaData.csproj index 5943752..35e3d84 100644 --- a/examples/HandleMetaData/HandleMetaData.csproj +++ b/examples/HandleMetaData/HandleMetaData.csproj @@ -1,11 +1,2 @@ - - net5.0 - 1.14 - 8.0 - Exe - - - - diff --git a/examples/LSLExamples.csproj b/examples/LSLExamples.csproj deleted file mode 100644 index 912f39e..0000000 --- a/examples/LSLExamples.csproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - netcoreapp5.0 - Labstreaminglayer C# examples - 1.14 - 8.0 - Exe - LSLExamples.EntryPoint - - - - - diff --git a/examples/LSLExamples/LSLExamples.csproj b/examples/LSLExamples/LSLExamples.csproj new file mode 100644 index 0000000..2ff494c --- /dev/null +++ b/examples/LSLExamples/LSLExamples.csproj @@ -0,0 +1,12 @@ + + + + LSLExamples.EntryPoint + + diff --git a/examples/Main.cs b/examples/LSLExamples/Main.cs similarity index 100% rename from examples/Main.cs rename to examples/LSLExamples/Main.cs diff --git a/examples/LSLVer/LSLVer.cs b/examples/LSLVer/LSLVer.cs new file mode 100644 index 0000000..5b61b48 --- /dev/null +++ b/examples/LSLVer/LSLVer.cs @@ -0,0 +1,15 @@ +// Port of https://github.com/sccn/liblsl/blob/master/testing/lslver.c +using System; + +namespace LSLExamples +{ + internal class LSLVer + { + static void Main(string[] args) + { + Console.WriteLine($"LSL version: {LSL.LSL.library_version()}"); + Console.WriteLine(LSL.LSL.library_info()); + Console.WriteLine(LSL.LSL.local_clock()); + } + } +} diff --git a/examples/LSLVer/LSLVer.csproj b/examples/LSLVer/LSLVer.csproj new file mode 100644 index 0000000..35e3d84 --- /dev/null +++ b/examples/LSLVer/LSLVer.csproj @@ -0,0 +1,2 @@ + + diff --git a/examples/ReceiveData/ReceiveData.csproj b/examples/ReceiveData/ReceiveData.csproj index e5668bc..35e3d84 100644 --- a/examples/ReceiveData/ReceiveData.csproj +++ b/examples/ReceiveData/ReceiveData.csproj @@ -1,12 +1,2 @@ - - net5.0 - Labstreaminglayer C# examples - 1.14 - 8.0 - Exe - - - - diff --git a/examples/ReceiveDataInChunks/ReceiveDataInChunks.csproj b/examples/ReceiveDataInChunks/ReceiveDataInChunks.csproj index e5668bc..35e3d84 100644 --- a/examples/ReceiveDataInChunks/ReceiveDataInChunks.csproj +++ b/examples/ReceiveDataInChunks/ReceiveDataInChunks.csproj @@ -1,12 +1,2 @@ - - net5.0 - Labstreaminglayer C# examples - 1.14 - 8.0 - Exe - - - - diff --git a/examples/ReceiveStringMarkers/ReceiveStringMarkers.csproj b/examples/ReceiveStringMarkers/ReceiveStringMarkers.csproj index e5668bc..35e3d84 100644 --- a/examples/ReceiveStringMarkers/ReceiveStringMarkers.csproj +++ b/examples/ReceiveStringMarkers/ReceiveStringMarkers.csproj @@ -1,12 +1,2 @@ - - net5.0 - Labstreaminglayer C# examples - 1.14 - 8.0 - Exe - - - - diff --git a/examples/SendData/SendData.csproj b/examples/SendData/SendData.csproj index e5668bc..35e3d84 100644 --- a/examples/SendData/SendData.csproj +++ b/examples/SendData/SendData.csproj @@ -1,12 +1,2 @@ - - net5.0 - Labstreaminglayer C# examples - 1.14 - 8.0 - Exe - - - - diff --git a/examples/SendDataInChunks/SendDataInChunks.csproj b/examples/SendDataInChunks/SendDataInChunks.csproj index e5668bc..35e3d84 100644 --- a/examples/SendDataInChunks/SendDataInChunks.csproj +++ b/examples/SendDataInChunks/SendDataInChunks.csproj @@ -1,12 +1,2 @@ - - net5.0 - Labstreaminglayer C# examples - 1.14 - 8.0 - Exe - - - - diff --git a/examples/SendStringMarkers/SendStringMarkers.csproj b/examples/SendStringMarkers/SendStringMarkers.csproj index e5668bc..35e3d84 100644 --- a/examples/SendStringMarkers/SendStringMarkers.csproj +++ b/examples/SendStringMarkers/SendStringMarkers.csproj @@ -1,12 +1,2 @@ - - net5.0 - Labstreaminglayer C# examples - 1.14 - 8.0 - Exe - - - - diff --git a/img/vs2019_lsl_props.PNG b/img/vs2019_lsl_props.PNG deleted file mode 100644 index 42670bdbca948293b3e73444fd1d9a9fedd9b040..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13342 zcmbumcQ~AH*ETw$Cqk5j5hWPCW=PR{nW)h_VFVE*m?#mE5F$~B45LO5g6K6PYK##j zf-q|IUPmwcp8THo+t0h-@7vElj{S#&d+w{AYprvg*Sbc8fu82&i>wzxAkbx)mYN|5 zL;?nW-ceBipWOX(>j?No;%%s@0xIcYTLK=)oRxKzL7=jjOD7M=foJL`S{B|Q5N#{* zhvd8GCpZWsSpid1Huke!OS{w!F+(i)Lz42FZLc@U?`=kvHMhFmpt!_VA;)%;!$H)K z3r;TZW$!n`HVZuFK8BG@(kt85Ba|#G4=?y>UR|TWA=P>X137fy{nS_Z};2n5) znp1gu3DixBGZ(@(5{eTWIL{BhKT7UcAJFqzzbx*{sW3y29&c&)KC|k# zc$T=qgj2C(74|K6g-VR7U`1;&XV*YPl+6z#QPBJwCy_Vs9Q)CGd~EGkM8FK4PKl?K z=e8{l(`F6@W2)w;3%dL+qS)4%=KPVp|3@ALT@22~D==gN12IObdkBW36AFdWh3Y+c@-h znzg7vt>{Uy;cy*s z^rKK@jQQ;`v1A!uh)P!G34qB302BTo(O9G_PJ{;?6%`n&(kH+xRNR6h^$p;4s8gg0)aUu@Y7WpxM{ss*H&2XQ z`IY`n_e+te@XpfhVva+l&J;dobvrXoT*J>QpD%tQj!ei*z2iPrIs$hxUqq*rXd1Pw zq&9ybOG$_~y1tk`vN$A$3j*`_o{*QNOoqGeyChft$6paTrgOhKQ&MBdkW zXz~iKWCsL(MVk`zqxgSv4kf7M6%*-@ zPQdvd+9TmdS1yOR!Id(AvE!%e5*zVpTi+F*FrSRHu6H*CE$Y?pb_wWT$6k3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DB5Rx%es=-nO{L1Eih%Zlm$Il)itN3TE`DM6C*#O-&0_7@;?-5 z7YVGF?@bEbYHQ(D?TdJju0k*MCdnt<2%Q?5nJ~OmrJ!nVzo}ImKY1A73^m_(o@+e!eQqQc3C`+8RUd z)VaQUl`ZX8R@&vQ8)4T(E>ovTKDfVG7ynD^&CkUHkF6iQa@=nHRIfGeLQr|rJh}aI z{U_l$(B1DQ9yXlreJ9o&2aTnWF%mxdAa)tiUEW~RbLf>b(o~AVkmanI6t&%Nr0tw; zcjKzO;L1GA>o=sTvJ?&Ow&^Idhin^3uN%vqKv1HK!L!wjHDiV^#MY@yp`f*?Q?a=3 z*PCCK@=8x8y%16ZOFha|_5%L_1Oma-_0&pK>|g(1V8?aD diff --git a/liblsl.csproj b/liblsl.csproj deleted file mode 100644 index 0b9263b..0000000 --- a/liblsl.csproj +++ /dev/null @@ -1,21 +0,0 @@ - - - Christian Kothe - netstandard2.0 - LSL - Labstreaminglayer C# bindings - 2.0 - $(DefaultItemExcludes);examples/** - lsl_csharp - Copyright © Christian Kothe 2021 - https://github.com/labstreaminglayer/liblsl-Csharp - MIT - LSL Lab Streaming Layer - true - win-x86;win-x64;osx-x64;linux-x64 - - - - - - diff --git a/runtimes/README.md b/runtimes/README.md deleted file mode 100644 index b275674..0000000 --- a/runtimes/README.md +++ /dev/null @@ -1,65 +0,0 @@ -# Runtime Identifier Dependencies - -The NuGet package for the C# bindings includes binary distributions for major platform runtimes targeted by [liblsl](https://github.com/sccn/liblsl). To successfully build the package, these binaries need to be downloaded from [liblsl releases](https://github.com/sccn/liblsl/releases) and included in this folder following the RID naming conventions outlined in the [RID Catalog](https://docs.microsoft.com/en-us/dotnet/core/rid-catalog). - -The following [architecture-specific folders](https://docs.microsoft.com/en-us/nuget/create-packages/supporting-multiple-target-frameworks#architecture-specific-folders) are recommended: - -``` -\runtimes - \linux-x64 - \native - liblsl.so - liblsl.so.1.14.0 - \osx-x64 - \native - liblsl.dylib - liblsl.1.14.0.dylib - \win-x64 - \native - lsl.dll - \win-x86 - \native - lsl.dll -``` - -## Project files for dependent projects - -From Visual Studio 2019, both .NET Core (`dotnet`) and .NET Framework compilers will use the `RuntimeIdentifier` element of the new SDK csproj format to control which native dependencies to deploy to the final output folder. - -### .NET Core -In .NET Core, the default is to generate cross-platform deployments, which means that all the runtimes will be deployed to the final output folder. By inserting a specific `RuntimeIdentifier` a build targeting only the specified architecture is generated. - -```xml - - - - Exe - net5.0 - - - - - - - - -``` - -### .NET Framework -In legacy .NET framework projects, `RuntimeIdentifier` defaults to `win7-x86` which has the generic fallback to `win-x86`. Therefore, the above folder structure will automatically copy `lsl.dll` into the output folder of .NET Framework projects. - -```xml - - - - Exe - net472 - - - - - - - - -``` \ No newline at end of file diff --git a/src/Directory.Build.props b/src/Directory.Build.props new file mode 100644 index 0000000..67cc478 --- /dev/null +++ b/src/Directory.Build.props @@ -0,0 +1,17 @@ + + + + + true + + + + https://github.com/labstreaminglayer/liblsl-Csharp + README.md + https://github.com/labstreaminglayer/liblsl-Csharp/releases + labstreaminglayer;lsl;liblsl + true + https://github.com/labstreaminglayer/liblsl-Csharp + git + + diff --git a/src/LSL.Net.runtime/CopyNativeLib.targets b/src/LSL.Net.runtime/CopyNativeLib.targets new file mode 100644 index 0000000..ff7cd28 --- /dev/null +++ b/src/LSL.Net.runtime/CopyNativeLib.targets @@ -0,0 +1,47 @@ + + + linux + liblsl.so + + + + osx + liblsl.dylib + + + + win + lsl.dll + + + + arm + arm64 + x64 + x86 + + + + + + + + PreserveNewest + + + + + + + + \ No newline at end of file diff --git a/src/LSL.Net.runtime/Directory.Build.props b/src/LSL.Net.runtime/Directory.Build.props new file mode 100644 index 0000000..8843899 --- /dev/null +++ b/src/LSL.Net.runtime/Directory.Build.props @@ -0,0 +1,28 @@ + + + + + 1.16.2 + + + + false + None + false + false + CS2008 + + + + false + false + LICENSE + true + + + + + + + + diff --git a/src/LSL.Net.runtime/Directory.Build.targets b/src/LSL.Net.runtime/Directory.Build.targets new file mode 100644 index 0000000..bd659f8 --- /dev/null +++ b/src/LSL.Net.runtime/Directory.Build.targets @@ -0,0 +1,74 @@ + + + + LSL.Net.runtime.$(RID) + liblsl runtime library for $(RID) + + + + https://github.com/sccn/liblsl/releases/download/v$(LSLRuntimeVersion)/$(NativeAssetFile) + $(NativeLibPrefix)lsl.$(NativeLibExt) + $(ProjectDir)$(BaseIntermediateOutputPath)$(NativeAssetTitle)/ + + + + + + + + + + + + + + + true + runtimes/$(RID)/native + runtimes/$(RID)/native/%(FileName)%(Extension) + PreserveNewest + + + + + + + + + + + + + + + + + + + + + + + + + + + <_IncludeAdditionalTfmSpecificPackageFilesDependsOn> + _IncludeAdditionalTfmSpecificPackageFilesPrepare; + _IncludeAdditionalTfmSpecificPackageFiles; + + + + + + diff --git a/src/LSL.Net.runtime/LICENSE b/src/LSL.Net.runtime/LICENSE new file mode 100644 index 0000000..3e443e3 --- /dev/null +++ b/src/LSL.Net.runtime/LICENSE @@ -0,0 +1,15 @@ +Copyright (C) 2012 Christian A. Kothe + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +This software uses the following libraries: + + +pugixml (https://pugixml.org), MIT. pugixml is Copyright (C) 2006-2018 Arseny Kapoulkine. +Boost (https://boost.org), Boost Software License +Loguru (https://github.com/emilk/loguru), Public Domain +Catch2 (https://github.com/catchorg/Catch2), Boost Software License diff --git a/src/LSL.Net.runtime/README.md b/src/LSL.Net.runtime/README.md new file mode 100644 index 0000000..825ca81 --- /dev/null +++ b/src/LSL.Net.runtime/README.md @@ -0,0 +1,75 @@ +# LSL.Net runtime packages + +The following NuGet packages include binary distributions for major platform runtimes targeted by [liblsl](https://github.com/sccn/liblsl). + +| RID | NuGet Package | +| :------------ | :----------------------------------------------------------: | +| android-arm | [![LSL.Net.runtime.android-arm-badge]][LSL.Net.runtime.android-arm-nuget] | +| android-arm64 | [![LSL.Net.runtime.android-arm64-badge]][LSL.Net.runtime.android-arm64-nuget] | +| android-x64 | [![LSL.Net.runtime.android-x64-badge]][LSL.Net.runtime.android-x64-nuget] | +| android-x86 | [![LSL.Net.runtime.android-x86-badge]][LSL.Net.runtime.android-x86-nuget] | +| ios-arm64 | [![LSL.Net.runtime.ios-arm64-badge]][LSL.Net.runtime.ios-arm64-nuget] | +| linux-arm | [![LSL.Net.runtime.linux-arm-badge]][LSL.Net.runtime.linux-arm-nuget] | +| linux-arm64 | [![LSL.Net.runtime.linux-arm64-badge]][LSL.Net.runtime.linux-arm64-nuget] | +| linux-x64 | [![LSL.Net.runtime.linux-x64-badge]][LSL.Net.runtime.linux-x64-nuget] | +| osx-arm64 | [![LSL.Net.runtime.osx-arm64-badge]][LSL.Net.runtime.osx-arm64-nuget] | +| osx-x64 | [![LSL.Net.runtime.osx-x64-badge]][LSL.Net.runtime.osx-x64-nuget] | +| win-arm64 | [![LSL.Net.runtime.win-arm64-badge]][LSL.Net.runtime.win-arm64-nuget] | +| win-x64 | [![LSL.Net.runtime.win-x64-badge]][LSL.Net.runtime.win-x64-nuget] | +| win-x86 | [![LSL.Net.runtime.win-x86-badge]][LSL.Net.runtime.win-x86-nuget] | + +[LSL.Net.runtime.android-arm-badge]: https://img.shields.io/nuget/v/LSL.Net.runtime.android-arm.svg +[LSL.Net.runtime.android-arm-nuget]: https://www.nuget.org/packages/LSL.Net.runtime.android-arm +[LSL.Net.runtime.android-arm64-badge]: https://img.shields.io/nuget/v/LSL.Net.runtime.android-arm64.svg +[LSL.Net.runtime.android-arm64-nuget]: https://www.nuget.org/packages/LSL.Net.runtime.android-arm64 +[LSL.Net.runtime.android-x64-badge]: https://img.shields.io/nuget/v/LSL.Net.runtime.android-x64.svg +[LSL.Net.runtime.android-x64-nuget]: https://www.nuget.org/packages/LSL.Net.runtime.android-x64 +[LSL.Net.runtime.android-x86-badge]: https://img.shields.io/nuget/v/LSL.Net.runtime.android-x86.svg +[LSL.Net.runtime.android-x86-nuget]: https://www.nuget.org/packages/LSL.Net.runtime.android-x86 +[LSL.Net.runtime.ios-arm64-badge]: https://img.shields.io/nuget/v/LSL.Net.runtime.ios-arm64.svg +[LSL.Net.runtime.ios-arm64-nuget]: https://www.nuget.org/packages/LSL.Net.runtime.ios-arm64 +[LSL.Net.runtime.linux-arm-badge]: https://img.shields.io/nuget/v/LSL.Net.runtime.linux-arm.svg +[LSL.Net.runtime.linux-arm-nuget]: https://www.nuget.org/packages/LSL.Net.runtime.linux-arm +[LSL.Net.runtime.linux-arm64-badge]: https://img.shields.io/nuget/v/LSL.Net.runtime.linux-arm64.svg +[LSL.Net.runtime.linux-arm64-nuget]: https://www.nuget.org/packages/LSL.Net.runtime.linux-arm64 +[LSL.Net.runtime.linux-x64-badge]: https://img.shields.io/nuget/v/LSL.Net.runtime.linux-x64.svg +[LSL.Net.runtime.linux-x64-nuget]: https://www.nuget.org/packages/LSL.Net.runtime.linux-x64 +[LSL.Net.runtime.osx-arm64-badge]: https://img.shields.io/nuget/v/LSL.Net.runtime.osx-arm64.svg +[LSL.Net.runtime.osx-arm64-nuget]: https://www.nuget.org/packages/LSL.Net.runtime.osx-arm64 +[LSL.Net.runtime.osx-x64-badge]: https://img.shields.io/nuget/v/LSL.Net.runtime.osx-x64.svg +[LSL.Net.runtime.osx-x64-nuget]: https://www.nuget.org/packages/LSL.Net.runtime.osx-x64 +[LSL.Net.runtime.win-arm64-badge]: https://img.shields.io/nuget/v/LSL.Net.runtime.win-arm64.svg +[LSL.Net.runtime.win-arm64-nuget]: https://www.nuget.org/packages/LSL.Net.runtime.win-arm64 +[LSL.Net.runtime.win-x64-badge]: https://img.shields.io/nuget/v/LSL.Net.runtime.win-x64.svg +[LSL.Net.runtime.win-x64-nuget]: https://www.nuget.org/packages/LSL.Net.runtime.win-x64 +[LSL.Net.runtime.win-x86-badge]: https://img.shields.io/nuget/v/LSL.Net.runtime.win-x86.svg +[LSL.Net.runtime.win-x86-nuget]: https://www.nuget.org/packages/LSL.Net.runtime.win-x86 + +## Usage + +```xml + + + + Exe + net6.0 + + + + + + + + + + + + + +``` + +Replace `` with the specific version number of these packages you wish to use. + +# License + +These packages only bundle the dynamic libraries of [liblsl](https://github.com/sccn/liblsl), thus using the same licensing agreement as liblsl. Please refer to the [LICENSE](./LICENSE) file for more information. diff --git a/src/LSL.Net.runtime/win-x64/LSL.Net.runtime.win-x64.csproj b/src/LSL.Net.runtime/win-x64/LSL.Net.runtime.win-x64.csproj new file mode 100644 index 0000000..ab997da --- /dev/null +++ b/src/LSL.Net.runtime/win-x64/LSL.Net.runtime.win-x64.csproj @@ -0,0 +1,15 @@ + + + win-x64 + liblsl-$(LSLRuntimeVersion)-Win_amd64 + $(NativeAssetTitle).zip + bin + + dll + + + + false + $(TargetsForTfmSpecificContentInPackage);IncludeAdditionalTfmSpecificPackageFiles + + diff --git a/src/LSL.Net.runtime/win-x64/build/net35/LSL.Net.runtime.win-x64.targets b/src/LSL.Net.runtime/win-x64/build/net35/LSL.Net.runtime.win-x64.targets new file mode 100644 index 0000000..efab157 --- /dev/null +++ b/src/LSL.Net.runtime/win-x64/build/net35/LSL.Net.runtime.win-x64.targets @@ -0,0 +1,21 @@ + + + + + + True + + + + + x64\ + + + + PreserveNewest + %(Dir)%(Filename)%(Extension) + False + + + diff --git a/src/LSL.Net.runtime/win-x86/LSL.Net.runtime.win-x86.csproj b/src/LSL.Net.runtime/win-x86/LSL.Net.runtime.win-x86.csproj new file mode 100644 index 0000000..db98b81 --- /dev/null +++ b/src/LSL.Net.runtime/win-x86/LSL.Net.runtime.win-x86.csproj @@ -0,0 +1,15 @@ + + + win-x86 + liblsl-$(LSLRuntimeVersion)-Win_i386 + $(NativeAssetTitle).zip + bin + + dll + + + + false + $(TargetsForTfmSpecificContentInPackage);IncludeAdditionalTfmSpecificPackageFiles + + diff --git a/src/LSL.Net.runtime/win-x86/build/net35/LSL.Net.runtime.win-x86.targets b/src/LSL.Net.runtime/win-x86/build/net35/LSL.Net.runtime.win-x86.targets new file mode 100644 index 0000000..d359866 --- /dev/null +++ b/src/LSL.Net.runtime/win-x86/build/net35/LSL.Net.runtime.win-x86.targets @@ -0,0 +1,21 @@ + + + + + + True + + + + + x86\ + + + + PreserveNewest + %(Dir)%(Filename)%(Extension) + False + + + diff --git a/src/LSL.Net.slnf b/src/LSL.Net.slnf new file mode 100644 index 0000000..360f71f --- /dev/null +++ b/src/LSL.Net.slnf @@ -0,0 +1,10 @@ +{ + "solution": { + "path": "..\\LSL.Net.sln", + "projects": [ + "src\\LSL.Net.runtime\\win-x64\\LSL.Net.runtime.win-x64.csproj", + "src\\LSL.Net.runtime\\win-x86\\LSL.Net.runtime.win-x86.csproj", + "src\\LSL.Net\\LSL.Net.csproj" + ] + } +} \ No newline at end of file diff --git a/src/LSL.Net/LSL.Net.csproj b/src/LSL.Net/LSL.Net.csproj new file mode 100644 index 0000000..1186840 --- /dev/null +++ b/src/LSL.Net/LSL.Net.csproj @@ -0,0 +1,29 @@ + + + LSL.Net is a cross-platform C# binding of lab streaming layer + true + + MIT + true + snupkg + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + diff --git a/LSL.cs b/src/LSL.Net/LSL.cs similarity index 98% rename from LSL.cs rename to src/LSL.Net/LSL.cs index bb7137d..6a35e88 100644 --- a/LSL.cs +++ b/src/LSL.Net/LSL.cs @@ -1,4 +1,7 @@ using System; +using System.Diagnostics; +using System.IO; +using System.Reflection; using System.Runtime.InteropServices; namespace LSL @@ -94,6 +97,11 @@ Note that significantly larger numbers can cause the timeout to be invalid on so */ public static int library_version() { return dll.lsl_library_version(); } + /** + * Get a string containing library information. + */ + public static string library_info() { return Marshal.PtrToStringAnsi(dll.lsl_library_info()); } + /** * Obtain a local system time stamp in seconds. The resolution is better than a millisecond. * This reading can be used to assign time stamps to samples as they are being acquired. @@ -893,6 +901,28 @@ protected InternalException(System.Runtime.Serialization.SerializationInfo info, class dll { +#if NET35 + static dll() + { + var searchPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + + //if (Environment.Is64BitProcess) + if (IntPtr.Size == 8) + searchPath = Path.Combine(searchPath, "x64"); + else + searchPath = Path.Combine(searchPath, "x86"); + + if (Directory.Exists(searchPath)) + { + Trace.WriteLine($"Search LSL dynamic library in {searchPath}."); + SetDllDirectory(searchPath); + } + } + + [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] + public static extern bool SetDllDirectory(string path); +#endif + // Name of the binary to include -- replace this if the native library has a differentname const string libname = "lsl"; @@ -902,6 +932,9 @@ class dll [DllImport(libname, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)] public static extern int lsl_library_version(); + [DllImport(libname, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)] + public static extern IntPtr lsl_library_info(); + [DllImport(libname, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)] public static extern double lsl_local_clock();