Skip to content

Commit

Permalink
Add ability to download eigen and unzip in the msbuild targets.
Browse files Browse the repository at this point in the history
  • Loading branch information
lovettchris committed Mar 11, 2017
1 parent 2f2ba32 commit 96a3ae9
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 51 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -305,3 +305,4 @@ deps/
/cmake/output/lib
/AirLib/include/controllers/html
/AirLib/include/controllers/latex
/Eigen3
8 changes: 4 additions & 4 deletions AirLib/AirLib.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>include;$(EIGEN_ROOT)\Eigen3;$(BOOST_ROOT);deps\rpclib\include;..\MavLinkCom\include</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>include;$(EIGEN_ROOT)\Eigen3;deps\rpclib\include;..\MavLinkCom\include</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
<AdditionalOptions>/w34263 /w34266 %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
Expand All @@ -217,7 +217,7 @@
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>include;$(EIGEN_ROOT)\Eigen3;$(BOOST_ROOT);deps\rpclib\include;..\MavLinkCom\include</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>include;$(EIGEN_ROOT)\Eigen3;deps\rpclib\include;..\MavLinkCom\include</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
<AdditionalOptions>/w34263 /w34266 %(AdditionalOptions)</AdditionalOptions>
<DisableSpecificWarnings>4100;4505;4820;4464;4514;4710;4571;%(DisableSpecificWarnings)</DisableSpecificWarnings>
Expand All @@ -244,7 +244,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>include;$(EIGEN_ROOT)\Eigen3;$(BOOST_ROOT);deps\rpclib\include;..\MavLinkCom\include</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>include;$(EIGEN_ROOT)\Eigen3;deps\rpclib\include;..\MavLinkCom\include</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
<AdditionalOptions>/w34263 /w34266 %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
Expand Down Expand Up @@ -272,7 +272,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>include;$(EIGEN_ROOT)\Eigen3;$(BOOST_ROOT);deps\rpclib\include;..\MavLinkCom\include</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>include;$(EIGEN_ROOT)\Eigen3;deps\rpclib\include;..\MavLinkCom\include</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
<AdditionalOptions>/w34263 /w34266 %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
Expand Down
37 changes: 0 additions & 37 deletions AirLib/build/BuildEigen.cmd

This file was deleted.

66 changes: 56 additions & 10 deletions AirLib/build/eigen.targets
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,67 @@
</ItemGroup>

<PropertyGroup>
<PrepareForBuildDependsOn>$(PrepareForBuildDependsOn);InvokeEigenBuild</PrepareForBuildDependsOn>
<PrepareForBuildDependsOn>$(PrepareForBuildDependsOn);InvokeRpcLibBuild;InvokeEigenBuild</PrepareForBuildDependsOn>
<EIGEN_ROOT Condition="'$(EIGEN_ROOT)'==''">$(MSBuildThisFileDirectory)\..\..</EIGEN_ROOT>
</PropertyGroup>

<Target Name="InvokeEigenBuild"
<Target Name="InvokeRpcLibBuild"
Inputs="@(EigenLibraries)"
Outputs="$(MSBuildThisFileDirectory)\..\AirLib\deps\rpclib\lib\x64\$(Configuration)\rpc.lib">
Outputs="$(MSBuildThisFileDirectory)\..\deps\rpclib\lib\x64\$(Configuration)\rpc.lib"
Condition="!Exists('$(MSBuildThisFileDirectory)\..\deps\rpclib\lib\x64\$(Configuration)\rpc.lib')">

<Message Importance="High" Text="######## Building Eigen Library"/>
<Message Importance="High" Text="######## Building Rpclib"/>
<Exec
Command="$(MSBuildThisFileDirectory)\BuildEigen.cmd"
WorkingDirectory="$(MSBuildThisFileDirectory)"
Outputs="$(MSBuildThisFileDirectory)\..\AirLib\deps\rpclib\lib\x64\$(Configuration)\rpc.lib"
>
<Output TaskParameter="Outputs" ItemName="FileWrites" />
</Exec>
Command="$(MSBuildThisFileDirectory)\BuildRpcLib.cmd"
WorkingDirectory="$(MSBuildThisFileDirectory)">
</Exec>
</Target>

<!-- This simple inline task does nothing. -->
<UsingTask
TaskName="GetEigen"
TaskFactory="CodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v12.0.dll" >
<ParameterGroup >
<TargetDirectory ParameterType="System.String" Required="true" />
<EigenSourceUrl ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Net.Http" />
<Using Namespace="System.IO" />
<Using Namespace="System.IO.Compression" />
<Code Type="Fragment" Language="cs">
<![CDATA[
var client = new System.Net.Http.HttpClient();
Log.LogMessage(MessageImportance.High, "Downloading Eigen from " + EigenSourceUrl);
var stream = client.GetStreamAsync(new System.Uri(EigenSourceUrl)).Result;
string zipFile = Path.Combine(TargetDirectory, "3.3.2.zip");
using (var file = File.Create(zipFile))
{
stream.CopyTo(file);
}
string finalDir = Path.Combine(TargetDirectory, "Eigen3");
Log.LogMessage(MessageImportance.High, "Extracting Eigen to "+ finalDir);
ZipFile.ExtractToDirectory(zipFile, TargetDirectory);
Directory.Move(Path.Combine(TargetDirectory, "eigen-eigen-da9b4e14c255"), finalDir);
File.Delete(zipFile);
]]>
</Code>
</Task>
</UsingTask>


<Target Name="InvokeEigenBuild"
Inputs="@(EigenLibraries)"
Outputs="$(EIGEN_ROOT)\Eigen3\signature_of_eigen3_matrix_library"
Condition="!Exists('$(EIGEN_ROOT)\Eigen3\signature_of_eigen3_matrix_library')">

<Message Importance="High" Text="######## Making sure we have Eigen "/>

<GetEigen TargetDirectory="$(EIGEN_ROOT)"
EigenSourceUrl="http://bitbucket.org/eigen/eigen/get/3.3.2.zip"/>

</Target>
</Project>
1 change: 1 addition & 0 deletions DroneServer/DroneServer.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@
<ClCompile Include="main.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<Import Project="$(MSBuildThisFileDirectory)\..\AirLib\build\eigen.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
1 change: 1 addition & 0 deletions DroneShell/DroneShell.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@
<ClInclude Include="include\SimpleShell.hpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<Import Project="$(MSBuildThisFileDirectory)\..\AirLib\build\eigen.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
1 change: 1 addition & 0 deletions HelloDrone/HelloDrone.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<Import Project="$(MSBuildThisFileDirectory)\..\AirLib\build\eigen.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

0 comments on commit 96a3ae9

Please sign in to comment.