diff options
| author | ruki <[email protected]> | 2019-11-24 22:56:53 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2019-11-24 22:56:53 +0800 |
| commit | dee47ccf498d9ed84e58885257d8f84863922a1a (patch) | |
| tree | eb3b3f5ba300911dd091b6ff9a23eacc54f81310 | |
| parent | e29cec3bf1d41f5dda984dabf48c21b7aaa8ba3b (diff) | |
| parent | 23ae1e8af491342ef3e4f899ed0bdb5dd1a1284a (diff) | |
Merge pull request #628 from OpportunityLiu/dev
Improvement of vsxmake plugin
5 files changed, 21 insertions, 8 deletions
diff --git a/xmake/plugins/project/vsxmake/vsproj/Xmake.props b/xmake/plugins/project/vsxmake/vsproj/Xmake.props index 19cacd77b..3cce0878a 100644 --- a/xmake/plugins/project/vsxmake/vsproj/Xmake.props +++ b/xmake/plugins/project/vsxmake/vsproj/Xmake.props @@ -47,6 +47,10 @@ <XmakeRebuildFile Condition="'$(XmakeRebuildFile)' == ''">false</XmakeRebuildFile> </PropertyGroup> + <PropertyGroup Condition="'$(WindowsTargetPlatformVersion)' == '' And '$(XmakeWindowsSdkVersion)' != ''"> + <WindowsTargetPlatformVersion>$(XmakeWindowsSdkVersion)</WindowsTargetPlatformVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(PlatformToolset)' == ''"> <PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset> <PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset> diff --git a/xmake/plugins/project/vsxmake/vsproj/Xmake.targets b/xmake/plugins/project/vsxmake/vsproj/Xmake.targets index 40ef5fc05..0519c2762 100644 --- a/xmake/plugins/project/vsxmake/vsproj/Xmake.targets +++ b/xmake/plugins/project/vsxmake/vsproj/Xmake.targets @@ -93,9 +93,9 @@ Text="$(XmakeProjectFile) not found at '$(XmakeProjectDirResolved)', please set XmakeProjectDir in vcxproj file" /> </Target> <Target Name="_XmakeConfig" DependsOnTargets="_XmakeProjCheck"> - <Message Text="$xmake config $(_XmakeCommonFlags) $(_XmakeConfigFlags) $(XmakeTarget)" Importance="High" /> + <Message Text="$xmake config $(_XmakeCommonFlags) $(_XmakeConfigFlags)" Importance="High" /> <Exec StdOutEncoding="utf-8" StdErrEncoding="utf-8" Command="$(_XmakeEnv) - $(_XmakeExecutable) config $(_XmakeCommonFlags) $(_XmakeConfigFlags) $(XmakeTarget)" EchoOff="true" /> + $(_XmakeExecutable) config $(_XmakeCommonFlags) $(_XmakeConfigFlags)" EchoOff="true" /> </Target> <Target Name="_XmakeBuild" DependsOnTargets="_XmakeProjCheck"> <Message Text="$xmake build $(_XmakeCommonFlags) $(_XmakeBuildFlags) $(XmakeTarget)" Importance="High" /> @@ -130,6 +130,7 @@ MSBuild Properties: XmakeFilename: $(XmakeFilename) XmakeKind: $(XmakeKind) XmakeCudaVersion: $(XmakeCudaVersion) + XmakeWindowsSdkVersion: $(XmakeWindowsSdkVersion) XmakeMfcKind: $(XmakeMfcKind) XmakeDefines: $(XmakeDefines) XmakeLanguages: $(XmakeLanguages) diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/#target#.vcxproj b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/#target#.vcxproj index 323ed1a25..9083dc278 100644 --- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/#target#.vcxproj +++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/#target#.vcxproj @@ -22,7 +22,6 @@ <XmakeProjectDir>#projectdir#</XmakeProjectDir> <XmakeProjectFile>#projectfile#</XmakeProjectFile> <XmakeTarget>#target#</XmakeTarget> - <WindowsTargetPlatformVersion>#sdkver#</WindowsTargetPlatformVersion> </PropertyGroup> <PropertyGroup Label="XmakeProgram"> <XmakeProgramDir Condition="'$(XmakeProgramDir)' == ''">$(XMAKE_PROGRAM_DIR)</XmakeProgramDir> diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/XmakeConfig(mode,arch) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/XmakeConfig(mode,arch) index 320a661fb..76a1ff3ff 100644 --- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/XmakeConfig(mode,arch) +++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/XmakeConfig(mode,arch) @@ -8,6 +8,7 @@ <XmakeDefines>#defines#</XmakeDefines> <XmakeLanguages>#languages#</XmakeLanguages> <XmakeCudaVersion>#cudaver#</XmakeCudaVersion> + <XmakeWindowsSdkVersion>#sdkver#</XmakeWindowsSdkVersion> <XmakeMfcKind>#mfckind#</XmakeMfcKind> <XmakeRunEnvs>#runenvs#</XmakeRunEnvs> <XmakeConfigFlags>#configflags#</XmakeConfigFlags> diff --git a/xmake/plugins/project/vsxmake/vsxmake.lua b/xmake/plugins/project/vsxmake/vsxmake.lua index 26eeb23fe..3f5cd024d 100644 --- a/xmake/plugins/project/vsxmake/vsxmake.lua +++ b/xmake/plugins/project/vsxmake/vsxmake.lua @@ -125,10 +125,18 @@ function _trycp(file, target, targetname) targetname = targetname or path.filename(file) local targetfile = path.join(target, targetname) if os.isfile(targetfile) then - dprint("skipped file %s", path.relative(targetfile)) + dprint("skipped file %s since the file already exists", path.relative(targetfile)) return end - os.cp(file,targetfile) + os.cp(file, targetfile) +end + +function _writefileifneeded(file, content) + if os.isfile(file) and io.readfile(file) == content then + dprint("skipped file %s since the file has the same content", path.relative(file)) + return + end + io.writefile(file, content) end -- make @@ -157,7 +165,7 @@ function make(version) -- write solution file local sln = path.join(info.solution_dir, info.slnfile .. ".sln") - io.writefile(sln, render(template_sln, "#([A-Za-z0-9_,%.%*%(%)]+)#", paramsprovidersln)) + _writefileifneeded(sln, render(template_sln, "#([A-Za-z0-9_,%.%*%(%)]+)#", paramsprovidersln)) -- add solution custom file _trycp(template_props, info.solution_dir) @@ -169,10 +177,10 @@ function make(version) -- write project file local proj = path.join(proj_dir, target .. ".vcxproj") - io.writefile(proj, render(template_vcx, "#([A-Za-z0-9_,%.%*%(%)]+)#", paramsprovidertarget)) + _writefileifneeded(proj, render(template_vcx, "#([A-Za-z0-9_,%.%*%(%)]+)#", paramsprovidertarget)) local projfil = path.join(proj_dir, target .. ".vcxproj.filters") - io.writefile(projfil, render(template_fil, "#([A-Za-z0-9_,%.%*%(%)]+)#", paramsprovidertarget)) + _writefileifneeded(projfil, render(template_fil, "#([A-Za-z0-9_,%.%*%(%)]+)#", paramsprovidertarget)) -- add project custom file _trycp(template_props, proj_dir) |
