Skip to content

[ci] Make VC++ toolchain optional #820

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 22, 2021
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
22 changes: 14 additions & 8 deletions build-tools/scripts/NativeToolchain.targets
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup Condition=" $([MSBuild]::IsOSPlatform ('windows')) And '$(VSINSTALLROOT)' != '' ">
<_VcvarsallPath>$(VSINSTALLROOT)\VC\Auxiliary\Build\vcvarsall.bat</_VcvarsallPath>
</PropertyGroup>

<PropertyGroup Condition=" $([MSBuild]::IsOSPlatform ('windows')) And Exists ('$(_VcvarsallPath)') ">
<NativeToolchainSupported>True</NativeToolchainSupported>
</PropertyGroup>

<PropertyGroup Condition=" !$([MSBuild]::IsOSPlatform ('windows')) ">
<NativeToolchainSupported>True</NativeToolchainSupported>
</PropertyGroup>

<Target Name="GetNativeBuildCommands">
<ItemGroup Condition=" '$(VSINSTALLROOT)' != '' And Exists('$(VSINSTALLROOT)') ">
<_Vcvarsall
Include="$(VSINSTALLROOT)\VC\Auxiliary\Build\vcvarsall.bat"
/>
</ItemGroup>
<PropertyGroup Condition=" '@(_Vcvarsall->Count())' != '0' ">
<_Vcvarsall>%(_Vcvarsall.Identity)</_Vcvarsall>
<PrepareNativeToolchain>call "$(_Vcvarsall)" </PrepareNativeToolchain>
<PropertyGroup Condition=" Exists ('$(_VcvarsallPath)') ">
<PrepareNativeToolchain>call "$(_VcvarsallPath)" </PrepareNativeToolchain>
</PropertyGroup>
<PropertyGroup>
<CmakeGenerator Condition=" $([MSBuild]::IsOSPlatform ('windows')) ">-G "NMake Makefiles"</CmakeGenerator>
Expand Down
3 changes: 2 additions & 1 deletion src/java-interop/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<_JavaInteropNativeLib Include="CMakeLists.txt" />
</ItemGroup>

<ItemGroup>
<ItemGroup Condition=" '$(NativeToolchainSupported)' == 'True' ">
<None Include="@(_JavaInteropNativeLib->'$(OutputPath)%(Dir)$(_JavaInteropLibName)')">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link>%(Dir)$(_JavaInteropLibName)</Link>
Expand Down Expand Up @@ -60,6 +60,7 @@
</Target>

<Target Name="_BuildLibs"
Condition=" '$(NativeToolchainSupported)' == 'True' "
DependsOnTargets="GetNativeBuildCommands;_BuildJni_c;_GetCmakeOptions"
BeforeTargets="Build"
Inputs="@(_JavaInteropNativeLib);$(MSBuildThisFileFullPath);java-interop.csproj;@(ClInclude);@(ClCompile)"
Expand Down
3 changes: 2 additions & 1 deletion tests/NativeTiming/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<_NativeTimingLib Include="CMakeLists.txt" />
</ItemGroup>

<ItemGroup>
<ItemGroup Condition=" '$(NativeToolchainSupported)' == 'True' ">
<None Include="@(_NativeTimingLib->'$(OutputPath)%(Dir)$(_NativeTimingLibName)')">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link>%(Dir)$(_NativeTimingLibName)</Link>
Expand All @@ -40,6 +40,7 @@
</ItemGroup>

<Target Name="_BuildLibs"
Condition=" '$(NativeToolchainSupported)' == 'True' "
BeforeTargets="Build"
DependsOnTargets="GetNativeBuildCommands"
Inputs="@(_NativeTimingLib);$(MSBuildThisFileFullPath);NativeTiming.csproj;@(ClInclude);@(ClCompile)"
Expand Down