因为vcxproj是标准xml格式,因此本篇博客的标签也会按照原vcxproj文件标签嵌套。比较重要的部分我用*标出。
<Project>
有话:
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
DefaultTargets="Build",指定默认执行的目标(Target)
- DefaultTargets 是MSBuild的属性
- "Build" 表示当没有明确指定目标时,默认执行名为"Build"的目标
xmlns="http://schemas.microsoft.com/developer/msbuild/2003",XML命名空间声明
- xmlns 是XML命名空间属性
- "http://schemas.microsoft.com/developer/msbuild/2003" 是MSBuild 2003版本的命名空间URI
<ItemGroup Label="ProjectConfigurations">
<ItemGroup Label="ProjectConfigurations">
ItemGroup 元素是MSBuild中用于分组和组织项目项的容器元素,类似于文件夹的概念,用来将相关的项目项归类在一起。Label="ProjectConfigurations" 是一个标识符,用来给这个ItemGroup起个名字,类似于给文件夹命名,方便识别这个分组的用途。
暂时没有发现实际意义。
<ProjectConfiguration>
指明模式与平台。
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<PropertyGroup Label="Globals">
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{2b891091-60e7-4170-9303-82556803aa48}</ProjectGuid>
<RootNamespace>PCLtest2</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>POS_p</ProjectName>
</PropertyGroup>
部分定义了项目的全局属性。这些属性是项目的基本信息,用于标识和配置项目。
<VCProjectVersion>
表示项目的 Visual Studio 项目版本。17.0 对应于 Visual Studio 2022。
<Keyword>
表示项目的类型。Win32Proj 表示这是一个 Windows 32 位应用程序项目。
<ProjectGuid>
项目的唯一标识符(GUID)。每个项目都有一个唯一的 GUID,用于在解决方案中区分不同的项目。
<RootNamespace>
项目的根命名空间。这是项目中所有命名空间的前缀。
<WindowsTargetPlatformVersion>
表示项目目标的 Windows 平台版本。10.0 表示目标是 Windows 10。
<ProjectName>
项目的名称。这是项目在解决方案资源管理器中显示的名称。
<Import Project>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
导入一个预定义的属性文件(.props 文件),这个文件包含了 Visual C++ 项目构建过程中默认的属性设置。
<PropertyGroup Condition>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
定义了项目在特定配置和平台下的属性设置。具体来说,这段代码定义了项目在 Debug 配置 和 Win32 平台 下的构建设置。
<ConfigurationType>
指定项目类型为应用程序(如控制台应用程序或窗口应用程序)。
<UseDebugLibraries>
指定项目在 Debug 配置下使用调试库(如调试版本的 C 运行时库)。
<PlatformToolset>
指定使用的平台工具集版本。v143 对应于 Visual Studio 2022 的工具集。
<CharacterSet>
指定项目使用 Unicode 字符集。
<Import Project>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
导入一个预定义的属性文件(.props 文件),这个文件包含了 Visual C++ 项目构建过程中的一些通用属性和目标设置。
Microsoft.Cpp.Default.props:包含的是最基础的默认属性,这些属性是项目构建的起点。通常在项目文件中首先导入。
Microsoft.Cpp.props:包含的是更详细的通用属性和目标定义,这些设置在项目构建过程中被广泛使用。通常在导入 Microsoft.Cpp.Default.props 之后导入。
<ImportGroup Label="ExtensionSettings">
<ImportGroup Label="ExtensionSettings">
用于分组导入与项目扩展相关的属性文件。这些扩展通常是由 Visual Studio 插件或扩展工具提供的,用于增强项目的功能或修改构建行为。
<ImportGroup Label="Shared">
<ImportGroup Label="Shared">
用于分组导入与项目共享的属性文件。这些共享属性文件通常包含多个配置和平台共用的设置,确保这些设置在不同配置和平台之间保持一致。
<ImportGroup Label="PropertySheets">
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props": 指定了要导入的文件路径。$(UserRootDir) 是一个环境变量,通常指向用户的本地应用数据目录(如 C:\Users\<username>\AppData\Local\Microsoft\MSBuild\v4.0)。$(Platform) 是当前的目标平台(如 Win32 或 x64)。
Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')": 这是一个条件属性,表示只有在指定的文件存在时才导入该文件。这可以防止因文件不存在而导致构建失败。
Label="LocalAppDataPlatform": 这个标签用于标识这个导入的用途。在这里,LocalAppDataPlatform 表示这个导入的文件是与本地应用数据平台相关的。
<PropertyGroup Label="UserMacros" />
空占位符,表示支持用户自定义宏(MSBuild)。
*<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
之前出现过,但是这条没有label。
*<IncludePath>
包含目录,暨头文件。
*<LibraryPath>
库目录,暨静态链接库地址。
<PropertyGroup Label="Vcpkg">
是 Visual Studio 项目文件(.vcxproj)中专门为 vcpkg 预留的空属性组,用来放 vcpkg 自动生成的变量。
<VcpkgEnabled>
是否启用vcpkg。
* <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
*<ClCompile>
编译器选项这项是。
<WarningLevel>
编译器警告等级,Level4 最严,Level1 最松。
<SDLCheck>
额外 Security 编译时检查(缓冲区溢出、未初始化变量等)。
*<PreprocessorDefinitions>
预定义宏,等于编译开关 /D;
关键宏:
・WIN32 32/64 兼容
・_DEBUG Debug 模式
・_CONSOLE 控制台子系统
・_SCL_SECURE_NO_WARNINGS 关 STL 安全警告
・_CRT_SECURE_NO_WARNINGS 关 CRT 安全警告
・NOMINMAX 禁止 min/max 宏冲突
・OSGVIEWER_GRAPHICSWINDOWWIN32 启用 OSG Win32 窗口
%(PreprocessorDefinitions) 把系统默认宏追加进来,必须保留。
<ConformanceMode>
是否启用标准 C++ 一致性模式(/permissive-)。
<EnableEnhancedInstructionSet>
生成 AVX 指令集(/arch:AVX),需 CPU 支持。
<AdditionalIncludeDirectories>
额外头文件搜索路径。
<OpenMPSupport>
是否启用 OpenMP 支持。
<AdditionalOptions>
传给 cl.exe 的任意命令行,%(AdditionalOptions) 保证追加系统额外选项。
*<Link>
链接器选项。
<SubSystem>
控制台子系统(/SUBSYSTEM:CONSOLE)。
<GenerateDebugInformation>
生成 PDB(/DEBUG),让调试器能断点、看符号。
*<AdditionalDependencies>
显式指定要链接的静态库。
<AdditionalLibraryDirectories>
额外库搜索路径。
<PostBuildEvent>
生成后事件。
<Command>
生成后事件命令,如把某文件复制到某目录。
<ItemGroup>
<ClCompile>
需要编译的Cpp文件项。
<ItemGroup>
<ClInclude>
需要编译的头文件项。
<ItemGroup>
<text>
需要包含的其他文件。
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
负责引入 Visual C++ 项目构建过程中定义的构建目标和任务。不可或缺。
附录:作为示例的vcxproj文件内容
有些内容冗长,因此省略了一部分。
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{2b891091-60e7-4170-9303-82556803aa48}</ProjectGuid>
<RootNamespace>PCLtest2</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>POS_p</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<IncludePath>省略一大部分..\..\rapidjson;$(IncludePath)</IncludePath>
<LibraryPath>省略一大部分..\..\PCL 1.12.1\PCL 1.12.1\3rdParty\Boost\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Label="Vcpkg">
<VcpkgEnabled>false</VcpkgEnabled>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;NOMINMAX;OSGVIEWER_GRAPHICSWINDOWWIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
<AdditionalIncludeDirectories>..\..\SU_SDK\headers</AdditionalIncludeDirectories>
<OpenMPSupport>true</OpenMPSupport>
<AdditionalOptions>-openmp:llvm %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>省略一大部分...odbccp32.lib;dxflibd.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\..\SU_SDK\binaries\sketchup\$(PlatformShortName)</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent>
<Command>xcopy /dy "..\..\SU_SDK\binaries\sketchup\$(PlatformShortName)\SketchUpAPI.dll" "$(OutDir)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="mapmaker.cpp" />
<ClCompile Include="mm.cpp" />
<ClCompile Include="modelSimplification.cpp" />
<ClCompile Include="algorithm.cpp" />
<ClCompile Include="GL.cpp" />
<ClCompile Include="OSG.cpp" />
<ClCompile Include="PCL.cpp" />
<ClCompile Include="SF.cpp" />
<ClCompile Include="SU.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="algorithm.hpp" />
<ClInclude Include="GL.h" />
<ClInclude Include="modelSimplification.hpp" />
<ClInclude Include="OSG.h" />
<ClInclude Include="PCL.h" />
<ClInclude Include="SF.hpp" />
<ClInclude Include="SU.h" />
</ItemGroup>
<ItemGroup>
<Text Include="setting.txt" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>
8121

被折叠的 条评论
为什么被折叠?



