Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions .github/workflows/build-nuget-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ name: build-nuget-package

on:
workflow_dispatch:
inputs:
version:
description: 'Package version (e.g. 1.14.0-preview.1)'
required: true
default: '1.14.0-preview.1'
push_package:
description: 'Push package to NuGet.org'
type: boolean
default: false
pull_request:
release:
types:
Expand Down Expand Up @@ -75,7 +84,7 @@ jobs:
- name: Configure CMake win32
shell: bash
working-directory: ${{github.workspace}}/build32
run: cmake $GITHUB_WORKSPACE -DCSHARP=ON -DBUILD_DOTNET=ON -A Win32
run: cmake $GITHUB_WORKSPACE -DCSHARP=ON -DBUILD_DOTNET=ON -A Win32 -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded

- name: Build win32
shell: bash
Expand All @@ -84,8 +93,8 @@ jobs:

- uses: actions/upload-artifact@v7
with:
name: win-x32
path: ${{github.workspace}}/build32/dotnet/Highs.Native/runtimes/win-x64/
name: win-x86
path: ${{github.workspace}}/build32/dotnet/Highs.Native/runtimes/win-x86/

build_linux:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -145,7 +154,7 @@ jobs:
- name: Configure CMake
working-directory: ${{github.workspace}}/build
shell: bash
run: cmake $GITHUB_WORKSPACE -DCSHARP=ON -DBUILD_DOTNET=ON
run: cmake $GITHUB_WORKSPACE -DCSHARP=ON -DBUILD_DOTNET=ON -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded

- name: Build
working-directory: ${{github.workspace}}/build
Expand All @@ -169,11 +178,11 @@ jobs:
name: macos-arm64
path: ${{github.workspace}}/build/dotnet/Highs.Native/runtimes

- name: Download runtimes win-x32
- name: Download runtimes win-x86
uses: actions/download-artifact@v8
with:
name: win-x32
path: ${{github.workspace}}/build/dotnet/Highs.Native/runtimes/win-x32
name: win-x86
path: ${{github.workspace}}/build/dotnet/Highs.Native/runtimes/win-x86

- name: Download runtimes
uses: actions/download-artifact@v8
Expand All @@ -196,7 +205,7 @@ jobs:

- name: Dotnet pack
working-directory: ${{github.workspace}}/build/dotnet/Highs.Native
run: dotnet pack -c Release /p:Version=1.14.0
run: dotnet pack -c Release /p:Version=${{ inputs.version || '1.14.0' }}

- uses: actions/upload-artifact@v7
with:
Expand All @@ -211,7 +220,7 @@ jobs:
permissions:
id-token: write # enable GitHub OIDC token issuance for this job

if: github.event_name == 'release'
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.push_package)
steps:
- uses: actions/checkout@v6
- uses: actions/setup-dotnet@v5
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ dotnet add package Highs.Native --version 1.14.0
The nuget package contains runtime libraries for

* `win-x64`
* `win-x32`
* `win-x86`
* `linux-x64`
* `linux-arm64`
* `macos-x64`
Expand Down
2 changes: 2 additions & 0 deletions cmake/dotnet.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ set(DOTNET_PACKAGES_DIR "${PROJECT_BINARY_DIR}/dotnet")
# see: https://docs.microsoft.com/en-us/dotnet/core/rid-catalog
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64)")
set(DOTNET_PLATFORM arm64)
elseif(WIN32 AND (CMAKE_GENERATOR_PLATFORM STREQUAL "Win32" OR CMAKE_SIZEOF_VOID_P EQUAL 4))
set(DOTNET_PLATFORM x86)
else()
set(DOTNET_PLATFORM x64)
endif()
Expand Down
2 changes: 1 addition & 1 deletion docs/src/interfaces/csharp.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dotnet add package Highs.Native --version 1.14.0
The nuget package contains runtime libraries for

* `win-x64`
* `win-x32`
* `win-x86`
* `linux-x64`
* `linux-arm64`
* `macos-x64`
Expand Down
2 changes: 2 additions & 0 deletions highs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,8 @@ else()
# see: https://docs.microsoft.com/en-us/dotnet/core/rid-catalog
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64)")
set(DOTNET_PLATFORM arm64)
elseif(WIN32 AND (CMAKE_GENERATOR_PLATFORM STREQUAL "Win32" OR CMAKE_SIZEOF_VOID_P EQUAL 4))
set(DOTNET_PLATFORM x86)
else()
set(DOTNET_PLATFORM x64)
endif()
Expand Down
2 changes: 1 addition & 1 deletion nuget/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dotnet add package Highs.Native --version 1.14.0
The nuget package contains runtime libraries for

* `win-x64`
* `win-x32`
* `win-x86`
* `linux-x64`
* `linux-arm64`
* `macos-x64`
Expand Down
1 change: 1 addition & 0 deletions nuget/build_windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ try {
# $flags = "/arch:AVX512 /Ox /Ot /Oi /O2" - Intel stopped supporting AVX-512 on some CPUs, me might run into compatibility issues
$flags = "/Ox /Ot /Oi /O2"
$arguments += "-DCMAKE_CXX_FLAGS='$flags'"
$arguments += "-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded"

# Pass the argument list to cmake
& cmake $arguments ../..
Expand Down
Loading