|  | 
|  | 1 | +<Project> | 
|  | 2 | + | 
|  | 3 | +  <Import Project="..\..\build-tools\scripts\NativeToolchain.targets" /> | 
|  | 4 | + | 
|  | 5 | +  <PropertyGroup> | 
|  | 6 | +    <_JavaInteropLibName Condition=" $([MSBuild]::IsOSPlatform ('osx')) ">libjava-interop.dylib</_JavaInteropLibName> | 
|  | 7 | +    <_JavaInteropLibName Condition=" $([MSBuild]::IsOSPlatform ('linux')) ">libjava-interop.so</_JavaInteropLibName> | 
|  | 8 | +    <_JavaInteropLibName Condition=" $([MSBuild]::IsOSPlatform ('windows')) ">java-interop.dll</_JavaInteropLibName> | 
|  | 9 | +  </PropertyGroup> | 
|  | 10 | + | 
|  | 11 | +  <ItemGroup Condition=" $([MSBuild]::IsOSPlatform ('windows')) "> | 
|  | 12 | +    <_JavaInteropNativeLib Include="CMakeLists.txt"> | 
|  | 13 | +      <Arch>x86_amd64</Arch> | 
|  | 14 | +      <Dir>win-x64\</Dir> | 
|  | 15 | +    </_JavaInteropNativeLib> | 
|  | 16 | +    <_JavaInteropNativeLib Include="CMakeLists.txt"> | 
|  | 17 | +      <Arch>x86</Arch> | 
|  | 18 | +      <Dir>win-x86\</Dir> | 
|  | 19 | +    </_JavaInteropNativeLib> | 
|  | 20 | +  </ItemGroup> | 
|  | 21 | + | 
|  | 22 | +  <ItemGroup Condition=" !$([MSBuild]::IsOSPlatform ('windows')) "> | 
|  | 23 | +    <_JavaInteropNativeLib Include="CMakeLists.txt" /> | 
|  | 24 | +  </ItemGroup> | 
|  | 25 | + | 
|  | 26 | +  <ItemGroup> | 
|  | 27 | +    <None Include="@(_JavaInteropNativeLib->'$(OutputPath)%(Dir)$(_JavaInteropLibName)')"> | 
|  | 28 | +      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | 
|  | 29 | +      <Link>%(Dir)$(_JavaInteropLibName)</Link> | 
|  | 30 | +    </None> | 
|  | 31 | +  </ItemGroup> | 
|  | 32 | + | 
|  | 33 | +  <ItemGroup> | 
|  | 34 | +    <ClInclude Include="*.h" /> | 
|  | 35 | +  </ItemGroup> | 
|  | 36 | + | 
|  | 37 | +  <ItemGroup> | 
|  | 38 | +    <ClCompile Include="$(IntermediateOutputPath)jni.c" /> | 
|  | 39 | +    <ClCompile Include="*.cc" /> | 
|  | 40 | +  </ItemGroup> | 
|  | 41 | + | 
|  | 42 | +  <Target Name="_BuildJni_c" | 
|  | 43 | +      Inputs="$(_JNIEnvGenPath)" | 
|  | 44 | +      Outputs="$(IntermediateOutputPath)jni.c"> | 
|  | 45 | +    <MakeDir Directories="$(OutputPath)" /> | 
|  | 46 | +    <Exec Command="$(_RunJNIEnvGen) $(IntermediateOutputPath)jni.g.cs $(IntermediateOutputPath)jni.c" /> | 
|  | 47 | +  </Target> | 
|  | 48 | + | 
|  | 49 | +  <Target Name="_GetCmakeOptions"> | 
|  | 50 | +    <PropertyGroup Condition=" '$(TargetFramework)' == 'net472' And '@(MonoIncludePath->Count())' != '0' "> | 
|  | 51 | +      <_MonoDirs>"-DMONO_INCLUDE_LIST=@(MonoIncludePath, ';')"</_MonoDirs> | 
|  | 52 | +      <_MonoLib>"-DMONO_LINK_FLAGS=$(MonoLibs)"</_MonoLib> | 
|  | 53 | +      <_EnableMono>-DENABLE_MONO_INTEGRATION=ON</_EnableMono> | 
|  | 54 | +    </PropertyGroup> | 
|  | 55 | +    <PropertyGroup> | 
|  | 56 | +      <_JdkDirs>"-DJDK_INCLUDE_LIST=@(JdkIncludePath, ';')"</_JdkDirs> | 
|  | 57 | +      <_Jni_c>"-DJNI_C_PATH=$(MSBuildThisFileDirectory)$(IntermediateOutputPath)jni.c"</_Jni_c> | 
|  | 58 | +      <_ExtraArgs>$([MSBuild]::Escape('$(_JdkDirs) $(_Jni_c) $(_EnableMono) $(_MonoDirs) $(_MonoLib)'))</_ExtraArgs> | 
|  | 59 | +    </PropertyGroup> | 
|  | 60 | +  </Target> | 
|  | 61 | + | 
|  | 62 | +  <Target Name="_BuildLibs" | 
|  | 63 | +      DependsOnTargets="GetNativeBuildCommands;_BuildJni_c;_GetCmakeOptions" | 
|  | 64 | +      BeforeTargets="Build" | 
|  | 65 | +      Inputs="@(_JavaInteropNativeLib);$(MSBuildThisFileFullPath);java-interop.csproj;@(ClInclude);@(ClCompile)" | 
|  | 66 | +      Outputs="$(OutputPath)%(_JavaInteropNativeLib.Dir)$(_JavaInteropLibName)"> | 
|  | 67 | +    <MakeDir Directories="$(IntermediateOutputPath)%(_JavaInteropNativeLib.Dir)" /> | 
|  | 68 | +    <ItemGroup> | 
|  | 69 | +      <_Cmake | 
|  | 70 | +          Condition=" '$(PrepareNativeToolchain)' != '' " | 
|  | 71 | +          Include="PrepareNativeToolchain=$(PrepareNativeToolchain) %(_JavaInteropNativeLib.Arch)" | 
|  | 72 | +      /> | 
|  | 73 | +      <_Cmake Include="CmakePath=$(CmakePath)" /> | 
|  | 74 | +      <_Cmake Include="CmakeGenerator=$(CmakeGenerator)" /> | 
|  | 75 | +      <_Cmake Include="CmakeSourceDir=$(MSBuildThisFileDirectory)" /> | 
|  | 76 | +      <_Cmake Include="CmakeBuildDir=$(MSBuildThisFileDirectory)$(IntermediateOutputPath)%(_JavaInteropNativeLib.Dir)" /> | 
|  | 77 | +      <_Cmake Include="CmakeExtraArgs=$(_ExtraArgs)" /> | 
|  | 78 | +    </ItemGroup> | 
|  | 79 | +    <MSBuild | 
|  | 80 | +        Projects="..\..\build-tools\scripts\RunCmake.proj" | 
|  | 81 | +        Properties="@(_Cmake)" | 
|  | 82 | +        Targets="Cmake" | 
|  | 83 | +    /> | 
|  | 84 | +    <MakeDir Directories="$(OutputPath)%(_JavaInteropNativeLib.Dir)" /> | 
|  | 85 | +    <ItemGroup> | 
|  | 86 | +      <_Libs Include="$(IntermediateOutputPath)%(_JavaInteropNativeLib.Dir)$(_JavaInteropLibName)*" /> | 
|  | 87 | +    </ItemGroup> | 
|  | 88 | +    <Copy | 
|  | 89 | +        SourceFiles="@(_Libs)" | 
|  | 90 | +        DestinationFolder="$(OutputPath)%(_JavaInteropNativeLib.Dir)" | 
|  | 91 | +    /> | 
|  | 92 | +    <Touch Files="$(OutputPath)%(_JavaInteropNativeLib.Dir)$(_JavaInteropLibName)" /> | 
|  | 93 | +  </Target> | 
|  | 94 | + | 
|  | 95 | +  <Target Name="_Clean" | 
|  | 96 | +      AfterTargets="Clean"> | 
|  | 97 | +    <Delete Files="@(None)" /> | 
|  | 98 | +  </Target> | 
|  | 99 | + | 
|  | 100 | +</Project> | 
0 commit comments