Added Visual Studio project generation.
This commit is contained in:
38
util/vs_project_template/solution.sln.jinja
Normal file
38
util/vs_project_template/solution.sln.jinja
Normal file
@@ -0,0 +1,38 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.10.35122.118
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
{%- for executable in project.executables %}
|
||||
Project("{{ generate_uuid(project.name, True) }}") = "{{ executable.name }}", "vs_project_files\{{ executable.name }}.vcxproj", ""{{ generate_uuid('target_' + executable.name, True) }}""
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{{ generate_uuid('solution_items', True) }}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
SConstruct = SConstruct
|
||||
EndProjectSection
|
||||
EndProject
|
||||
{%- endfor %}
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
{%- for build_type in project.build_types %}
|
||||
{%- set build_type_name = build_type | capitalize %}
|
||||
{{ build_type_name }}|x64 = {{ build_type_name }}|x64
|
||||
{%- endfor %}
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{%- for executable in project.executables %}
|
||||
{%- for build_type in project.build_types %}
|
||||
{%- set build_type_name = build_type | capitalize %}
|
||||
{{ generate_uuid('target_' + executable.name, True) }}.{{ build_type_name }}|x64.ActiveCfg = {{ build_type_name }}|x64
|
||||
{{ generate_uuid('target_' + executable.name, True) }}.{{ build_type_name }}|x64.Build.0 = {{ build_type_name }}|x64
|
||||
{%- endfor %}
|
||||
{%- endfor %}
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {{ generate_uuid("solution", True) }}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
15
util/vs_project_template/template.json
Normal file
15
util/vs_project_template/template.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"files": {
|
||||
"solution.sln.jinja": {
|
||||
"rename_to": "{{ project.name }}.sln"
|
||||
},
|
||||
"vs_project_files/target.vcxproj.jinja": {
|
||||
"one_per": "target",
|
||||
"rename_to": "vs_project_files/{{ target.name }}.vcxproj"
|
||||
},
|
||||
"vs_project_files/target.vcxproj.filters.jinja": {
|
||||
"one_per": "target",
|
||||
"rename_to": "vs_project_files/{{ target.name }}.vcxproj.filters"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
{%- set source_files = get_sources(target) -%}
|
||||
{%- set private_headers = get_headers('private\\' + target.module.folder) -%}
|
||||
{%- set public_headers = get_headers('public\\' + target.module.folder) -%}
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="17.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{{ generate_uuid('filter_sources_' + target.name, True) }}</UniqueIdentifier>
|
||||
</Filter>
|
||||
{%- for folder in source_files | folder_list(2) | sort %}
|
||||
<Filter Include="Source Files\{{ folder }}">
|
||||
<UniqueIdentifier>{{ generate_uuid('filter_sources_' + target.name + '_' + folder, True) }}</UniqueIdentifier>
|
||||
</Filter>
|
||||
{%- endfor %}
|
||||
{%- if public_headers | length > 0 %}
|
||||
<Filter Include="Public Header Files">
|
||||
<UniqueIdentifier>{{ generate_uuid('filter_public_headers_' + target.name, True) }}</UniqueIdentifier>
|
||||
</Filter>
|
||||
{%- for folder in public_headers | folder_list(2) | sort %}
|
||||
<Filter Include="Public Header Files\{{ folder }}">
|
||||
<UniqueIdentifier>{{ generate_uuid('filter_public_headers_' + target.name + '_' + folder, True) }}</UniqueIdentifier>
|
||||
</Filter>
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
{%- if private_headers | length > 0 %}
|
||||
<Filter Include="Private Header Files">
|
||||
<UniqueIdentifier>{{ generate_uuid('filter_private_headers_' + target.name, True) }}</UniqueIdentifier>
|
||||
</Filter>
|
||||
{%- for folder in private_headers | folder_list(2) | sort %}
|
||||
<Filter Include="Private Header Files\{{ folder }}">
|
||||
<UniqueIdentifier>{{ generate_uuid('filter_private_headers_' + target.name + '_' + folder, True) }}</UniqueIdentifier>
|
||||
</Filter>
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
{%- for source_file in source_files %}
|
||||
<ClCompile Include="$(SolutionDir){{ source_file }}">
|
||||
{%- set path = source_file | strip_path_prefix(2) | dirname -%}
|
||||
{%- if path %}
|
||||
<Filter>Source Files\{{ path }}</Filter>
|
||||
{%- else %}
|
||||
<Filter>Source Files</Filter>
|
||||
{%- endif %}
|
||||
</ClCompile>
|
||||
{%- endfor %}
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
{%- for header_file in public_headers %}
|
||||
<ClInclude Include="$(SolutionDir){{ header_file }}">
|
||||
{%- set path = header_file | strip_path_prefix(2) | dirname -%}
|
||||
{%- if path %}
|
||||
<Filter>Public Header Files\{{ path }}</Filter>
|
||||
{%- else %}
|
||||
<Filter>Public Header Files</Filter>
|
||||
{%- endif %}
|
||||
</ClInclude>
|
||||
{%- endfor %}
|
||||
{%- for header_file in private_headers %}
|
||||
<ClInclude Include="$(SolutionDir){{ header_file }}">
|
||||
{%- set path = header_file | strip_path_prefix(2) | dirname -%}
|
||||
{%- if path %}
|
||||
<Filter>Private Header Files\{{ path }}</Filter>
|
||||
{%- else %}
|
||||
<Filter>Private Header Files</Filter>
|
||||
{%- endif %}
|
||||
</ClInclude>
|
||||
{%- endfor %}
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="$(SolutionDir)private\{{ target.module.folder }}\SModule" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,67 @@
|
||||
{%- set ms_cxx_standard = {
|
||||
'c++14': 'stdcpp14',
|
||||
'c++17': 'stdcpp17',
|
||||
'c++20': 'stdcpp20',
|
||||
'c++23': 'stdcpplatest',
|
||||
'c++26': 'stdcpplatest'}[project.cxx_standard] | default('stdcpp14')
|
||||
-%}
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="17.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
{%- for build_type in project.build_types %}
|
||||
{% set build_type_name = build_type | capitalize -%}
|
||||
<ProjectConfiguration Include="{{ build_type_name }}|x64">
|
||||
<Configuration>{{ build_type_name }}</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
{%- endfor %}
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<ProjectGuid>{{ generate_uuid('target_' + target.name, True) }}</ProjectGuid>
|
||||
<ProjectName>{{ target.name }}</ProjectName>
|
||||
<SConsCommandLine>{{ scons_exe }}</SConsCommandLine>
|
||||
</PropertyGroup>
|
||||
{%- for build_type in project.build_types %}
|
||||
{% set build_type_name = build_type | capitalize -%}
|
||||
<PropertyGroup Condition="'$(Configuration)'=='{{ build_type_name }}'">
|
||||
<TargetPath>$(SolutionDir){{ target.filename(build_type) }}</TargetPath>
|
||||
<SPPBuildType>{{ build_type }}</SPPBuildType>
|
||||
<SPPTargetType>{{ target.type }}</SPPTargetType>
|
||||
</PropertyGroup>
|
||||
{%- endfor %}
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>Makefile</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ItemGroup>
|
||||
{%- for source_file in get_sources(target) %}
|
||||
<ClCompile Include="$(SolutionDir){{ source_file }}" />
|
||||
{%- endfor %}
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
{%- for header_file in get_headers('private\\' + target.module.folder) %}
|
||||
<ClInclude Include="$(SolutionDir){{ header_file }}" />
|
||||
{%- endfor %}
|
||||
{%- for header_file in get_headers('public\\' + target.module.folder) %}
|
||||
<ClInclude Include="$(SolutionDir){{ header_file }}" />
|
||||
{%- endfor %}
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="$(SolutionDir)private\{{ target.module.folder }}\SModule" />
|
||||
</ItemGroup>
|
||||
{%- for build_type in project.build_types %}
|
||||
{% set build_type_name = build_type | capitalize -%}
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='{{ build_type_name }}'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>{{ get_target_property(build_type, target.name, 'CPPDEFINES') | join(';') }};%(PreprocessorDefinitions);</PreprocessorDefinitions>
|
||||
<GenerateDebugInformation>{{ build_type != 'release' and 'true' or 'false' }}</GenerateDebugInformation>
|
||||
<AdditionalIncludeDirectories>{{ get_target_property(build_type, target.name, 'CPPPATH') | join(';') }};%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MsExtensions>false</MsExtensions>
|
||||
<CppLanguageStd>{{ ms_cxx_standard }}</CppLanguageStd>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
{%- endfor %}
|
||||
<Import Project="$(SolutionDir)external\scons-plus-plus\contrib\vs\spp.targets" />
|
||||
</Project>
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"configurations": [
|
||||
{% for executable in project.executables %}
|
||||
{% for build_type in project.build_types %}
|
||||
{% set build_type_name = build_type | capitalize -%}
|
||||
{%- for executable in project.executables -%}
|
||||
{%- for build_type in project.build_types -%}
|
||||
{%- set build_type_name = build_type | capitalize %}
|
||||
{
|
||||
"name": "{{ executable.name }} ({{ build_type | capitalize }})",
|
||||
"type": "cppvsdbg",
|
||||
@@ -12,9 +12,10 @@
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"console": "integratedTerminal"
|
||||
}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
"console": "integratedTerminal",
|
||||
"preLaunchTask": "{{ executable.name }} {{ build_type_name }}"
|
||||
},
|
||||
{%- endfor %}
|
||||
{%- endfor %}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user