Skip to content

Commit

Permalink
Merge pull request #10 from microsoft/Cjian/win-gha
Browse files Browse the repository at this point in the history
Adding windows build GHA
  • Loading branch information
jchen351 authored Jan 19, 2024
2 parents 8b548e0 + dad69cd commit 8d1a00c
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 11 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/win-cpu-x64-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
on: [ workflow_dispatch, pull_request ]
env:
ort_dir: "onnxruntime-win-x64-1.16.3"
ort_zip: "$(ort_dir).zip"
ort_url: "https://github.com/microsoft/onnxruntime/releases/download/v1.16.3/$(ort_zip)"

jobs:
job:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2

- name: Setup Visual Studio 2022
uses: microsoft/[email protected]
with:
vs-version: '17.5'

- name: Download OnnxRuntime
run: |
$env:ort_url = "https://github.com/microsoft/onnxruntime/releases/download/v1.16.3/onnxruntime-win-x64-1.16.3.zip"
Invoke-WebRequest -Uri $env:ort_url -OutFile $env:ort_zip
- name: Unzip OnnxRuntime
run: |
Expand-Archive $env:ort_zip -DestinationPath .
Remove-Item -Path $env:ort_zip
- name: Rename OnnxRuntime to ort
run: |
Rename-Item -Path $env:ort_dir -NewName ort
- name: Git Submodule Update
run: |
git submodule update --init --recursive
- name: Build with CMake
run: |
mkdir build
cd build
cmake -G "Visual Studio 17 2022" -A x64 .. -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release --parallel
- name: Verify Build Artifacts
run: |
Get-ChildItem -Path $env:GITHUB_WORKSPACE\build\Release -Recurse
- name: Upload Build Artifacts
uses: actions/upload-artifact@v3
with:
name: onnxruntime-genai-win-cpu-x64
path: build/Release/*
20 changes: 10 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,16 @@ else()
set(ONNXRUNTIME_FILES "libonnxruntime*.so*")
endif()

add_executable (Tests ${test_srcs})
target_include_directories(Tests PRIVATE ${CMAKE_SOURCE_DIR}/ort/include)
target_link_directories(Tests PRIVATE ${CMAKE_SOURCE_DIR}/ort/lib)
target_link_libraries(Tests PRIVATE onnxruntime-genai ${ONNXRUNTIME_LIB})

pybind11_add_module(pybind ${pybind_srcs})
target_include_directories(pybind PRIVATE ${CMAKE_SOURCE_DIR}/ort/include)
target_link_directories(pybind PRIVATE ${CMAKE_SOURCE_DIR}/ort/lib)
target_link_libraries(pybind PRIVATE onnxruntime-genai ${ONNXRUNTIME_LIB})
set_target_properties(pybind PROPERTIES OUTPUT_NAME "onnxruntime_genai")
#add_executable (Tests ${test_srcs})
#target_include_directories(Tests PRIVATE ${CMAKE_SOURCE_DIR}/ort/include)
#target_link_directories(Tests PRIVATE ${CMAKE_SOURCE_DIR}/ort/lib)
#target_link_libraries(Tests PRIVATE onnxruntime-genai ${ONNXRUNTIME_LIB})
#
#pybind11_add_module(pybind ${pybind_srcs})
#target_include_directories(pybind PRIVATE ${CMAKE_SOURCE_DIR}/ort/include)
#target_link_directories(pybind PRIVATE ${CMAKE_SOURCE_DIR}/ort/lib)
#target_link_libraries(pybind PRIVATE onnxruntime-genai ${ONNXRUNTIME_LIB})
#set_target_properties(pybind PROPERTIES OUTPUT_NAME "onnxruntime_genai")

# Visual C++ - /MP Multiple process build, /WX Warnings as errors
# Enable:
Expand Down
3 changes: 2 additions & 1 deletion src/ort_genai_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ OrtEnv& GetOrtEnv() {
extern "C" {

struct OgaResult {
OgaResult(const char *what);
OgaResult(const char *what){}
// TODO: implement this constructor !!!!
};

OgaResult* OgaCreateModel(const char* config_path, OgaDeviceType device_type, OgaModel** out) {
Expand Down

0 comments on commit 8d1a00c

Please sign in to comment.