mirror of
https://github.com/curl/curl.git
synced 2026-08-26 11:43:32 +03:00
projects: generate from a single template
The three projects (VC10, VC11, VC12) are identical except 5 repeated strings in them. They also require running `generate.bat` before use, to populate source files. Reduce the 3 almost identical projects to a single template project and populate the repeated strings also via `generate.bat`. This reduces the maintenance burden to a single copy of the project files. Also saving 10000 LOCs. Closes #18396
This commit is contained in:
parent
bc6be7adf8
commit
57d349fe0e
23 changed files with 382 additions and 10185 deletions
|
|
@ -74,112 +74,159 @@ rem ***************************************************************************
|
|||
if "%VERSION%" == "VC12" goto vc12
|
||||
|
||||
:vc10
|
||||
echo.
|
||||
|
||||
if "%MODE%" == "GENERATE" (
|
||||
echo Generating VC10 project files
|
||||
call :generate Windows\VC10\src\curl.tmpl Windows\VC10\src\curl.vcxproj
|
||||
call :generate Windows\VC10\lib\libcurl.tmpl Windows\VC10\lib\libcurl.vcxproj
|
||||
call :generate_proj VC10
|
||||
) else (
|
||||
echo Removing VC10 project files
|
||||
call :clean Windows\VC10\src\curl.vcxproj
|
||||
call :clean Windows\VC10\lib\libcurl.vcxproj
|
||||
call :clean_proj VC10
|
||||
)
|
||||
|
||||
if not "%VERSION%" == "ALL" goto success
|
||||
|
||||
:vc11
|
||||
echo.
|
||||
|
||||
if "%MODE%" == "GENERATE" (
|
||||
echo Generating VC11 project files
|
||||
call :generate Windows\VC11\src\curl.tmpl Windows\VC11\src\curl.vcxproj
|
||||
call :generate Windows\VC11\lib\libcurl.tmpl Windows\VC11\lib\libcurl.vcxproj
|
||||
call :generate_proj VC11
|
||||
) else (
|
||||
echo Removing VC11 project files
|
||||
call :clean Windows\VC11\src\curl.vcxproj
|
||||
call :clean Windows\VC11\lib\libcurl.vcxproj
|
||||
call :clean_proj VC11
|
||||
)
|
||||
|
||||
if not "%VERSION%" == "ALL" goto success
|
||||
|
||||
:vc12
|
||||
echo.
|
||||
|
||||
if "%MODE%" == "GENERATE" (
|
||||
echo Generating VC12 project files
|
||||
call :generate Windows\VC12\src\curl.tmpl Windows\VC12\src\curl.vcxproj
|
||||
call :generate Windows\VC12\lib\libcurl.tmpl Windows\VC12\lib\libcurl.vcxproj
|
||||
call :generate_proj VC12
|
||||
) else (
|
||||
echo Removing VC12 project files
|
||||
call :clean Windows\VC12\src\curl.vcxproj
|
||||
call :clean Windows\VC12\lib\libcurl.vcxproj
|
||||
call :clean_proj VC12
|
||||
)
|
||||
|
||||
goto success
|
||||
|
||||
rem Main generate function.
|
||||
rem Main project generate function.
|
||||
rem
|
||||
rem %1 - Input template file
|
||||
rem %2 - Output project file
|
||||
rem %1 - version
|
||||
rem %2 - Input template file
|
||||
rem %3 - Output project file
|
||||
rem
|
||||
:generate_proj
|
||||
echo.
|
||||
echo Generating %1 project files
|
||||
md Windows\%1\lib
|
||||
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.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.filters Windows\%1\lib\libcurl.vcxproj.filters
|
||||
|
||||
exit /B
|
||||
|
||||
rem Main project clean function.
|
||||
rem
|
||||
rem %1 - version
|
||||
rem
|
||||
:generate_proj
|
||||
echo.
|
||||
echo Removing %1 project files
|
||||
rd /Q /S Windows\%1
|
||||
|
||||
exit /B
|
||||
|
||||
rem Main file generate function.
|
||||
rem
|
||||
rem %1 - version
|
||||
rem %2 - Input template file
|
||||
rem %3 - Output project file
|
||||
rem
|
||||
:generate
|
||||
if not exist %1 (
|
||||
if not exist %2 (
|
||||
echo.
|
||||
echo Error: Cannot open %1
|
||||
echo Error: Cannot open %2
|
||||
exit /B
|
||||
)
|
||||
|
||||
if exist %2 (
|
||||
del %2
|
||||
if exist %3 (
|
||||
del %3
|
||||
)
|
||||
|
||||
echo * %CD%\%2
|
||||
for /f "usebackq delims=" %%i in (`"findstr /n ^^ %1"`) do (
|
||||
set "S01=$FORMATVER"
|
||||
set "S02=$FORMATYEAR"
|
||||
set "S03=$PLATFORMTOOLSET"
|
||||
set "S04=$SUBDIR"
|
||||
set "S05=$TOOLSVER"
|
||||
|
||||
if "%1" == "VC10" (
|
||||
set "R01=11.0"
|
||||
set "R02=2010"
|
||||
set "R03=v100"
|
||||
set "R04=VC10"
|
||||
set "R05=4.0"
|
||||
) else if "%1%" == "VC11" (
|
||||
set "R01=12.0"
|
||||
set "R02=2012"
|
||||
set "R03=v110"
|
||||
set "R04=VC11"
|
||||
set "R05=4.0"
|
||||
) else if "%1%" == "VC12" (
|
||||
set "R01=12.0"
|
||||
set "R02=2013"
|
||||
set "R03=v120"
|
||||
set "R04=VC12"
|
||||
set "R05=12.0"
|
||||
)
|
||||
|
||||
echo * %CD%\%3
|
||||
for /f "usebackq delims=" %%i in (`"findstr /n ^^ %2"`) do (
|
||||
set "var=%%i"
|
||||
setlocal enabledelayedexpansion
|
||||
set "var=!var:%S01%=%R01%!"
|
||||
set "var=!var:%S02%=%R02%!"
|
||||
set "var=!var:%S03%=%R03%!"
|
||||
set "var=!var:%S04%=%R04%!"
|
||||
set "var=!var:%S05%=%R05%!"
|
||||
|
||||
set "var=!var:*:=!"
|
||||
|
||||
if "!var!" == "CURL_SRC_C_FILES" (
|
||||
for /f "delims=" %%c in ('dir /b ..\src\*.c') do (
|
||||
if /i "%%c" NEQ "curlinfo.c" call :element src "%%c" %2
|
||||
if /i "%%c" NEQ "curlinfo.c" call :element src "%%c" %3
|
||||
)
|
||||
) else if "!var!" == "CURL_SRC_H_FILES" (
|
||||
for /f "delims=" %%h in ('dir /b ..\src\*.h') do call :element src "%%h" %2
|
||||
for /f "delims=" %%h in ('dir /b ..\src\*.h') do call :element src "%%h" %3
|
||||
) else if "!var!" == "CURL_SRC_RC_FILES" (
|
||||
for /f "delims=" %%r in ('dir /b ..\src\*.rc') do call :element src "%%r" %2
|
||||
for /f "delims=" %%r in ('dir /b ..\src\*.rc') do call :element src "%%r" %3
|
||||
) else if "!var!" == "CURL_SRC_X_H_FILES" (
|
||||
call :element lib "config-win32.h" %2
|
||||
call :element lib "curl_setup.h" %2
|
||||
call :element lib "config-win32.h" %3
|
||||
call :element lib "curl_setup.h" %3
|
||||
) else if "!var!" == "CURL_LIB_C_FILES" (
|
||||
for /f "delims=" %%c in ('dir /b ..\lib\*.c') do call :element lib "%%c" %2
|
||||
for /f "delims=" %%c in ('dir /b ..\lib\*.c') do call :element lib "%%c" %3
|
||||
) else if "!var!" == "CURL_LIB_H_FILES" (
|
||||
for /f "delims=" %%h in ('dir /b ..\include\curl\*.h') do call :element include\curl "%%h" %2
|
||||
for /f "delims=" %%h in ('dir /b ..\lib\*.h') do call :element lib "%%h" %2
|
||||
for /f "delims=" %%h in ('dir /b ..\include\curl\*.h') do call :element include\curl "%%h" %3
|
||||
for /f "delims=" %%h in ('dir /b ..\lib\*.h') do call :element lib "%%h" %3
|
||||
) else if "!var!" == "CURL_LIB_RC_FILES" (
|
||||
for /f "delims=" %%r in ('dir /b ..\lib\*.rc') do call :element lib "%%r" %2
|
||||
for /f "delims=" %%r in ('dir /b ..\lib\*.rc') do call :element lib "%%r" %3
|
||||
) else if "!var!" == "CURL_LIB_CURLX_C_FILES" (
|
||||
for /f "delims=" %%c in ('dir /b ..\lib\curlx\*.c') do call :element lib\curlx "%%c" %2
|
||||
for /f "delims=" %%c in ('dir /b ..\lib\curlx\*.c') do call :element lib\curlx "%%c" %3
|
||||
) else if "!var!" == "CURL_LIB_CURLX_H_FILES" (
|
||||
for /f "delims=" %%h in ('dir /b ..\lib\curlx\*.h') do call :element lib\curlx "%%h" %2
|
||||
for /f "delims=" %%h in ('dir /b ..\lib\curlx\*.h') do call :element lib\curlx "%%h" %3
|
||||
) else if "!var!" == "CURL_LIB_VAUTH_C_FILES" (
|
||||
for /f "delims=" %%c in ('dir /b ..\lib\vauth\*.c') do call :element lib\vauth "%%c" %2
|
||||
for /f "delims=" %%c in ('dir /b ..\lib\vauth\*.c') do call :element lib\vauth "%%c" %3
|
||||
) else if "!var!" == "CURL_LIB_VAUTH_H_FILES" (
|
||||
for /f "delims=" %%h in ('dir /b ..\lib\vauth\*.h') do call :element lib\vauth "%%h" %2
|
||||
for /f "delims=" %%h in ('dir /b ..\lib\vauth\*.h') do call :element lib\vauth "%%h" %3
|
||||
) else if "!var!" == "CURL_LIB_VQUIC_C_FILES" (
|
||||
for /f "delims=" %%c in ('dir /b ..\lib\vquic\*.c') do call :element lib\vquic "%%c" %2
|
||||
for /f "delims=" %%c in ('dir /b ..\lib\vquic\*.c') do call :element lib\vquic "%%c" %3
|
||||
) else if "!var!" == "CURL_LIB_VQUIC_H_FILES" (
|
||||
for /f "delims=" %%h in ('dir /b ..\lib\vquic\*.h') do call :element lib\vquic "%%h" %2
|
||||
for /f "delims=" %%h in ('dir /b ..\lib\vquic\*.h') do call :element lib\vquic "%%h" %3
|
||||
) else if "!var!" == "CURL_LIB_VSSH_C_FILES" (
|
||||
for /f "delims=" %%c in ('dir /b ..\lib\vssh\*.c') do call :element lib\vssh "%%c" %2
|
||||
for /f "delims=" %%c in ('dir /b ..\lib\vssh\*.c') do call :element lib\vssh "%%c" %3
|
||||
) else if "!var!" == "CURL_LIB_VSSH_H_FILES" (
|
||||
for /f "delims=" %%h in ('dir /b ..\lib\vssh\*.h') do call :element lib\vssh "%%h" %2
|
||||
for /f "delims=" %%h in ('dir /b ..\lib\vssh\*.h') do call :element lib\vssh "%%h" %3
|
||||
) else if "!var!" == "CURL_LIB_VTLS_C_FILES" (
|
||||
for /f "delims=" %%c in ('dir /b ..\lib\vtls\*.c') do call :element lib\vtls "%%c" %2
|
||||
for /f "delims=" %%c in ('dir /b ..\lib\vtls\*.c') do call :element lib\vtls "%%c" %3
|
||||
) else if "!var!" == "CURL_LIB_VTLS_H_FILES" (
|
||||
for /f "delims=" %%h in ('dir /b ..\lib\vtls\*.h') do call :element lib\vtls "%%h" %2
|
||||
for /f "delims=" %%h in ('dir /b ..\lib\vtls\*.h') do call :element lib\vtls "%%h" %3
|
||||
) else (
|
||||
echo.!var!>> %2
|
||||
echo.!var!>> %3
|
||||
)
|
||||
|
||||
endlocal
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue