Skip to content

Commit 284be29

Browse files
committed
...
1 parent 4230c53 commit 284be29

File tree

1 file changed

+22
-30
lines changed

1 file changed

+22
-30
lines changed

.github/workflows/tritonservercppsharp.yml

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,30 @@ on: workflow_dispatch
55
env:
66
PLATFORM: x64
77
FRAMEWORK: net80
8-
DOTNET_ROOT: /usr/share/dotnet
9-
DOTNETSDKVER: 8.0.303
10-
DOTNETFWKVER: 8.0.7
8+
FRAMEWORKDOT: net8.0
119

1210
jobs:
1311
tritonservercppsharp:
1412
runs-on: ubuntu-22.04
1513
steps:
16-
- uses: actions/checkout@v2
14+
- name: Clone tritonserver
15+
run: |
16+
git clone --single-branch --depth 1 --branch r24.08 https://github.com/triton-inference-server/core
17+
git clone --single-branch --depth 1 --branch r24.08 https://github.com/triton-inference-server/developer_tools
1718
18-
- name: Write down the bindings code
19+
- name: Clone and build CppSharp
20+
run: |
21+
git clone --single-branch --depth 1 https://github.com/mono/CppSharp
22+
cd CppSharp
23+
bash build/build.sh generate -configuration Release -platform $PLATFORM -target-framework $FRAMEWORK
24+
bash build/build.sh download_llvm -platform $PLATFORM -target-framework $FRAMEWORK
25+
bash build/build.sh restore -platform $PLATFORM -target-framework $FRAMEWORK
26+
bash build/build.sh -platform $PLATFORM -build_only -target-framework $FRAMEWORK
27+
28+
- name: Variant 1
29+
run: ./CppSharp/bin/Release_x64/CppSharp.CLI -m tritonserver -g csharp -p linux -a x64 -o ./variant1/ -I=core/include core/include/triton/core/tritonserver.h core/include/triton/core/tritonbackend.h core/include/triton/core/tritoncache.h core/include/triton/core/tritonrepoagent.h
30+
31+
- name: Variant 2
1932
run: |
2033
echo '<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup><RunWorkingDirectory>$(MSBuildProjectDirectory)</RunWorkingDirectory><OutputType>Exe</OutputType><TargetFramework>net8.0</TargetFramework><EnableDefaultItems>false</EnableDefaultItems></PropertyGroup><ItemGroup><Compile Remove="**/*.cs"/><Compile Include="tritonservercppsharp.cs"/><Reference Include="MyAssembly"><HintPath>./CppSharp/bin/Release_x64/CppSharp.dll</HintPath></Reference><Reference Include="MyAssembly"><HintPath>./CppSharp/bin/Release_x64/CppSharp.Runtime.dll</HintPath></Reference><Reference Include="MyAssembly"><HintPath>./CppSharp/bin/Release_x64/CppSharp.AST.dll</HintPath></Reference><Reference Include="MyAssembly"><HintPath>./CppSharp/bin/Release_x64/CppSharp.Generator.dll</HintPath></Reference><Reference Include="MyAssembly"><HintPath>./CppSharp/bin/Release_x64/CppSharp.CLI.dll</HintPath></Reference><Reference Include="MyAssembly"><HintPath>./CppSharp/bin/Release_x64/CppSharp.Parser.dll</HintPath></Reference><Reference Include="MyAssembly"><HintPath>./CppSharp/bin/Release_x64/CppSharp.Parser.CSharp.dll</HintPath></Reference><Reference Include="MyAssembly"><HintPath>./CppSharp/bin/Release_x64/CppSharp.Parser.Bootstrap.dll</HintPath></Reference><Reference Include="MyAssembly"><HintPath>./CppSharp/bin/Release_x64/CppSharp.Parser.Gen.dll</HintPath></Reference></ItemGroup></Project>' > tritonservercppsharp.csproj
2134
tee tritonservercppsharp.cs <<EOF
@@ -28,7 +41,7 @@ jobs:
2841
var options = driver.Options;
2942
options.GeneratorKind = CppSharp.Generators.GeneratorKind.CSharp;
3043
var module = options.AddModule("tritonserver");
31-
options.OutputDir = "output2";
44+
options.OutputDir = "variant2";
3245
module.IncludeDirs.Add(".");
3346
module.IncludeDirs.Add("core/include");
3447
module.Headers.Add("core/include/triton/core/tritonserver.h");
@@ -40,33 +53,12 @@ jobs:
4053
} } }
4154
EOF
4255
43-
- name: Clone and build CppSharp
44-
run: |
45-
git clone --single-branch --depth 1 https://github.com/mono/CppSharp
46-
cd CppSharp
47-
bash build/build.sh generate -configuration Release -platform $PLATFORM -target-framework $FRAMEWORK
48-
bash build/build.sh download_llvm -platform $PLATFORM -target-framework $FRAMEWORK
49-
bash build/build.sh restore -platform $PLATFORM -target-framework $FRAMEWORK
50-
bash build/build.sh -platform $PLATFORM -build_only -target-framework $FRAMEWORK
51-
find bin
52-
53-
- name: Generating bindings
54-
run: |
55-
git clone --single-branch --depth 1 --branch r24.08 https://github.com/triton-inference-server/core
56-
git clone --single-branch --depth 1 --branch r24.08 https://github.com/triton-inference-server/developer_tools
57-
58-
#cp -r ./CppSharp/bin/Release_x64/libCppSharp.CppParser.so ./CppSharp/bin/Release_x64/libStd-symbols.so ./CppSharp/bin/Release_x64/lib .
59-
60-
./CppSharp/bin/Release_x64/CppSharp.CLI -m tritonserver -g csharp -p linux -a x64 -o ./output1/ -I=core/include core/include/triton/core/tritonserver.h core/include/triton/core/tritonbackend.h core/include/triton/core/tritoncache.h core/include/triton/core/tritonrepoagent.h
61-
62-
echo AFTER CLI
63-
64-
mkdir -p bin/x64/Release/net8.0 && cp -r ./CppSharp/bin/Release_x64/lib bin/x64/Release/net8.0/lib
56+
mkdir -p bin/x64/Release/$FRAMEWORKDOT && cp -r ./CppSharp/bin/Release_x64/lib bin/x64/Release/$FRAMEWORKDOT/lib
6557
LD_PRELOAD=$PWD/CppSharp/bin/Release_x64/libCppSharp.CppParser.so:$PWD/CppSharp/bin/Release_x64/libStd-symbols.so dotnet run -c Release
6658
6759
6860
- uses: actions/upload-artifact@v4
6961
with:
7062
path: |
71-
output1/
72-
output2/
63+
variant1/
64+
variant2/

0 commit comments

Comments
 (0)