Skip to content

Commit

Permalink
add custom files
Browse files Browse the repository at this point in the history
  • Loading branch information
OpportunityLiu committed Jul 17, 2019
1 parent 45ffee4 commit 0f9361c
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 8 deletions.
17 changes: 17 additions & 0 deletions xmake/plugins/project/vsxmake/vsproj/Xmake.props
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,21 @@
<OutDir>$(XmakeTargetDir)</OutDir>
<IntDir>$(XmakeBuilDir).vs\$(TargetName)\$(XmakeArch)\$(XmakeMode)\</IntDir>
</PropertyGroup>

<!-- Common files -->
<ItemGroup>
<None Condition="Exists('$(MSBuildProjectDirectory)\Xmake.Custom.props')"
Include="$(MSBuildProjectDirectory)\Xmake.Custom.props" />
<None Condition="Exists('$(MSBuildProjectDirectory)\Xmake.Custom.targets')"
Include="$(MSBuildProjectDirectory)\Xmake.Custom.targets" />
<None Condition="Exists('$(MSBuildProjectDirectory)\Xmake.Custom.files')"
Include="$(MSBuildProjectDirectory)\Xmake.Custom.files" />
<None Condition="Exists('$(MSBuildProjectDirectory)\Xmake.Custom.files.filters')"
Include="$(MSBuildProjectDirectory)\Xmake.Custom.files.filters" />
<None Condition="'$(XmakeScriptDir)' != '$(XmakeProjectDir)' And Exists('$(XmakeScriptDir)\xmake.lua')"
Include="$(XmakeScriptDir)\xmake.lua" />
</ItemGroup>

<Import Condition="Exists('$(MSBuildProjectDirectory)\Xmake.Custom.files')"
Project="$(MSBuildProjectDirectory)\Xmake.Custom.files" />
</Project>
11 changes: 11 additions & 0 deletions xmake/plugins/project/vsxmake/vsproj/templates/Xmake.Custom.files
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
Use this file to include custom files for visual studio projects.
This file will be imported by .vcxproj
-->
<ItemGroup>
<!-- <None Include="$(XmakeProjectDir)\xxx\yyy\zzz" /> -->
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
Use this file to include custom files for visual studio projects.
This file will be imported by .vcxproj.filters
-->
<ItemGroup>
<!-- <None Include="$(XmakeProjectDir)\xxx\yyy\zzz">
<Filter>xxx\yyy</Filter>
</None> -->
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,16 @@
#Import(Filter)#
</ItemGroup>
<ItemGroup>
<None Include="Xmake.Custom.props">
<None Include="$(MSBuildProjectDirectory)\Xmake.Custom.props">
<Filter>Properties</Filter>
</None>
<None Include="Xmake.Custom.targets">
<None Include="$(MSBuildProjectDirectory)\Xmake.Custom.targets">
<Filter>Properties</Filter>
</None>
<None Include="$(MSBuildProjectDirectory)\Xmake.Custom.files">
<Filter>Properties</Filter>
</None>
<None Include="$(MSBuildProjectDirectory)\Xmake.Custom.files.filters">
<Filter>Properties</Filter>
</None>
<None Include="$(XmakeScriptDir)\xmake.lua">
Expand All @@ -43,4 +49,6 @@
<ItemGroup>
#Import(File.rc)#
</ItemGroup>
<Import Condition="Exists('$(MSBuildThisFileDirectory)\Xmake.Custom.files.filters')"
Project="$(MSBuildThisFileDirectory)\Xmake.Custom.files.filters" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@
#Import(XmakeConfig)#
#Import(XmakePath)#
<Import Project="$(XmakeProgramDir)\plugins\project\vsxmake\vsproj\xmake.props" />
<ItemGroup>
<None Include="Xmake.Custom.props" />
<None Include="Xmake.Custom.targets" />
<None Condition="'$(XmakeScriptDir)' != '$(XmakeProjectDir)' And Exists('$(XmakeScriptDir)\xmake.lua')"
Include="$(XmakeScriptDir)\xmake.lua" />
</ItemGroup>
<ItemGroup>
#Import(Include)#
</ItemGroup>
Expand Down
4 changes: 4 additions & 0 deletions xmake/plugins/project/vsxmake/vsxmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ local template_fil = path.join(template_root, "vcxproj.filters", "#target#.vcxpr
local template_usr = path.join(template_root, "#target#.vcxproj.user")
local template_props = path.join(template_root, "Xmake.Custom.props")
local template_targets = path.join(template_root, "Xmake.Custom.targets")
local template_files = path.join(template_root, "Xmake.Custom.files")
local template_filefil = path.join(template_root, "Xmake.Custom.files.filters")

function _filter_files(files, exts)
local extset = hashset.from(exts)
Expand Down Expand Up @@ -153,6 +155,8 @@ function make(version)
-- add project custom file
_trycp(template_props, proj_dir)
_trycp(template_targets, proj_dir)
_trycp(template_files, proj_dir)
_trycp(template_filefil, proj_dir)
-- add project user file
_trycp(template_usr, proj_dir, target .. ".vcxproj.user")
end
Expand Down

0 comments on commit 0f9361c

Please sign in to comment.