1.生成一个自定义的属性页文件
CommonSettings.props
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros">
<BuildDir>$(SolutionDir)Build</BuildDir>
<IERoot>C:\Intel\computer_vision_sdk_2018.5.456\deployment_tools\inference_engine</IERoot>
<OpenCVRoot>E:\AI\opencv-4.0.1</OpenCVRoot>
<CuDnnPath>C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2</CuDnnPath>
</PropertyGroup>
<PropertyGroup >
<LibraryPath>$(IERoot)\lib\intel64\$(Configuration);$(OpenCVRoot)\build\$(Platform)\vc14\lib;$(LibraryPath)</LibraryPath>
<IncludePath>$(IERoot)\samples\thirdparty;$(IERoot)\include;$(OpenCVRoot)\build\include;$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<Optimization>Full</Optimization>
<PreprocessorDefinitions>NDEBUG;WIN32;_WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<DisableSpecificWarnings>4819;</DisableSpecificWarnings>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<GenerateDebugInformation>false</GenerateDebugInformation>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>inference_engine.lib;libiomp5md.lib;opencv_world401.lib;$(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;WIN32;_WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<DisableSpecificWarnings>4819;</DisableSpecificWarnings>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>inference_engined.lib;libiomp5md.lib;opencv_world401d.lib;$(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
</Project>
2. 在.sln文件里增加属性页文件
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "props", "props", "{632DD6E1-28DF-42F9-AD7F-1C1F2D38765C}"
ProjectSection(SolutionItems) = preProject
CommonSettings.props = CommonSettings.props
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tiny_yolov3_image_detect", "tiny_yolov3_image_detect.vcxproj", "{F82D5D8C-7C26-4D2B-8690-7BC8C26E3030}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F82D5D8C-7C26-4D2B-8690-7BC8C26E3030}.Debug|x64.ActiveCfg = Debug|x64
{F82D5D8C-7C26-4D2B-8690-7BC8C26E3030}.Debug|x64.Build.0 = Debug|x64
{F82D5D8C-7C26-4D2B-8690-7BC8C26E3030}.Release|x64.ActiveCfg = Release|x64
{F82D5D8C-7C26-4D2B-8690-7BC8C26E3030}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
3. 在.vcxproj里面增加
<ImportGroup Label="PropertySheets" Condition="Exists('$(SolutionDir)CommonSettings.props')">
<Import Project="$(SolutionDir)CommonSettings.props" />
</ImportGroup>