Skip to content

Commit c25e45f

Browse files
Move towards being able to build for x86 (#1008)
1 parent 0b84350 commit c25e45f

File tree

26 files changed

+85
-104
lines changed

26 files changed

+85
-104
lines changed

Directory.Build.props

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88
<Configuration Condition="'$(Configuration)'==''">Debug</Configuration>
99
<Configurations>Debug;Release;Debug-Intrinsics;Release-Intrinsics</Configurations>
1010
<Platform Condition="'$(Platform)'==''">AnyCPU</Platform>
11-
<NativeTargetArchitecture Condition="'$(NativeTargetArchitecture)' == ''">x64</NativeTargetArchitecture>
11+
<TargetArchitecture Condition="'$(TargetArchitecture)' == ''">x64</TargetArchitecture>
12+
<NativeTargetArchitecture Condition="'$(NativeTargetArchitecture)' == ''">$(TargetArchitecture)</NativeTargetArchitecture>
1213
<PlatformConfig>$(Platform).$(Configuration)</PlatformConfig>
1314
</PropertyGroup>
1415

1516
<PropertyGroup>
1617
<RestoreSources>
1718
https://api.nuget.org/v3/index.json;
19+
https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json;
1820
https://dotnet.myget.org/F/dotnet-core/api/v3/index.json;
1921
</RestoreSources>
2022
</PropertyGroup>

pkg/Microsoft.ML/build/netstandard2.0/Microsoft.ML.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
the PlatformTarget is empty, and you don't know until runtime (i.e. which dotnet.exe)
1414
what processor architecture will be used.
1515
-->
16-
<Error Condition="'$(PlatformTarget)' != 'x64' AND
16+
<Error Condition="('$(PlatformTarget)' != 'x64' AND '$(PlatformTarget)' != 'x86') AND
1717
('$(OutputType)' == 'Exe' OR '$(OutputType)'=='WinExe') AND
1818
!('$(TargetFrameworkIdentifier)' == '.NETCoreApp' AND '$(PlatformTarget)' == '')"
19-
Text="Microsoft.ML currently supports 'x64' processor architectures. Please ensure your application is targeting 'x64'." />
19+
Text="Microsoft.ML currently supports 'x64' and 'x86' processor architectures. Please ensure your application is targeting 'x64' or 'x86'." />
2020
</Target>
2121

2222
</Project>

pkg/common/CommonPackage.props

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
1313
<Visible>false</Visible>
1414
</Content>
15+
<Content Include="$(MSBuildThisFileDirectory)\..\..\runtimes\win-x86\native\*.dll"
16+
Condition="'$(PlatformTarget)' == 'x86'">
17+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
18+
<Visible>false</Visible>
19+
</Content>
1520
</ItemGroup>
1621

1722
</Project>

src/Directory.Build.props

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
<WarningsNotAsErrors>$(WarningsNotAsErrors);1591</WarningsNotAsErrors>
1313

1414
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)\Source.ruleset</CodeAnalysisRuleSet>
15-
16-
<TargetArchitecture Condition="'$(TargetArchitecture)' == ''">x64</TargetArchitecture>
1715

1816
<NativeAssetsBuiltPath>$(BaseOutputPath)$(TargetArchitecture).$(Configuration)\Native</NativeAssetsBuiltPath>
1917

src/Microsoft.ML.DnnAnalyzer/Microsoft.ML.DnnAnalyzer/Microsoft.ML.DnnAnalyzer.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
<ProjectReference Include="..\..\Microsoft.ML.TensorFlow\Microsoft.ML.TensorFlow.csproj" />
1212
</ItemGroup>
1313

14-
<ItemGroup>
14+
<!-- TensorFlow is 64-bit only -->
15+
<ItemGroup Condition="'$(NativeTargetArchitecture)' == 'x64'">
1516
<NativeAssemblyReference Include="tensorflow" />
1617
<NativeAssemblyReference Condition="'$(OS)' != 'Windows_NT'" Include="tensorflow_framework" />
1718
</ItemGroup>

src/Native/Stdafx.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#ifdef _WIN32
1515
#include <intrin.h>
1616

17-
#define EXPORT_API(ret) extern "C" __declspec(dllexport) ret __stdcall
17+
#define EXPORT_API(ret) extern "C" __declspec(dllexport) ret
1818
#else
1919
#include "UnixSal.h"
2020

test/Directory.Build.props

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@
2727

2828
<ItemGroup>
2929
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
30-
<PackageReference Include="xunit" Version="2.3.1" />
31-
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
30+
<PackageReference Include="xunit" Version="2.4.0" />
31+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
32+
<PackageReference Include="Microsoft.DotNet.XUnitExtensions" Version="2.4.0-prerelease-63213-02" />
3233
</ItemGroup>
3334

3435
</Project>

test/Microsoft.ML.Core.Tests/Microsoft.ML.Core.Tests.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
<NativeAssemblyReference Include="CpuMathNative" />
3131
<NativeAssemblyReference Include="FastTreeNative" />
3232
<NativeAssemblyReference Include="LdaNative" />
33+
</ItemGroup>
34+
35+
<!-- TensorFlow is 64-bit only -->
36+
<ItemGroup Condition="'$(NativeTargetArchitecture)' == 'x64'">
3337
<NativeAssemblyReference Include="tensorflow" />
3438
<NativeAssemblyReference Condition="'$(OS)' != 'Windows_NT'" Include="tensorflow_framework" />
3539
</ItemGroup>

test/Microsoft.ML.Core.Tests/UnitTests/TestCSharpApi.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -959,7 +959,7 @@ public void TestOvaMacroWithUncalibratedLearner()
959959
}
960960
}
961961

962-
[Fact]
962+
[ConditionalFact(typeof(Environment), nameof(Environment.Is64BitProcess))] // TensorFlow is 64-bit only
963963
public void TestTensorFlowEntryPoint()
964964
{
965965
var dataPath = GetDataPath("Train-Tiny-28x28.txt");

test/Microsoft.ML.Core.Tests/UnitTests/TestEntryPoints.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1787,14 +1787,14 @@ public void EntryPointEvaluateRanking()
17871787
}
17881788
}
17891789

1790-
[Fact]
1790+
[ConditionalFact(typeof(Environment), nameof(Environment.Is64BitProcess))] // LightGBM is 64-bit only
17911791
public void EntryPointLightGbmBinary()
17921792
{
17931793
Env.ComponentCatalog.RegisterAssembly(typeof(LightGbmBinaryPredictor).Assembly);
17941794
TestEntryPointRoutine("breast-cancer.txt", "Trainers.LightGbmBinaryClassifier");
17951795
}
17961796

1797-
[Fact]
1797+
[ConditionalFact(typeof(Environment), nameof(Environment.Is64BitProcess))] // LightGBM is 64-bit only
17981798
public void EntryPointLightGbmMultiClass()
17991799
{
18001800
Env.ComponentCatalog.RegisterAssembly(typeof(LightGbmBinaryPredictor).Assembly);
@@ -3710,7 +3710,7 @@ public void EntryPointWordEmbeddings()
37103710
}
37113711
}
37123712

3713-
[Fact]
3713+
[ConditionalFact(typeof(Environment), nameof(Environment.Is64BitProcess))] // TensorFlow is 64-bit only
37143714
public void EntryPointTensorFlowTransform()
37153715
{
37163716
Env.ComponentCatalog.RegisterAssembly(typeof(TensorFlowTransform).Assembly);

0 commit comments

Comments
 (0)