-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_plugin.cmd
More file actions
93 lines (79 loc) · 3.36 KB
/
build_plugin.cmd
File metadata and controls
93 lines (79 loc) · 3.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
@echo off
setlocal
:: Activate Python virtual environment
call %~dp0activate_env.cmd
if %errorlevel% neq 0 (
echo Failed to activate virtual environment
endlocal
exit /b %errorlevel%
)
:: STEP.1 - build onnxruntime
pushd %~dp0\external\onnxruntime
call build.bat ^
--parallel ^
--config RelWithDebInfo ^
--build_dir %~dp0\ort_generic ^
--enable_generic_interface ^
--skip_tests ^
--build_shared_lib ^
--target onnxruntime ^
--disable_rtti ^
--use_binskim_compliant_compile_flags ^
--enable_lto
if %errorlevel% neq 0 (
echo Build failed with error %errorlevel%
popd
exit /b %errorlevel%
)
:: Build onnxruntime WebGPU provider
call build.bat ^
--parallel ^
--config RelWithDebInfo ^
--use_webgpu shared_lib ^
--build_dir %~dp0\ort_shared ^
--skip_tests ^
--target onnxruntime_providers_webgpu ^
--disable_rtti ^
--use_binskim_compliant_compile_flags ^
--enable_lto
popd
:: STEP.2 - prepare ort_home
if not exist "%~dp0\ort_home_plugin" mkdir "%~dp0\ort_home_plugin"
:: external\onnxruntime\include\onnxruntime\core\session\*.h
if not exist "%~dp0\ort_home_plugin\include" mkdir "%~dp0\ort_home_plugin\include"
copy /Y "%~dp0\external\onnxruntime\include\onnxruntime\core\session\*.h" "%~dp0\ort_home_plugin\include\"
:: %~dp0\ort_generic\RelWithDebInfo\RelWithDebInfo\onnxruntime.*
if not exist "%~dp0\ort_home_plugin\lib" mkdir "%~dp0\ort_home_plugin\lib"
copy /Y "%~dp0\ort_generic\RelWithDebInfo\RelWithDebInfo\onnxruntime.*" "%~dp0\ort_home_plugin\lib\"
:: STEP.3 - build onnxruntime-genai
pushd %~dp0\external\onnxruntime-genai
call build.bat ^
--parallel ^
--config RelWithDebInfo ^
--build_dir %~dp0\ort_genai_plugin ^
--skip_tests ^
--skip_wheel ^
--skip_examples ^
--ort_home "%~dp0\ort_home_plugin" ^
--cmake_extra_defines "ORT_GENAI_USE_WEBGPU_PLUGIN=ON"
if %errorlevel% neq 0 (
echo Build failed with error %errorlevel%
popd
exit /b %errorlevel%
)
popd
:: STEP.4 - gather artifacts
:: create output directory if it doesn't exist
if not exist "%~dp0\parity_plugin" mkdir "%~dp0\parity_plugin"
:: copy build outputs
copy /Y "%~dp0\ort_generic\RelWithDebInfo\RelWithDebInfo\onnxruntime.dll" "%~dp0\parity_plugin\onnxruntime.dll"
copy /Y "%~dp0\ort_generic\RelWithDebInfo\RelWithDebInfo\onnxruntime.pdb" "%~dp0\parity_plugin\onnxruntime.pdb"
copy /Y "%~dp0\ort_shared\RelWithDebInfo\RelWithDebInfo\onnxruntime_providers_webgpu.dll" "%~dp0\parity_plugin\onnxruntime_providers_webgpu.dll"
copy /Y "%~dp0\ort_shared\RelWithDebInfo\RelWithDebInfo\onnxruntime_providers_webgpu.pdb" "%~dp0\parity_plugin\onnxruntime_providers_webgpu.pdb"
copy /Y "%~dp0\ort_shared\RelWithDebInfo\RelWithDebInfo\dxil.dll" "%~dp0\parity_plugin\dxil.dll"
copy /Y "%~dp0\ort_shared\RelWithDebInfo\RelWithDebInfo\dxcompiler.dll" "%~dp0\parity_plugin\dxcompiler.dll"
copy /Y "%~dp0\ort_genai_plugin\RelWithDebInfo\benchmark\c\RelWithDebInfo\model_benchmark.exe" "%~dp0\parity_plugin\model_benchmark.exe"
copy /Y "%~dp0\ort_genai_plugin\RelWithDebInfo\benchmark\c\RelWithDebInfo\model_benchmark.pdb" "%~dp0\parity_plugin\model_benchmark.pdb"
copy /Y "%~dp0\ort_genai_plugin\RelWithDebInfo\RelWithDebInfo\onnxruntime-genai.dll" "%~dp0\parity_plugin\onnxruntime-genai.dll"
copy /Y "%~dp0\ort_genai_plugin\RelWithDebInfo\RelWithDebInfo\onnxruntime-genai.pdb" "%~dp0\parity_plugin\onnxruntime-genai.pdb"
endlocal