vcxproj_defs.include 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <%namespace file="packages.include" import="gen_package_props,gen_package_targets,gen_package_ensure"/>\
  2. <%def name="get_repo_root()">..\..</%def>\
  3. <%def name="to_windows_path(path)">${path.replace('/','\\')}</%def>\
  4. <%def name="get_subsystem(is_library)">${'Windows' if is_library else 'Console'}</%def>\
  5. <%def name="gen_project(name, libs, targets, configuration_type = 'StaticLibrary', project_guid = None, additional_props = [], packages = [])">\
  6. % for project in vsprojects:
  7. % if project.name == name:
  8. <?xml version="1.0" encoding="utf-8"?>
  9. <Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  10. ${gen_package_props(packages)}\
  11. <ItemGroup Label="ProjectConfigurations">
  12. <ProjectConfiguration Include="Debug|Win32">
  13. <Configuration>Debug</Configuration>
  14. <Platform>Win32</Platform>
  15. </ProjectConfiguration>
  16. <ProjectConfiguration Include="Release|Win32">
  17. <Configuration>Release</Configuration>
  18. <Platform>Win32</Platform>
  19. </ProjectConfiguration>
  20. </ItemGroup>
  21. <PropertyGroup Label="Globals">
  22. <ProjectGuid>${project_guid if project_guid else project.vs_project_guid}</ProjectGuid>
  23. </PropertyGroup>
  24. <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
  25. <PropertyGroup Condition="'$(VisualStudioVersion)' == '10.0'" Label="Configuration">
  26. <PlatformToolset>v100</PlatformToolset>
  27. </PropertyGroup>
  28. <PropertyGroup Condition="'$(VisualStudioVersion)' == '11.0'" Label="Configuration">
  29. <PlatformToolset>v110</PlatformToolset>
  30. </PropertyGroup>
  31. <PropertyGroup Condition="'$(VisualStudioVersion)' == '12.0'" Label="Configuration">
  32. <PlatformToolset>v120</PlatformToolset>
  33. </PropertyGroup>
  34. <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
  35. <ConfigurationType>${configuration_type}</ConfigurationType>
  36. <UseDebugLibraries>true</UseDebugLibraries>
  37. <CharacterSet>Unicode</CharacterSet>
  38. </PropertyGroup>
  39. <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
  40. <ConfigurationType>${configuration_type}</ConfigurationType>
  41. <UseDebugLibraries>false</UseDebugLibraries>
  42. <WholeProgramOptimization>true</WholeProgramOptimization>
  43. <CharacterSet>Unicode</CharacterSet>
  44. </PropertyGroup>
  45. <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
  46. <ImportGroup Label="ExtensionSettings">
  47. </ImportGroup>
  48. <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
  49. <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  50. <Import Project="..\global.props" />
  51. % for prop in additional_props:
  52. <Import Project="..\${prop}.props" />
  53. % endfor
  54. </ImportGroup>
  55. <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
  56. <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  57. <Import Project="..\global.props" />
  58. % for prop in additional_props:
  59. <Import Project="..\${prop}." />
  60. % endfor
  61. </ImportGroup>
  62. <PropertyGroup Label="UserMacros" />
  63. <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
  64. <TargetName>${name}</TargetName>
  65. </PropertyGroup>
  66. <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
  67. <TargetName>${name}</TargetName>
  68. </PropertyGroup>
  69. <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
  70. <ClCompile>
  71. <PrecompiledHeader>NotUsing</PrecompiledHeader>
  72. <WarningLevel>Level3</WarningLevel>
  73. <Optimization>Disabled</Optimization>
  74. <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  75. <SDLCheck>true</SDLCheck>
  76. </ClCompile>
  77. <Link>
  78. <SubSystem>${get_subsystem(project.is_library)}</SubSystem>
  79. <GenerateDebugInformation>true</GenerateDebugInformation>
  80. </Link>
  81. </ItemDefinitionGroup>
  82. <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
  83. <ClCompile>
  84. <WarningLevel>Level3</WarningLevel>
  85. <PrecompiledHeader>NotUsing</PrecompiledHeader>
  86. <Optimization>MaxSpeed</Optimization>
  87. <FunctionLevelLinking>true</FunctionLevelLinking>
  88. <IntrinsicFunctions>true</IntrinsicFunctions>
  89. <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  90. <SDLCheck>true</SDLCheck>
  91. </ClCompile>
  92. <Link>
  93. <SubSystem>${get_subsystem(project.is_library)}</SubSystem>
  94. <GenerateDebugInformation>true</GenerateDebugInformation>
  95. <EnableCOMDATFolding>true</EnableCOMDATFolding>
  96. <OptimizeReferences>true</OptimizeReferences>
  97. </Link>
  98. </ItemDefinitionGroup>
  99. % if project.get('public_headers',[]):
  100. <ItemGroup>
  101. % for public_header in project.public_headers:
  102. <ClInclude Include="${get_repo_root()}\${to_windows_path(public_header)}" />
  103. % endfor
  104. </ItemGroup>
  105. % endif
  106. % if project.get('headers',[]):
  107. <ItemGroup>
  108. % for header in project.headers:
  109. <ClInclude Include="${get_repo_root()}\${to_windows_path(header)}" />
  110. % endfor
  111. </ItemGroup>
  112. % endif
  113. % if project.get('src',[]):
  114. <ItemGroup>
  115. % for src_name in project.src:
  116. <ClCompile Include="${get_repo_root()}\${to_windows_path(src_name)}">
  117. </ClCompile>
  118. % endfor
  119. </ItemGroup>
  120. % endif
  121. % if project.get('deps',[]):
  122. <ItemGroup>
  123. % for dep in project.deps:
  124. <ProjectReference Include="..\${dep}\${dep}.vcxproj">
  125. <Project>${vsproject_dict[dep].vs_project_guid}</Project>
  126. </ProjectReference>
  127. % endfor
  128. </ItemGroup>
  129. % endif
  130. %if packages:
  131. <ItemGroup>
  132. <None Include="packages.config" />
  133. </ItemGroup>
  134. %endif
  135. <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
  136. <ImportGroup Label="ExtensionTargets">
  137. ${gen_package_targets(packages)}\
  138. </ImportGroup>
  139. ${gen_package_ensure(packages)}\
  140. </Project>
  141. % endif
  142. % endfor
  143. </%def>\