From c72bb7aec4db2ad32f9d82758b4f55663d0ebd60 Mon Sep 17 00:00:00 2001 From: Jay Satiro Date: Wed, 27 Aug 2025 03:35:01 -0400 Subject: [PATCH] projects: fix Windows project 'clean' function - Fix generate.bat "-clean" option. - Change version template substitutes to match old files, eg go back to using format version "11.00" instead of "11.0". - Limit the vcxproj filters file types that are filtered to c, h, rc. - Get rid of the tmpl extension from template files and add a README to the tmpl directory explaining the purpose of the files. - gitignore VCxx directories entirely rather than individual file types. - Do not remove the VC directories during clean, instead remove just the generated project files. Removing the VC directories has the unwanted behavior of removing files other than those generated. Visual Studio will generate its own preference files (like if you have some debug arguments in your .suo) and those files sit in the VC directories. We ignore those files since they are the user's files and should not be deleted. Also the user may have their own untracked files that we shouldn't be deleting. Follow-up to 57d349fe which consolidated the project templates. Assisted-by: Viktor Szakats Closes https://github.com/curl/curl/pull/18412 --- projects/Windows/.gitignore | 9 ++-- projects/Windows/tmpl/README.txt | 6 +++ projects/Windows/tmpl/curl-all.sln | 1 - projects/Windows/tmpl/curl.sln | 1 - .../tmpl/{curl.vcxproj.tmpl => curl.vcxproj} | 0 projects/Windows/tmpl/curl.vcxproj.filters | 8 +-- projects/Windows/tmpl/libcurl.sln | 1 - .../{libcurl.vcxproj.tmpl => libcurl.vcxproj} | 0 projects/Windows/tmpl/libcurl.vcxproj.filters | 8 +-- projects/generate.bat | 53 ++++++++++--------- 10 files changed, 44 insertions(+), 43 deletions(-) create mode 100644 projects/Windows/tmpl/README.txt rename projects/Windows/tmpl/{curl.vcxproj.tmpl => curl.vcxproj} (100%) rename projects/Windows/tmpl/{libcurl.vcxproj.tmpl => libcurl.vcxproj} (100%) diff --git a/projects/Windows/.gitignore b/projects/Windows/.gitignore index f32b8558a2..23ef635062 100644 --- a/projects/Windows/.gitignore +++ b/projects/Windows/.gitignore @@ -2,9 +2,6 @@ # # SPDX-License-Identifier: curl -*.ncb -*.opensdf -*.sdf -*.suo -*.user -*.vcxproj +VC10/ +VC11/ +VC12/ diff --git a/projects/Windows/tmpl/README.txt b/projects/Windows/tmpl/README.txt new file mode 100644 index 0000000000..08b2908a20 --- /dev/null +++ b/projects/Windows/tmpl/README.txt @@ -0,0 +1,6 @@ +The files in this directory are not meant to be opened with Visual Studio. + +This directory contains template files that are used to generate project files +for legacy versions of Visual Studio 2010, 2012 and 2013. To generate the +files run generate.bat in the projects directory and refer to that directory's +README. diff --git a/projects/Windows/tmpl/curl-all.sln b/projects/Windows/tmpl/curl-all.sln index 66c6d0f2f9..8f6afd4e13 100644 --- a/projects/Windows/tmpl/curl-all.sln +++ b/projects/Windows/tmpl/curl-all.sln @@ -1,5 +1,4 @@ Microsoft Visual Studio Solution File, Format Version $FORMATVER -# Visual Studio $FORMATYEAR Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "curl", "src\curl.vcxproj", "{5228E9CE-A216-422F-A5E6-58E95E2DD71D}" ProjectSection(ProjectDependencies) = postProject {DA6F56B4-06A4-441D-AD70-AC5A7D51FADB} = {DA6F56B4-06A4-441D-AD70-AC5A7D51FADB} diff --git a/projects/Windows/tmpl/curl.sln b/projects/Windows/tmpl/curl.sln index 01c07e4ffa..7e50eed99d 100644 --- a/projects/Windows/tmpl/curl.sln +++ b/projects/Windows/tmpl/curl.sln @@ -1,5 +1,4 @@ Microsoft Visual Studio Solution File, Format Version $FORMATVER -# Visual Studio $FORMATYEAR Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "curl", "curl.vcxproj", "{5228E9CE-A216-422F-A5E6-58E95E2DD71D}" EndProject Global diff --git a/projects/Windows/tmpl/curl.vcxproj.tmpl b/projects/Windows/tmpl/curl.vcxproj similarity index 100% rename from projects/Windows/tmpl/curl.vcxproj.tmpl rename to projects/Windows/tmpl/curl.vcxproj diff --git a/projects/Windows/tmpl/curl.vcxproj.filters b/projects/Windows/tmpl/curl.vcxproj.filters index 0d9d4d5fef..793a698a45 100644 --- a/projects/Windows/tmpl/curl.vcxproj.filters +++ b/projects/Windows/tmpl/curl.vcxproj.filters @@ -1,17 +1,17 @@ - + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + c {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd + h {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + rc diff --git a/projects/Windows/tmpl/libcurl.sln b/projects/Windows/tmpl/libcurl.sln index ef31025f83..2eeb679dbc 100644 --- a/projects/Windows/tmpl/libcurl.sln +++ b/projects/Windows/tmpl/libcurl.sln @@ -1,5 +1,4 @@ Microsoft Visual Studio Solution File, Format Version $FORMATVER -# Visual Studio $FORMATYEAR Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcurl", "libcurl.vcxproj", "{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}" EndProject Global diff --git a/projects/Windows/tmpl/libcurl.vcxproj.tmpl b/projects/Windows/tmpl/libcurl.vcxproj similarity index 100% rename from projects/Windows/tmpl/libcurl.vcxproj.tmpl rename to projects/Windows/tmpl/libcurl.vcxproj diff --git a/projects/Windows/tmpl/libcurl.vcxproj.filters b/projects/Windows/tmpl/libcurl.vcxproj.filters index 0d9d4d5fef..793a698a45 100644 --- a/projects/Windows/tmpl/libcurl.vcxproj.filters +++ b/projects/Windows/tmpl/libcurl.vcxproj.filters @@ -1,17 +1,17 @@ - + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + c {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd + h {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + rc diff --git a/projects/generate.bat b/projects/generate.bat index 14e57d257b..3aebff183e 100644 --- a/projects/generate.bat +++ b/projects/generate.bat @@ -109,14 +109,14 @@ rem :generate_proj echo. echo Generating %1 project files - md Windows\%1\lib - md Windows\%1\src + if not exist Windows\%1\lib md Windows\%1\lib + if not exist Windows\%1\src md Windows\%1\src call :generate %1 Windows\tmpl\curl-all.sln Windows\%1\curl-all.sln call :generate %1 Windows\tmpl\curl.sln Windows\%1\src\curl.sln - call :generate %1 Windows\tmpl\curl.vcxproj.tmpl Windows\%1\src\curl.vcxproj + call :generate %1 Windows\tmpl\curl.vcxproj Windows\%1\src\curl.vcxproj call :generate %1 Windows\tmpl\curl.vcxproj.filters Windows\%1\src\curl.vcxproj.filters call :generate %1 Windows\tmpl\libcurl.sln Windows\%1\lib\libcurl.sln - call :generate %1 Windows\tmpl\libcurl.vcxproj.tmpl Windows\%1\lib\libcurl.vcxproj + call :generate %1 Windows\tmpl\libcurl.vcxproj Windows\%1\lib\libcurl.vcxproj call :generate %1 Windows\tmpl\libcurl.vcxproj.filters Windows\%1\lib\libcurl.vcxproj.filters exit /B @@ -125,10 +125,16 @@ rem Main project clean function. rem rem %1 - version rem -:generate_proj +:clean_proj echo. echo Removing %1 project files - rd /Q /S Windows\%1 + call :clean Windows\%1\curl-all.sln + call :clean Windows\%1\src\curl.sln + call :clean Windows\%1\src\curl.vcxproj + call :clean Windows\%1\src\curl.vcxproj.filters + call :clean Windows\%1\lib\libcurl.sln + call :clean Windows\%1\lib\libcurl.vcxproj + call :clean Windows\%1\lib\libcurl.vcxproj.filters exit /B @@ -150,29 +156,25 @@ rem ) set "S01=$FORMATVER" - set "S02=$FORMATYEAR" - set "S03=$PLATFORMTOOLSET" - set "S04=$SUBDIR" - set "S05=$TOOLSVER" + set "S02=$PLATFORMTOOLSET" + set "S03=$SUBDIR" + set "S04=$TOOLSVER" if "%1" == "VC10" ( - set "R01=11.0" - set "R02=2010" - set "R03=v100" - set "R04=VC10" - set "R05=4.0" + set "R01=11.00" + set "R02=v100" + set "R03=VC10" + set "R04=4.0" ) else if "%1%" == "VC11" ( - set "R01=12.0" - set "R02=2012" - set "R03=v110" - set "R04=VC11" - set "R05=4.0" + set "R01=12.00" + set "R02=v110" + set "R03=VC11" + set "R04=4.0" ) else if "%1%" == "VC12" ( - set "R01=12.0" - set "R02=2013" - set "R03=v120" - set "R04=VC12" - set "R05=12.0" + set "R01=12.00" + set "R02=v120" + set "R03=VC12" + set "R04=12.0" ) echo * %CD%\%3 @@ -183,7 +185,6 @@ rem set "var=!var:%S02%=%R02%!" set "var=!var:%S03%=%R03%!" set "var=!var:%S04%=%R04%!" - set "var=!var:%S05%=%R05%!" set "var=!var:*:=!" -- 2.47.3