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
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ set(MI_OPT_ARCH_FLAGS "")
set(MI_ARCH "unknown")
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86|i[3456]86)$" OR CMAKE_GENERATOR_PLATFORM MATCHES "^(x86|Win32)$")
set(MI_ARCH "x86")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|x64|amd64|AMD64)$" OR CMAKE_GENERATOR_PLATFORM STREQUAL "x64" OR "x86_64" IN_LIST CMAKE_OSX_ARCHITECTURES) # must be before arm64
elseif((CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|x64|amd64|AMD64)$" OR CMAKE_GENERATOR_PLATFORM STREQUAL "x64" OR "x86_64" IN_LIST CMAKE_OSX_ARCHITECTURES) AND NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM64") # must be before arm64
set(MI_ARCH "x64")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64|armv[89].?|ARM64)$" OR CMAKE_GENERATOR_PLATFORM STREQUAL "ARM64" OR "arm64" IN_LIST CMAKE_OSX_ARCHITECTURES)
set(MI_ARCH "arm64")
Expand Down Expand Up @@ -465,7 +465,7 @@ if (MSVC AND MSVC_VERSION GREATER_EQUAL 1914)
list(APPEND mi_cflags /Zc:__cplusplus)
if(MI_OPT_ARCH AND NOT MI_CLANG_CL)
if(MI_ARCH STREQUAL "arm64")
set(MI_OPT_ARCH_FLAGS "/arch:armv8.1") # fast atomics
set(MI_OPT_ARCH_FLAGS "/arch:armv8.1") # fast atomics (LSE)
endif()
endif()
endif()
Expand Down
14 changes: 7 additions & 7 deletions contrib/nuget/Microsoft.Mimalloc.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
</metadata>
<files>
<!-- Header files -->
<file src="..\include\mimalloc.h" target="include" />
<file src="include\mimalloc.h" target="include" />

<!-- x64 Release binaries -->
<file src="..\build-x64\Release\mimalloc.dll" target="runtimes\win-x64\native" />
<file src="..\build-x64\Release\mimalloc.lib" target="runtimes\win-x64\native" />
<file src="..\build-x64\Release\mimalloc-static.lib" target="runtimes\win-x64\native" />
<file src="build-x64\Release\mimalloc.dll" target="runtimes\win-x64\native" />
<file src="build-x64\Release\mimalloc.dll.lib" target="runtimes\win-x64\native" />
<file src="build-x64\Release\mimalloc.lib" target="runtimes\win-x64\native" />

<!-- ARM64 Release binaries -->
<file src="..\build-arm64\Release\mimalloc.dll" target="runtimes\win-arm64\native" />
<file src="..\build-arm64\Release\mimalloc.lib" target="runtimes\win-arm64\native" />
<file src="..\build-arm64\Release\mimalloc-static.lib" target="runtimes\win-arm64\native" />
<file src="build-arm64\Release\mimalloc.dll" target="runtimes\win-arm64\native" />
<file src="build-arm64\Release\mimalloc.dll.lib" target="runtimes\win-arm64\native" />
<file src="build-arm64\Release\mimalloc.lib" target="runtimes\win-arm64\native" />
</files>
</package>
50 changes: 30 additions & 20 deletions contrib/nuget/nuget-release-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,15 @@ trigger: none
pr: none

parameters:
- name: version
displayName: 'NuGet package version'
- name: branch
displayName: 'Branch to build'
type: string
default: '1.0.0'
default: 'dev'

- name: buildConfig
displayName: 'Build configuration'
- name: version
displayName: 'NuGet package version (major.minor)'
type: string
default: 'Release'
values:
- Release
- Debug
default: '1.0'

- name: signBinaries
displayName: 'Sign binaries (ESRP)?'
Expand All @@ -30,11 +27,24 @@ parameters:
- name: publishToFeed
displayName: 'Publish NuGet to artifact feed?'
type: boolean
default: false
default: true

resources:
repositories:
- repository: self
type: github
name: microsoft/mimalloc
endpoint: microsoft
ref: refs/heads/${{ parameters.branch }}

variables:
nuspecPath: '$(Build.SourcesDirectory)/contrib/nuget/Microsoft.Mimalloc.nuspec'
artifactStaging: '$(Build.ArtifactStagingDirectory)'
patch: $[counter(format('{0}-{1}', '${{ parameters.branch }}', '${{ parameters.version }}'), 1)]
${{ if eq(parameters.branch, 'main') }}:
packageVersion: '${{ parameters.version }}.$(patch)'
${{ else }}:
packageVersion: '${{ parameters.version }}.0-${{ parameters.branch }}.$(patch)'

stages:

Expand All @@ -60,15 +70,15 @@ stages:
cmakeArgs: '.. -A x64 -DMI_BUILD_TESTS=OFF'

- task: CMake@1
displayName: 'CMake build (x64 ${{ parameters.buildConfig }})'
displayName: 'CMake build (x64 Release)'
inputs:
workingDirectory: '$(Build.SourcesDirectory)/build-x64'
cmakeArgs: '--build . --config ${{ parameters.buildConfig }} --parallel'
cmakeArgs: '--build . --config Release --parallel'

- task: PublishPipelineArtifact@1
displayName: 'Publish x64 binaries'
inputs:
targetPath: '$(Build.SourcesDirectory)/build-x64/${{ parameters.buildConfig }}'
targetPath: '$(Build.SourcesDirectory)/build-x64/Release'
artifactName: 'binaries-x64'

# --- ARM64 Build (cross-compilation) ---
Expand All @@ -86,15 +96,15 @@ stages:
cmakeArgs: '.. -A ARM64 -DMI_BUILD_TESTS=OFF'

- task: CMake@1
displayName: 'CMake build (ARM64 ${{ parameters.buildConfig }})'
displayName: 'CMake build (ARM64 Release)'
inputs:
workingDirectory: '$(Build.SourcesDirectory)/build-arm64'
cmakeArgs: '--build . --config ${{ parameters.buildConfig }} --parallel'
cmakeArgs: '--build . --config Release --parallel'

- task: PublishPipelineArtifact@1
displayName: 'Publish ARM64 binaries'
inputs:
targetPath: '$(Build.SourcesDirectory)/build-arm64/${{ parameters.buildConfig }}'
targetPath: '$(Build.SourcesDirectory)/build-arm64/Release'
artifactName: 'binaries-arm64'

# ============================================================
Expand Down Expand Up @@ -241,21 +251,21 @@ stages:
displayName: 'Download x64 binaries'
inputs:
artifactName: '$(x64Artifact)'
targetPath: '$(Build.SourcesDirectory)/build-x64/${{ parameters.buildConfig }}'
targetPath: '$(Build.SourcesDirectory)/build-x64/Release'

- task: DownloadPipelineArtifact@2
displayName: 'Download ARM64 binaries'
inputs:
artifactName: '$(arm64Artifact)'
targetPath: '$(Build.SourcesDirectory)/build-arm64/${{ parameters.buildConfig }}'
targetPath: '$(Build.SourcesDirectory)/build-arm64/Release'

# Pack NuGet
- task: NuGetToolInstaller@1
displayName: 'Install NuGet'

- script: |
nuget pack "$(nuspecPath)" -Version ${{ parameters.version }} -OutputDirectory "$(artifactStaging)" -NoPackageAnalysis
displayName: 'NuGet pack (v${{ parameters.version }})'
nuget pack "$(nuspecPath)" -Version $(packageVersion) -OutputDirectory "$(artifactStaging)" -BasePath "$(Build.SourcesDirectory)" -NoPackageAnalysis
displayName: 'NuGet pack (v$(packageVersion))'

# Publish .nupkg as pipeline artifact
- task: PublishPipelineArtifact@1
Expand Down