From a69f6893fd449d00fe95cdf1a10d918c2613021c Mon Sep 17 00:00:00 2001 From: Opportunity Date: Sun, 24 Nov 2019 17:47:47 +0800 Subject: normalize sdkver --- xmake/plugins/project/vsxmake/vsproj/Xmake.props | 4 ++++ xmake/plugins/project/vsxmake/vsproj/Xmake.targets | 1 + .../plugins/project/vsxmake/vsproj/templates/vcxproj/#target#.vcxproj | 1 - .../project/vsxmake/vsproj/templates/vcxproj/XmakeConfig(mode,arch) | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) 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 @@ false + + $(XmakeWindowsSdkVersion) + + v100 v110 diff --git a/xmake/plugins/project/vsxmake/vsproj/Xmake.targets b/xmake/plugins/project/vsxmake/vsproj/Xmake.targets index 40ef5fc05..60c263d30 100644 --- a/xmake/plugins/project/vsxmake/vsproj/Xmake.targets +++ b/xmake/plugins/project/vsxmake/vsproj/Xmake.targets @@ -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 @@ #projectdir# #projectfile# #target# - #sdkver# $(XMAKE_PROGRAM_DIR) 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 @@ #defines# #languages# #cudaver# + #sdkver# #mfckind# #runenvs# #configflags# -- cgit v1.3.1 From 46fa759eda406168dc3fbbc20c6eb2d11fb2e01d Mon Sep 17 00:00:00 2001 From: Opportunity Date: Sun, 24 Nov 2019 18:02:56 +0800 Subject: skip file if is the same --- xmake/plugins/project/vsxmake/vsxmake.lua | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) 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) -- cgit v1.3.1 From 23ae1e8af491342ef3e4f899ed0bdb5dd1a1284a Mon Sep 17 00:00:00 2001 From: Opportunity Date: Sun, 24 Nov 2019 18:08:20 +0800 Subject: emit target in xmake config ref: https://github.com/xmake-io/xmake/issues/612#issuecomment-556022070 --- xmake/plugins/project/vsxmake/vsproj/Xmake.targets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xmake/plugins/project/vsxmake/vsproj/Xmake.targets b/xmake/plugins/project/vsxmake/vsproj/Xmake.targets index 60c263d30..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" /> - + + $(_XmakeExecutable) config $(_XmakeCommonFlags) $(_XmakeConfigFlags)" EchoOff="true" /> -- cgit v1.3.1