我正在嘗試向一個專案添加額外的配置項,目的是創建一個用戶友好的Dlib專案來編譯和鏈接Dlib。
這是我的.xaml檔案,基于我在visual studio安裝目錄中發現的東西:
<?xml version="1.0" encoding="utf-8"? >/span>
<ProjectSchemaDefinitions xmlns="clr-namespace:Microsoft.Build.Framework.XamlTypes;assembly=Microsoft.Build.Framework"/span>>
< Rule Name="DLibOptionsRule" PageTemplate="generic" DisplayName="DLib settings">
<Rule.Categories>
< Category Name="dlib" DisplayName="DLib" /> >。
</Rule.Categories>
<Rule.DataSource>/span>
< DataSource Persistence="ProjectFile" ItemType="" /> >。
</Rule.DataSource>
< BoolProperty Name="DlibCUDAEnabled" DisplayName="Use CUDA" Default="false" Category="dlib" IncludeInCommandLine="false"/>
< StringProperty Name="DlibCUDAPath" DisplayName="CUDA path" Description="CUDA庫的路徑" Category="dlib" IncludeInCommandLine="false">
<StringProperty.ValueEditors>
< ValueEditor EditorType="DefaultStringPropertyEditor" DisplayName="& lt;編輯。 ...& gt;"/>。
< ValueEditor EditorType="DefaultFilePropertyEditor" DisplayName="& lt;瀏覽。 ...& gt;"/>。
</StringProperty.ValueEditors>
</StringProperty>/span>
</Rule>/span>
</ProjectSchemaDefinitions>
然后我將其包含在這個.target檔案中:
<?xml version="1.0" encoding="utf-8"? >
<Project ToolsVersion="4。 0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>/span>
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)DlibOptions.xaml" />
</ItemGroup>
< Target Name="DlibSetDefines" BeforeTargets="PreBuildEvent">
<Message Text="Setting DLIB_USE_CUDA=%(DlibCUDAEnabled)" />/span>
<ItemGroup>
<ClCompile>/span>
<PreprocessorDefinitions>DLIB_USE_CUDA=%(DlibCUDAEnabled)。 %(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>/span>
</ItemGroup>/span>
</Target>/span>
</Project>/span>
最后,我在Visual Studio專案的結尾部分上方加入目標:
<Import Project="DLibOptions.target" />
<Import Project="$(VCTargetsPath)Microsoft.Cpp.target"/span> />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>/span>
</Project>/span>
我可以在專案屬性對話框中看到配置項:
error MSB4095: The item metadata %(DlibCUDAEnabled) is being referenced without an item name. 通過使用%(itemname.DlibCUDAEnabled)來指定專案名稱。
完整的專案可以在這里找到,如果你愿意看一看。https://github.com/Darker/dlib-vs-solution
uj5u.com熱心網友回復:
問題是
< Message Text="Setting DLIB_USE_CUDA=%(DlibCUDAEnabled)" />
永遠無法作業,因為它沒有指定要顯示哪個專案,所以訊息任務不知道要回圈什么。你可能打算:
<Message Text="設定DLIB_USE_CUDA=%(ClCompile. DlibCUDAEnabled)" />
但這并不超級有用,因為它只是列出了標志。這個更有趣,它顯示了標志 srource檔案:
<Message Text="設定DLIB_USE_CUDA=%(ClCompile. DlibCUDAEnabled)為%(ClCompile.Identity)" />
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/329108.html
標籤:
上一篇:CubemosSkeletonTrackingSDKinUnitywrapper,realsense2.dllnotfound,cubemos_engine.dllnotfound,RealSense
