|
6 | 6 | <_JavaInteropLibName Condition=" '$(OS)' != 'Windows_NT' And Exists ('/Library/Frameworks/') ">libjava-interop.dylib</_JavaInteropLibName>
|
7 | 7 | <_JavaInteropLibName Condition=" '$(OS)' != 'Windows_NT' And !Exists ('/Library/Frameworks/') ">libjava-interop.so</_JavaInteropLibName>
|
8 | 8 | <_JavaInteropLibName Condition=" '$(OS)' == 'Windows_NT' ">java-interop.dll</_JavaInteropLibName>
|
9 |
| - <_JavaInteropOutputPath>$(OutputPath)$(_JavaInteropLibName)</_JavaInteropOutputPath> |
10 |
| - <_BuildDir>$(MSBuildThisFileDirectory)$(IntermediateOutputPath)</_BuildDir> |
11 |
| - <_BuildDir>$(_BuildDir.Replace('%5c', '/'))</_BuildDir> |
| 9 | + </PropertyGroup> |
| 10 | + <PropertyGroup Condition=" '$(OS)' != 'Windows_NT' "> |
| 11 | + <_PrimaryOutputPath>$(OutputPath)$(_JavaInteropLibName)</_PrimaryOutputPath> |
| 12 | + </PropertyGroup> |
| 13 | + <PropertyGroup Condition=" '$(OS)' == 'Windows_NT' "> |
| 14 | + <_PrimaryDir>win-x64</_PrimaryDir> |
| 15 | + <_PrimaryArch>x86_amd64</_PrimaryArch> |
| 16 | + <_PrimaryOutputPath>$(OutputPath)$(_PrimaryDir)\$(_JavaInteropLibName)</_PrimaryOutputPath> |
| 17 | + <_SecondaryDir>win-x86</_SecondaryDir> |
| 18 | + <_SecondaryArch>x86</_SecondaryArch> |
| 19 | + <_SecondaryOutputPath>$(OutputPath)$(_SecondaryDir)\$(_JavaInteropLibName)</_SecondaryOutputPath> |
12 | 20 | </PropertyGroup>
|
13 | 21 |
|
14 |
| - <ItemGroup> |
15 |
| - <None Include="$(_JavaInteropOutputPath)"> |
| 22 | + <ItemGroup Condition=" '$(OS)' == 'Windows_NT' "> |
| 23 | + <None Include="$(_PrimaryOutputPath)"> |
| 24 | + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> |
| 25 | + <Link>$(_PrimaryDir)\$(_JavaInteropLibName)</Link> |
| 26 | + </None> |
| 27 | + <None Include="$(_SecondaryOutputPath)"> |
| 28 | + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> |
| 29 | + <Link>$(_SecondaryDir)\$(_JavaInteropLibName)</Link> |
| 30 | + </None> |
| 31 | + </ItemGroup> |
| 32 | + |
| 33 | + <ItemGroup Condition=" '$(OS)' != 'Windows_NT' "> |
| 34 | + <None Include="$(_PrimaryOutputPath)"> |
16 | 35 | <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
17 | 36 | </None>
|
18 | 37 | </ItemGroup>
|
|
26 | 45 |
|
27 | 46 | <Target Name="_BuildLibs"
|
28 | 47 | BeforeTargets="Build"
|
29 |
| - DependsOnTargets="_PrepareCmake;_BuildJavaInterop"> |
| 48 | + DependsOnTargets="_BuildPrimaryLib;_BuildSecondaryLib"> |
30 | 49 | </Target>
|
31 | 50 |
|
32 |
| - <Target Name="_PrepareCmake" |
33 |
| - DependsOnTargets="GetNativeBuildCommands;_BuildJni_c" |
34 |
| - Inputs="CMakeLists.txt;$(MSBuildThisFileFullPath);NativeTiming.csproj" |
35 |
| - Outputs="$(IntermediateOutputPath)CMakeCache.txt"> |
36 |
| - <MakeDir Directories="$(IntermediateOutputPath)" /> |
| 51 | + <Target Name="_GetCmakeOptions"> |
37 | 52 | <PropertyGroup Condition=" '$(TargetFramework)' == 'net472' And '@(MonoIncludePath->Count())' != '0' ">
|
38 | 53 | <_MonoDirs>"-DMONO_INCLUDE_LIST=@(MonoIncludePath, ';')"</_MonoDirs>
|
39 | 54 | <_MonoLib>"-DMONO_LINK_FLAGS=$(MonoLibs)"</_MonoLib>
|
|
42 | 57 | <PropertyGroup>
|
43 | 58 | <_JdkDirs>"-DJDK_INCLUDE_LIST=@(JdkIncludePath, ';')"</_JdkDirs>
|
44 | 59 | <_Jni_c>"-DJNI_C_PATH=$(MSBuildThisFileDirectory)$(IntermediateOutputPath)jni.c"</_Jni_c>
|
45 |
| - <_ExtraArgs>$([MSBuild]::Escape('$(_JdkDirs) $(_Jni_c) $(_EnableMono) $(_MonoDirs) $(_MonoLib)').Replace('%5c', '/'))</_ExtraArgs> |
| 60 | + <_ExtraArgs>$([MSBuild]::Escape('$(_JdkDirs) $(_Jni_c) $(_EnableMono) $(_MonoDirs) $(_MonoLib)'))</_ExtraArgs> |
46 | 61 | </PropertyGroup>
|
| 62 | + </Target> |
| 63 | + |
| 64 | + <Target Name="_BuildPrimaryLib" |
| 65 | + DependsOnTargets="GetNativeBuildCommands;_BuildJni_c;_GetCmakeOptions" |
| 66 | + Inputs="CMakeLists.txt;$(MSBuildThisFileFullPath);java-interop.csproj" |
| 67 | + Outputs="$(_PrimaryOutputPath)"> |
| 68 | + <MakeDir Directories="$(IntermediateOutputPath)$(_PrimaryDir)" /> |
47 | 69 | <ItemGroup>
|
48 |
| - <_Cmake Include="PrepareNativeToolchain=$(PrepareNativeToolchain)" /> |
| 70 | + <_Cmake |
| 71 | + Condition=" '$(PrepareNativeToolchain)' != '' " |
| 72 | + Include="PrepareNativeToolchain=$(PrepareNativeToolchain) $(_PrimaryArch) &&" |
| 73 | + /> |
49 | 74 | <_Cmake Include="CmakePath=$(CmakePath)" />
|
50 | 75 | <_Cmake Include="CmakeGenerator=$(CmakeGenerator)" />
|
51 | 76 | <_Cmake Include="CmakeSourceDir=$(MSBuildThisFileDirectory)" />
|
52 |
| - <_Cmake Include="CmakeBuildDir=$(_BuildDir)" /> |
| 77 | + <_Cmake Include="CmakeBuildDir=$(MSBuildThisFileDirectory)$(IntermediateOutputPath)$(_PrimaryDir)" /> |
53 | 78 | <_Cmake Include="CmakeExtraArgs=$(_ExtraArgs)" />
|
54 | 79 | </ItemGroup>
|
55 | 80 | <MSBuild
|
56 | 81 | Projects="..\..\build-tools\scripts\RunCmake.proj"
|
57 | 82 | Properties="@(_Cmake)"
|
58 | 83 | Targets="Cmake"
|
59 | 84 | />
|
60 |
| - <Touch Files="$(IntermediateOutputPath)CMakeCache.txt" /> |
| 85 | + <MakeDir Directories="$(OutputPath)$(_PrimaryDir)" /> |
| 86 | + <ItemGroup> |
| 87 | + <_Libs Include="$(IntermediateOutputPath)$(_PrimaryDir)\$(_JavaInteropLibName)*" /> |
| 88 | + </ItemGroup> |
| 89 | + <Copy |
| 90 | + SourceFiles="@(_Libs)" |
| 91 | + DestinationFolder="$(OutputPath)$(_PrimaryDir)" |
| 92 | + /> |
| 93 | + <Touch Files="$(_PrimaryOutputPath)" /> |
61 | 94 | </Target>
|
62 | 95 |
|
63 |
| - <Target Name="_BuildJavaInterop" |
64 |
| - DependsOnTargets="GetNativeBuildCommands" |
65 |
| - Inputs="timing.c;$(MSBuildThisFileFullPath);NativeTiming.csproj" |
66 |
| - Outputs="$(_JavaInteropOutputPath)"> |
67 |
| - <Exec |
68 |
| - Command="$(PrepareNativeToolchain) $(CmakePath) --build "$(_BuildDir)" -v" |
69 |
| - WorkingDirectory="$(IntermediateOutputPath)" |
| 96 | + <Target Name="_BuildSecondaryLib" |
| 97 | + Condition=" '$(_SecondaryOutputPath)' != '' " |
| 98 | + DependsOnTargets="GetNativeBuildCommands;_BuildJni_c;_GetCmakeOptions" |
| 99 | + Inputs="CMakeLists.txt;$(MSBuildThisFileFullPath);java-interop.csproj" |
| 100 | + Outputs="$(_SecondaryOutputPath)"> |
| 101 | + <MakeDir Directories="$(IntermediateOutputPath)$(_SecondaryDir)" /> |
| 102 | + <ItemGroup> |
| 103 | + <_Cmake |
| 104 | + Condition=" '$(PrepareNativeToolchain)' != '' " |
| 105 | + Include="PrepareNativeToolchain=$(PrepareNativeToolchain) $(_SecondaryArch) &&" |
| 106 | + /> |
| 107 | + <_Cmake Include="CmakePath=$(CmakePath)" /> |
| 108 | + <_Cmake Include="CmakeGenerator=$(CmakeGenerator)" /> |
| 109 | + <_Cmake Include="CmakeSourceDir=$(MSBuildThisFileDirectory)" /> |
| 110 | + <_Cmake Include="CmakeBuildDir=$(MSBuildThisFileDirectory)$(IntermediateOutputPath)$(_SecondaryDir)" /> |
| 111 | + <_Cmake Include="CmakeExtraArgs=$(_ExtraArgs)" /> |
| 112 | + </ItemGroup> |
| 113 | + <MSBuild |
| 114 | + Projects="..\..\build-tools\scripts\RunCmake.proj" |
| 115 | + Properties="@(_Cmake)" |
| 116 | + Targets="Cmake" |
70 | 117 | />
|
| 118 | + <MakeDir Directories="$(OutputPath)$(_SecondaryDir)" /> |
71 | 119 | <ItemGroup>
|
72 |
| - <_Libs Include="$(IntermediateOutputPath)$(_NativeTimingLibName)*" /> |
| 120 | + <_Libs Include="$(IntermediateOutputPath)$(_SecondaryDir)\$(_JavaInteropLibName)*" /> |
73 | 121 | </ItemGroup>
|
74 | 122 | <Copy
|
75 | 123 | SourceFiles="@(_Libs)"
|
76 |
| - DestinationFolder="$(OutputPath)" |
| 124 | + DestinationFolder="$(OutputPath)$(_SecondaryDir)" |
77 | 125 | />
|
78 |
| - <Touch Files="$(_NativeTimingOutputPath)" /> |
| 126 | + <Touch Files="$(_SecondaryOutputPath)" /> |
79 | 127 | </Target>
|
80 | 128 |
|
81 | 129 | <Target Name="_Clean"
|
82 | 130 | AfterTargets="Clean">
|
83 |
| - <Delete Files="$(_NativeTimingOutputPath)" /> |
| 131 | + <Delete Files="@(None)" /> |
84 | 132 | </Target>
|
85 | 133 |
|
86 | 134 | </Project>
|
0 commit comments