Skip to content

Commit de1bec2

Browse files
Merge branch 'main' into u/RevertBackToUbuntu18
2 parents 402bbcd + b6e4706 commit de1bec2

File tree

6 files changed

+50
-21
lines changed

6 files changed

+50
-21
lines changed

Directory.Build.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
<!-- we manually update these -->
8888
<PropertyGroup Condition="'$(MSBuildProjectName.IndexOf(`libtorch-`))' != '-1'">
8989
<LibTorchPackageVersion>2.2.1.1</LibTorchPackageVersion>
90+
<EnablePackageValidation>false</EnablePackageValidation>
9091
<VersionPrefix>$(LibTorchPackageVersion)</VersionPrefix>
9192
<VersionSuffix></VersionSuffix>
9293
</PropertyGroup>

azure-pipelines.yml

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ resources:
4747
# https://github.com/dotnet/versions/blob/main/build-info/docker/image-info.dotnet-dotnet-buildtools-prereqs-docker-main.json
4848

4949
- container: UbuntuContainer
50-
image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-mlnet-20210924170306-87445d2
50+
image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-20.04-20240708213715-dcf0bb9
5151

5252
jobs:
5353
- template: /build/ci/job-template.yml
@@ -198,13 +198,13 @@ jobs:
198198
displayName: Download libtorch native CUDA binaries
199199

200200

201-
- script: dotnet build -c $(BuildConfig) src/TorchSharp/TorchSharp.csproj /p:SkipCuda=true /p:SkipTests=true
201+
- script: dotnet build -c $(BuildConfig) src/TorchSharp/TorchSharp.csproj /p:SkipCuda=true /p:SkipTests=true
202202
displayName: Build Windows
203203

204-
- script: dotnet build -c $(BuildConfig) src/TorchVision/TorchVision.csproj /p:SkipCuda=true /p:SkipTests=true
204+
- script: dotnet build -c $(BuildConfig) src/TorchVision/TorchVision.csproj /p:SkipCuda=true /p:SkipTests=true
205205
displayName: Build TorchVision
206206

207-
- script: dotnet build -c $(BuildConfig) src/TorchAudio/TorchAudio.csproj /p:SkipCuda=true /p:SkipTests=true
207+
- script: dotnet build -c $(BuildConfig) src/TorchAudio/TorchAudio.csproj /p:SkipCuda=true /p:SkipTests=true
208208
displayName: Build TorchAudio
209209

210210
- publish: $(Build.SourcesDirectory)/bin/obj/packprep/$(BuildConfig)
@@ -227,13 +227,13 @@ jobs:
227227
condition: eq(variables['BuildLibTorchPackages'], 'true')
228228
displayName: Download libtorch native binaries
229229

230-
- script: dotnet build -c $(BuildConfig) src/TorchSharp/TorchSharp.csproj /p:SkipCuda=true /p:SkipTests=true
230+
- script: dotnet build -c $(BuildConfig) src/TorchSharp/TorchSharp.csproj /p:SkipCuda=true /p:SkipTests=true
231231
displayName: Build mac-x64
232232

233-
- script: dotnet build -c $(BuildConfig) src/TorchVision/TorchVision.csproj /p:SkipCuda=true /p:SkipTests=true
233+
- script: dotnet build -c $(BuildConfig) src/TorchVision/TorchVision.csproj /p:SkipCuda=true /p:SkipTests=true
234234
displayName: Build TorchVision
235235

236-
- script: dotnet build -c $(BuildConfig) src/TorchAudio/TorchAudio.csproj /p:SkipCuda=true /p:SkipTests=true
236+
- script: dotnet build -c $(BuildConfig) src/TorchAudio/TorchAudio.csproj /p:SkipCuda=true /p:SkipTests=true
237237
displayName: Build TorchAudio
238238

239239
- publish: $(Build.SourcesDirectory)/bin/obj/packprep/$(BuildConfig)
@@ -416,8 +416,11 @@ jobs:
416416
- script: rmdir /s /q $(Pipeline.Workspace)\WindowsAssets
417417
displayName: Free up space (windows assets in workspace)
418418

419+
- script: dotnet restore pkg/pack.proj /p:Configuration=Release
420+
displayName: Restore package projects
421+
419422
# Pack TorchSharp (and libtorch-cpu if BuildLibTorchPackages is true)
420-
- script: dotnet pack -c $(BuildConfig) --no-build -v:n /p:SkipNative=true /p:SkipTests=true /p:IncludeTorchSharpPackage=true /p:IncludeLibTorchCpuPackages=$(BuildLibTorchPackages) src/TorchSharp/TorchSharp.csproj
423+
- script: dotnet pack -c $(BuildConfig) --no-build -v:n /p:SkipNative=true /p:SkipTests=true /p:IncludeTorchSharpPackage=true /p:IncludeLibTorchCpuPackages=$(BuildLibTorchPackages) pkg/pack.proj
421424
displayName: Create Packages
422425

423426
- script: rmdir /q /s bin\obj
@@ -473,7 +476,10 @@ jobs:
473476
- script: rmdir /s /q $(Pipeline.Workspace)\WindowsAssets
474477
displayName: Free up space (windows assets in workspace)
475478

476-
- script: dotnet pack -c $(BuildConfig) --no-build -v:n /p:SkipNative=true /p:SkipTests=true /p:IncludeTorchSharpPackage=false /p:IncludeLibTorchCpuPackages=false /p:IncludeLibTorchCudaPackages=true src/TorchSharp/TorchSharp.csproj
479+
- script: dotnet restore pkg/pack.proj /p:Configuration=Release
480+
displayName: Restore package projects
481+
482+
- script: dotnet pack -c $(BuildConfig) --no-build -v:n /p:SkipNative=true /p:SkipTests=true /p:IncludeTorchSharpPackage=false /p:IncludeLibTorchCpuPackages=false /p:IncludeLibTorchCudaPackages=true pkg/pack.proj
477483
displayName: Create Packages
478484

479485
# We are 10GB space-constrained on the Azure Pipelines CI system so clean up what we can
@@ -536,7 +542,10 @@ jobs:
536542
- script: rm -fr $(Pipeline.Workspace)/LinuxAssets
537543
displayName: Free up space (linux assets in workspace)
538544

539-
- script: dotnet pack -c $(BuildConfig) --no-build -v:n /p:SkipNative=true /p:SkipTests=true /p:IncludeTorchSharpPackage=false /p:IncludeLibTorchCpuPackages=false /p:IncludeLibTorchCudaPackages=true src/TorchSharp/TorchSharp.csproj
545+
- script: dotnet restore pkg/pack.proj /p:Configuration=Release
546+
displayName: Restore package projects
547+
548+
- script: dotnet pack -c $(BuildConfig) --no-build -v:n /p:SkipNative=true /p:SkipTests=true /p:IncludeTorchSharpPackage=false /p:IncludeLibTorchCpuPackages=false /p:IncludeLibTorchCudaPackages=true pkg/pack.proj
540549
displayName: Create Packages
541550

542551
# We are 10GB space-constrained on the Azure Pipelines CI system so clean up what we can

build/BranchInfo.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<MajorVersion>0</MajorVersion>
44
<MinorVersion>102</MinorVersion>
55
<PatchVersion>7</PatchVersion>
6+
<PreviousPackageVersion>0.102.6</PreviousPackageVersion>
67
</PropertyGroup>
78

89
</Project>

pkg/Directory.Build.targets

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Project>
2+
<Import Project="..\Directory.Build.targets" />
3+
4+
<PropertyGroup Condition="'$(IsPackable)' != 'false' and '$(EnablePackageValidation)' != 'false'">
5+
<EnablePackageValidation>true</EnablePackageValidation>
6+
<PackageValidationBaselineVersion>$(PreviousPackageVersion)</PackageValidationBaselineVersion>
7+
</PropertyGroup>
8+
9+
<Target Name="GetTargetPath" Returns="@(_updatedTargetPath)">
10+
<!-- Repoint up the TargetPath to represent the a matching file from PackagePreparationPath if it exists, otherwise don't return a target path
11+
This fakes what the project output would be if we were using real projects (and not package projects) to represent these libraries. -->
12+
<ItemGroup>
13+
<_targetPathUnderPackagePrep Include="@(TargetPathWithTargetPlatformMoniker->'$(PackagePreparationPath)$(PackageIdFolderName)\lib\$(TargetFramework)\%(FileName)%(Extension)')" />
14+
<_updatedTargetPath Include="@(_targetPathUnderPackagePrep)" Condition="Exists('%(Identity)')" />
15+
</ItemGroup>
16+
</Target>
17+
</Project>

pkg/pack.proj

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,16 @@
1313
<PackProject Include="**\TorchSharp-cuda-windows.nupkgproj" />
1414
<PackProject Include="**\TorchVision.nupkgproj" />
1515
</ItemGroup>
16-
<Target Name="Pack">
16+
<Target Name="Restore">
1717
<Message Text="Restoring packaging projects..." Importance="high" />
18-
19-
<Warning Text="Packages will be incomplete and unusable on linux platforms. To get a complete package you need the LibTorchSharp.so binaries for other platforms and copy them into '$(PackagePreparationPath)' to make complete packages. This is automated by Azure Pipelines."
18+
<MSBuild Projects="%(PackProject.Identity)" Targets="Restore" />
19+
</Target>
20+
<Target Name="Pack" DependsOnTargets="Restore">
21+
<Warning Text="Packages will be incomplete and unusable on linux platforms. To get a complete package you need the LibTorchSharp.so binaries for other platforms and copy them into '$(PackagePreparationPath)' to make complete packages. This is automated by Azure Pipelines."
2022
Condition="'$(IncludeTorchSharpPackage)' == 'true' AND !Exists('$(PackagePreparationPath)\TorchSharp\runtimes\linux-x64\native\libLibTorchSharp.so')" />
21-
<Warning Text="Packages will be incomplete and unusable on win-x64 platform. To get a complete package you need the LibTorchSharp.dll binaries for other platforms and copy them into '$(PackagePreparationPath)' to make complete packages. This is automated by Azure Pipelines."
23+
<Warning Text="Packages will be incomplete and unusable on win-x64 platform. To get a complete package you need the LibTorchSharp.dll binaries for other platforms and copy them into '$(PackagePreparationPath)' to make complete packages. This is automated by Azure Pipelines."
2224
Condition="'$(IncludeTorchSharpPackage)' == 'true' AND !Exists('$(PackagePreparationPath)\TorchSharp\runtimes\win-x64\native\LibTorchSharp.dll')" />
2325

24-
<MSBuild Projects="%(PackProject.Identity)" Targets="Restore" />
2526
<MSBuild Projects="%(PackProject.Identity)" Targets="Pack" />
2627

2728
<Message Text="Done packing!" Importance="high" />

src/Native/LibTorchSharp/CMakeLists.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,13 @@ if(APPLE)
7979
set_target_properties(LibTorchSharp PROPERTIES INSTALL_RPATH "@loader_path;@executable_path;")
8080
endif()
8181

82-
if(NOT WIN32)
83-
# Set C++ standard
84-
set_target_properties(LibTorchSharp PROPERTIES
85-
CXX_STANDARD 17
86-
CXX_STANDARD_REQUIRED ON
87-
)
82+
# Set C++ standard
83+
set_target_properties(LibTorchSharp PROPERTIES
84+
CXX_STANDARD 17
85+
CXX_STANDARD_REQUIRED ON
86+
)
8887

88+
if(NOT WIN32)
8989
# Add C++ specific compile options
9090
target_compile_options(LibTorchSharp PRIVATE
9191
$<$<COMPILE_LANGUAGE:CXX>:-std=c++17>

0 commit comments

Comments
 (0)