|
| 1 | +<Project> |
| 2 | + |
| 3 | + <PropertyGroup> |
| 4 | + <_NativeTimingLibName Condition=" '$(OS)' != 'Windows_NT' And Exists ('/Library/Frameworks/') ">libNativeTiming.dylib</_NativeTimingLibName> |
| 5 | + <_NativeTimingLibName Condition=" '$(OS)' != 'Windows_NT' And !Exists ('/Library/Frameworks/') ">libNativeTiming.so</_NativeTimingLibName> |
| 6 | + <_NativeTimingLibName Condition=" '$(OS)' == 'Windows_NT' ">NativeTiming.dll</_NativeTimingLibName> |
| 7 | + <_NativeTimingOutputPath>$(OutputPath)$(_NativeTimingLibName)</_NativeTimingOutputPath> |
| 8 | + </PropertyGroup> |
| 9 | + |
| 10 | + <ItemGroup> |
| 11 | + <None Include="$(_NativeTimingOutputPath)"> |
| 12 | + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> |
| 13 | + </None> |
| 14 | + </ItemGroup> |
| 15 | + |
| 16 | + <Target Name="_BuildLibs" |
| 17 | + BeforeTargets="Build" |
| 18 | + DependsOnTargets="_PrepareCmake;_BuildNativeTiming"> |
| 19 | + </Target> |
| 20 | + |
| 21 | + <Target Name="_GetBuildComands"> |
| 22 | + <ItemGroup> |
| 23 | + <_Vcvarsall |
| 24 | + Condition=" '$(VSINSTALLROOT)' != '' And Exists('$(VSINSTALLROOT)') " |
| 25 | + Include="$(VSINSTALLROOT)\VC\Auxiliary\Build\vcvarsall.bat" |
| 26 | + /> |
| 27 | + </ItemGroup> |
| 28 | + <PropertyGroup Condition=" '@(_Vcvarsall->Count())' != '0' "> |
| 29 | + <_Vcvarsall>%(_Vcvarsall.Identity)</_Vcvarsall> |
| 30 | + <_PrepareToolchain>call "$(_Vcvarsall)" x86_amd64 && </_PrepareToolchain> |
| 31 | + </PropertyGroup> |
| 32 | + <PropertyGroup> |
| 33 | + <_Make Condition=" '$(OS)' != 'Windows_NT' ">make</_Make> |
| 34 | + <_Make Condition=" '$(OS)' == 'Windows_NT' ">nmake</_Make> |
| 35 | + </PropertyGroup> |
| 36 | + </Target> |
| 37 | + |
| 38 | + <Target Name="_PrepareCmake" |
| 39 | + DependsOnTargets="_GetBuildComands" |
| 40 | + Inputs="CMakeLists.txt;$(MSBuildThisFileFullPath);NativeTiming.csproj" |
| 41 | + Outputs="$(IntermediateOutputPath)CMakeCache.txt"> |
| 42 | + <MakeDir Directories="$(IntermediateOutputPath)" /> |
| 43 | + <PropertyGroup> |
| 44 | + <_JdkDirs>"-DJDK_INCLUDE_LIST=@(JdkIncludePath, ';')"</_JdkDirs> |
| 45 | + <_CmakeGenerator Condition=" '$(OS)' != 'Windows_NT' ">-G "Unix Makefiles"</_CmakeGenerator> |
| 46 | + <_CmakeGenerator Condition=" '$(OS)' == 'Windows_NT' ">-G "NMake Makefiles"</_CmakeGenerator> |
| 47 | + </PropertyGroup> |
| 48 | + <Exec |
| 49 | + ContinueOnError="WarnAndContinue" |
| 50 | + Command="$(_PrepareToolchain) $(CmakePath) $(_CmakeGenerator) -S . -B $(IntermediateOutputPath) $(_JdkDirs)" |
| 51 | + /> |
| 52 | + <PropertyGroup> |
| 53 | + <_CmakeStatus>$(MSBuildLastTaskResult)</_CmakeStatus> |
| 54 | + </PropertyGroup> |
| 55 | + <ReadLinesFromFile |
| 56 | + Condition=" '$(_CmakeStatus)' == 'false' " |
| 57 | + File="$(IntermediateOutputPath)CMakeFiles/CMakeOutput.log"> |
| 58 | + <Output TaskParameter="Lines" ItemName="_CmakeLog" /> |
| 59 | + </ReadLinesFromFile> |
| 60 | + <Message |
| 61 | + Condition=" '$(_CmakeStatus)' == 'false' " |
| 62 | + Text="CMakeOutput.log" |
| 63 | + /> |
| 64 | + <Message |
| 65 | + Condition=" '$(_CmakeStatus)' == 'false' " |
| 66 | + Text="@(_CmakeLog, ' |
| 67 | +')" |
| 68 | + /> |
| 69 | + <ReadLinesFromFile |
| 70 | + Condition=" '$(_CmakeStatus)' == 'false' " |
| 71 | + File="$(IntermediateOutputPath)CMakeFiles/CMakeError.log"> |
| 72 | + <Output TaskParameter="Lines" ItemName="_CmakeErrorLog" /> |
| 73 | + </ReadLinesFromFile> |
| 74 | + <Message |
| 75 | + Condition=" '$(_CmakeStatus)' == 'false' " |
| 76 | + Text="CMakeError.log" |
| 77 | + /> |
| 78 | + <Message |
| 79 | + Condition=" '$(_CmakeStatus)' == 'false' " |
| 80 | + Text="@(_CmakeErrorLog, ' |
| 81 | +')" |
| 82 | + /> |
| 83 | + <Error |
| 84 | + Condition=" '$(_CmakeStatus)' == 'false' " |
| 85 | + Text="`cmake` failed. See previous messages." |
| 86 | + /> |
| 87 | + <Touch Files="$(IntermediateOutputPath)CMakeCache.txt" /> |
| 88 | + </Target> |
| 89 | + |
| 90 | + <Target Name="_BuildNativeTiming" |
| 91 | + DependsOnTargets="_GetBuildComands" |
| 92 | + Inputs="timing.c" |
| 93 | + Outputs="$(_NativeTimingOutputPath)"> |
| 94 | + <Exec |
| 95 | + Command="$(_PrepareToolchain) $(_Make) VERBOSE=1" |
| 96 | + WorkingDirectory="$(IntermediateOutputPath)" |
| 97 | + /> |
| 98 | + <ItemGroup> |
| 99 | + <_Libs Include="$(IntermediateOutputPath)$(_NativeTimingLibName)*" /> |
| 100 | + </ItemGroup> |
| 101 | + <Copy |
| 102 | + SourceFiles="@(_Libs)" |
| 103 | + DestinationFolder="$(OutputPath)" |
| 104 | + /> |
| 105 | + <Touch Files="$(_NativeTimingOutputPath)" /> |
| 106 | + </Target> |
| 107 | + |
| 108 | + <Target Name="_Clean" |
| 109 | + AfterTargets="Clean"> |
| 110 | + <Delete Files="$(_NativeTimingOutputPath)" /> |
| 111 | + </Target> |
| 112 | + |
| 113 | +</Project> |
0 commit comments