-
Notifications
You must be signed in to change notification settings - Fork 190
Feat dotnet p invoke #424
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Feat dotnet p invoke #424
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
1188c7b
poc of dotnet pInvoke
ice6 f4a3af3
Add .NET bindings for GoRules.Zen with unit tests and build scripts
ice6 b6e206f
Add dynamic pricing and real-time quotation decision models
ice6 fa07368
实现 Rust 内存管理的 C 语言接口,添加字符串和整数的分配与释放功能
ice6 4e6f887
添加跨平台构建脚本和工作流以支持 Windows、Linux 和 macOS 的本地库构建
ice6 fb4ab41
更新 .NET 绑定的使用说明,添加跨平台原生库解析器和构建脚本以支持 Windows ARM64 和 x64
ice6 99d8eed
chore: delete the useless build script, use github workflows instead.
ice6 2164231
add native support for Windows ARM64 and Linux ARM64
ice6 58308cf
make the `build-native.yml` github workflow support Linux ARM64
ice6 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| name: Build Native Libraries | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| paths: | ||
| - 'bindings/c/**' | ||
| - 'bindings/dotnet/**' | ||
| - 'core/**' | ||
| pull_request: | ||
| branches: [main] | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| build-native: | ||
| strategy: | ||
| matrix: | ||
| include: | ||
| - os: windows-latest | ||
| target: x86_64-pc-windows-msvc | ||
| lib_name: zen_ffi.dll | ||
| runtime: win-x64 | ||
| - os: ubuntu-latest | ||
| target: x86_64-unknown-linux-gnu | ||
| lib_name: libzen_ffi.so | ||
| runtime: linux-x64 | ||
| - os: ubuntu-latest | ||
| target: aarch64-unknown-linux-gnu | ||
| lib_name: libzen_ffi.so | ||
| runtime: linux-arm64 | ||
| - os: macos-latest | ||
| target: x86_64-apple-darwin | ||
| lib_name: libzen_ffi.dylib | ||
| runtime: osx-x64 | ||
| - os: macos-latest | ||
| target: aarch64-apple-darwin | ||
| lib_name: libzen_ffi.dylib | ||
| runtime: osx-arm64 | ||
|
|
||
| runs-on: ${{ matrix.os }} | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Install Rust | ||
| uses: dtolnay/rust-action@stable | ||
| with: | ||
| targets: ${{ matrix.target }} | ||
|
|
||
| - name: Install Linux ARM64 toolchain | ||
| if: matrix.target == 'aarch64-unknown-linux-gnu' | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y gcc-aarch64-linux-gnu | ||
|
|
||
| - name: Build native library | ||
| run: cargo build --release -p zen-ffi --no-default-features --target ${{ matrix.target }} | ||
|
|
||
| - name: Upload artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: native-${{ matrix.runtime }} | ||
| path: target/${{ matrix.target }}/release/${{ matrix.lib_name }} | ||
|
|
||
| package-nuget: | ||
| needs: build-native | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Download all artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| path: artifacts | ||
|
|
||
| - name: Setup .NET | ||
| uses: actions/setup-dotnet@v4 | ||
| with: | ||
| dotnet-version: '8.0.x' | ||
|
|
||
| - name: Copy native libraries to runtime folders | ||
| run: | | ||
| mkdir -p bindings/dotnet/runtimes/win-x64/native | ||
| mkdir -p bindings/dotnet/runtimes/linux-x64/native | ||
| mkdir -p bindings/dotnet/runtimes/linux-arm64/native | ||
| mkdir -p bindings/dotnet/runtimes/osx-x64/native | ||
| mkdir -p bindings/dotnet/runtimes/osx-arm64/native | ||
|
|
||
| cp artifacts/native-win-x64/zen_ffi.dll bindings/dotnet/runtimes/win-x64/native/ | ||
| cp artifacts/native-linux-x64/libzen_ffi.so bindings/dotnet/runtimes/linux-x64/native/ | ||
| cp artifacts/native-linux-arm64/libzen_ffi.so bindings/dotnet/runtimes/linux-arm64/native/ | ||
| cp artifacts/native-osx-x64/libzen_ffi.dylib bindings/dotnet/runtimes/osx-x64/native/ | ||
| cp artifacts/native-osx-arm64/libzen_ffi.dylib bindings/dotnet/runtimes/osx-arm64/native/ | ||
|
|
||
| - name: Build NuGet package | ||
| working-directory: bindings/dotnet | ||
| run: dotnet pack -c Release | ||
|
|
||
| - name: Upload NuGet package | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: nuget-package | ||
| path: bindings/dotnet/bin/Release/*.nupkg | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| bin | ||
| bin/ | ||
| obj | ||
| obj/ | ||
| runtimes/ | ||
| Sequence_*.xml |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you be able to add unknown-linux arm?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, added. wish you guys a happy holiday!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, we have couple more days of holidays and we will soon be back - we will take a look as soon as we are back