2014-04-05 19:24:12 +02:00
|
|
|
@echo off
|
|
|
|
rem ***************************************************************************
|
|
|
|
rem * _ _ ____ _
|
|
|
|
rem * Project ___| | | | _ \| |
|
|
|
|
rem * / __| | | | |_) | |
|
|
|
|
rem * | (__| |_| | _ <| |___
|
|
|
|
rem * \___|\___/|_| \_\_____|
|
|
|
|
rem *
|
2014-05-23 00:05:22 +02:00
|
|
|
rem * Copyright (C) 2014, Steve Holme, <steve_holme@hotmail.com>.
|
2014-04-05 19:24:12 +02:00
|
|
|
rem *
|
|
|
|
rem * This software is licensed as described in the file COPYING, which
|
|
|
|
rem * you should have received as part of this distribution. The terms
|
|
|
|
rem * are also available at http://curl.haxx.se/docs/copyright.html.
|
|
|
|
rem *
|
|
|
|
rem * You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
|
|
|
rem * copies of the Software, and permit persons to whom the Software is
|
|
|
|
rem * furnished to do so, under the terms of the COPYING file.
|
|
|
|
rem *
|
|
|
|
rem * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
rem * KIND, either express or implied.
|
|
|
|
rem *
|
|
|
|
rem ***************************************************************************
|
|
|
|
|
2014-11-02 14:00:31 +01:00
|
|
|
:begin
|
|
|
|
rem Check we are running on a Windows NT derived OS
|
|
|
|
if not "%OS%" == "Windows_NT" goto nodos
|
|
|
|
setlocal
|
|
|
|
|
|
|
|
rem Display the help
|
|
|
|
if /i "%~1" == "-?" goto syntax
|
|
|
|
if /i "%~1" == "-h" goto syntax
|
|
|
|
if /i "%~1" == "-help" goto syntax
|
|
|
|
|
|
|
|
:parseArgs
|
|
|
|
if "%~1" == "" goto all
|
|
|
|
|
|
|
|
if /i "%~1" == "vc6" (
|
|
|
|
goto vc6
|
|
|
|
) else if /i "%~1" == "vc7" (
|
|
|
|
goto vc7
|
|
|
|
) else if /i "%~1" == "vc7.1" (
|
|
|
|
goto vc71
|
|
|
|
) else if /i "%~1" == "vc8" (
|
|
|
|
goto vc8
|
|
|
|
) else if /i "%~1" == "vc9" (
|
|
|
|
goto vc9
|
|
|
|
) else if /i "%~1" == "vc10" (
|
|
|
|
goto vc10
|
|
|
|
) else if /i "%~1" == "vc11" (
|
|
|
|
goto vc11
|
|
|
|
) else if /i "%~1" == "vc12" (
|
|
|
|
goto vc12
|
|
|
|
) else (
|
|
|
|
goto unknown
|
|
|
|
)
|
|
|
|
|
|
|
|
:all
|
|
|
|
set ALL=true
|
|
|
|
|
|
|
|
:vc6
|
|
|
|
echo.
|
|
|
|
echo Generating VC6 project files
|
|
|
|
call :generate dsp Windows\VC6\src\curlsrc.tmpl Windows\VC6\src\curlsrc.dsp
|
|
|
|
call :generate dsp Windows\VC6\lib\libcurl.tmpl Windows\VC6\lib\libcurl.dsp
|
|
|
|
if not "%ALL%" == "true" goto success
|
|
|
|
|
|
|
|
:vc7
|
|
|
|
echo.
|
|
|
|
echo Generating VC7 project files
|
|
|
|
call :generate vcproj1 Windows\VC7\src\curlsrc.tmpl Windows\VC7\src\curlsrc.vcproj
|
|
|
|
call :generate vcproj1 Windows\VC7\lib\libcurl.tmpl Windows\VC7\lib\libcurl.vcproj
|
|
|
|
if not "%ALL%" == "true" goto success
|
|
|
|
|
|
|
|
:vc71
|
|
|
|
echo.
|
|
|
|
echo Generating VC7.1 project files
|
|
|
|
call :generate vcproj1 Windows\VC7.1\src\curlsrc.tmpl Windows\VC7.1\src\curlsrc.vcproj
|
|
|
|
call :generate vcproj1 Windows\VC7.1\lib\libcurl.tmpl Windows\VC7.1\lib\libcurl.vcproj
|
|
|
|
if not "%ALL%" == "true" goto success
|
|
|
|
|
|
|
|
:vc8
|
|
|
|
echo.
|
|
|
|
echo Generating VC8 project files
|
|
|
|
call :generate vcproj2 Windows\VC8\src\curlsrc.tmpl Windows\VC8\src\curlsrc.vcproj
|
|
|
|
call :generate vcproj2 Windows\VC8\lib\libcurl.tmpl Windows\VC8\lib\libcurl.vcproj
|
|
|
|
if not "%ALL%" == "true" goto success
|
|
|
|
|
|
|
|
:vc9
|
|
|
|
echo.
|
|
|
|
echo Generating VC9 project files
|
|
|
|
call :generate vcproj2 Windows\VC9\src\curlsrc.tmpl Windows\VC9\src\curlsrc.vcproj
|
|
|
|
call :generate vcproj2 Windows\VC9\lib\libcurl.tmpl Windows\VC9\lib\libcurl.vcproj
|
|
|
|
if not "%ALL%" == "true" goto success
|
|
|
|
|
|
|
|
:vc10
|
|
|
|
echo.
|
|
|
|
echo Generating VC10 project files
|
|
|
|
call :generate vcxproj Windows\VC10\src\curlsrc.tmpl Windows\VC10\src\curlsrc.vcxproj
|
|
|
|
call :generate vcxproj Windows\VC10\lib\libcurl.tmpl Windows\VC10\lib\libcurl.vcxproj
|
|
|
|
if not "%ALL%" == "true" goto success
|
|
|
|
|
|
|
|
:vc11
|
|
|
|
echo.
|
|
|
|
echo Generating VC11 project files
|
|
|
|
call :generate vcxproj Windows\VC11\src\curlsrc.tmpl Windows\VC11\src\curlsrc.vcxproj
|
|
|
|
call :generate vcxproj Windows\VC11\lib\libcurl.tmpl Windows\VC11\lib\libcurl.vcxproj
|
|
|
|
if not "%ALL%" == "true" goto success
|
|
|
|
|
|
|
|
:vc12
|
|
|
|
echo.
|
|
|
|
echo Generating VC12 project files
|
|
|
|
call :generate vcxproj Windows\VC12\src\curlsrc.tmpl Windows\VC12\src\curlsrc.vcxproj
|
|
|
|
call :generate vcxproj Windows\VC12\lib\libcurl.tmpl Windows\VC12\lib\libcurl.vcxproj
|
|
|
|
|
|
|
|
goto success
|
2014-04-05 19:24:12 +02:00
|
|
|
|
|
|
|
rem Main generate function.
|
|
|
|
rem
|
2014-04-27 19:21:47 +02:00
|
|
|
rem %1 - Project Type (dsp for VC6, vcproj1 for VC7 and VC7.1, vcproj2 for VC8 and VC9
|
|
|
|
rem or vcxproj for VC10, VC11 and VC12)
|
2014-04-16 22:13:35 +02:00
|
|
|
rem %2 - Input template file
|
|
|
|
rem %3 - Output project file
|
2014-04-05 19:24:12 +02:00
|
|
|
rem
|
|
|
|
:generate
|
2014-04-16 22:13:35 +02:00
|
|
|
if not exist %2 (
|
2014-04-18 11:45:53 +02:00
|
|
|
echo.
|
2014-04-16 22:13:35 +02:00
|
|
|
echo Error: Cannot open %CD%\%2
|
2014-04-05 19:24:12 +02:00
|
|
|
exit /B
|
|
|
|
)
|
|
|
|
|
2014-04-16 22:13:35 +02:00
|
|
|
if exist %3 (
|
|
|
|
del %3
|
2014-04-05 19:24:12 +02:00
|
|
|
)
|
|
|
|
|
2014-04-18 11:45:53 +02:00
|
|
|
echo * %CD%\%3
|
2014-04-27 14:57:30 +02:00
|
|
|
for /f "usebackq delims=" %%i in (`"findstr /n ^^ %2"`) do (
|
|
|
|
set "var=%%i"
|
|
|
|
setlocal enabledelayedexpansion
|
|
|
|
set "var=!var:*:=!"
|
|
|
|
|
|
|
|
if "!var!" == "CURL_SRC_C_FILES" (
|
2014-05-01 00:24:42 +02:00
|
|
|
for /f "delims=" %%c in ('dir /b ..\src\*.c') do call :element %1 src "%%c" %3
|
2014-04-27 14:57:30 +02:00
|
|
|
) else if "!var!" == "CURL_SRC_H_FILES" (
|
2014-05-01 00:24:42 +02:00
|
|
|
for /f "delims=" %%h in ('dir /b ..\src\*.h') do call :element %1 src "%%h" %3
|
2014-04-27 14:57:30 +02:00
|
|
|
) else if "!var!" == "CURL_SRC_RC_FILES" (
|
2014-05-01 00:24:42 +02:00
|
|
|
for /f "delims=" %%r in ('dir /b ..\src\*.rc') do call :element %1 src "%%r" %3
|
2014-05-23 00:05:22 +02:00
|
|
|
) else if "!var!" == "CURL_SRC_X_C_FILES" (
|
|
|
|
call :element %1 lib "strtoofft.c" %3
|
|
|
|
call :element %1 lib "rawstr.c" %3
|
|
|
|
call :element %1 lib "nonblock.c" %3
|
|
|
|
call :element %1 lib "warnless.c" %3
|
|
|
|
) else if "!var!" == "CURL_SRC_X_H_FILES" (
|
|
|
|
call :element %1 lib "config-win32.h" %3
|
|
|
|
call :element %1 lib "curl_setup.h" %3
|
|
|
|
call :element %1 lib "strtoofft.h" %3
|
|
|
|
call :element %1 lib "rawstr.h" %3
|
|
|
|
call :element %1 lib "nonblock.h" %3
|
|
|
|
call :element %1 lib "warnless.h" %3
|
2014-04-27 14:57:30 +02:00
|
|
|
) else if "!var!" == "CURL_LIB_C_FILES" (
|
2014-05-01 00:24:42 +02:00
|
|
|
for /f "delims=" %%c in ('dir /b ..\lib\*.c') do call :element %1 lib "%%c" %3
|
2014-04-27 14:57:30 +02:00
|
|
|
) else if "!var!" == "CURL_LIB_H_FILES" (
|
2014-05-01 00:24:42 +02:00
|
|
|
for /f "delims=" %%h in ('dir /b ..\lib\*.h') do call :element %1 lib "%%h" %3
|
2014-04-27 14:57:30 +02:00
|
|
|
) else if "!var!" == "CURL_LIB_RC_FILES" (
|
2014-05-01 00:24:42 +02:00
|
|
|
for /f "delims=" %%r in ('dir /b ..\lib\*.rc') do call :element %1 lib "%%r" %3
|
2014-04-27 14:57:30 +02:00
|
|
|
) else if "!var!" == "CURL_LIB_VTLS_C_FILES" (
|
2014-05-01 00:24:42 +02:00
|
|
|
for /f "delims=" %%c in ('dir /b ..\lib\vtls\*.c') do call :element %1 lib\vtls "%%c" %3
|
2014-04-27 14:57:30 +02:00
|
|
|
) else if "!var!" == "CURL_LIB_VTLS_H_FILES" (
|
2014-05-01 00:24:42 +02:00
|
|
|
for /f "delims=" %%h in ('dir /b ..\lib\vtls\*.h') do call :element %1 lib\vtls "%%h" %3
|
2014-04-05 19:24:12 +02:00
|
|
|
) else (
|
2014-04-27 14:57:30 +02:00
|
|
|
echo.!var!>> %3
|
2014-04-05 19:24:12 +02:00
|
|
|
)
|
2014-04-27 14:57:30 +02:00
|
|
|
|
|
|
|
endlocal
|
2014-04-05 19:24:12 +02:00
|
|
|
)
|
|
|
|
exit /B
|
|
|
|
|
|
|
|
rem Generates a single file xml element.
|
|
|
|
rem
|
2014-04-27 19:21:47 +02:00
|
|
|
rem %1 - Project Type (dsp for VC6, vcproj1 for VC7 and VC7.1, vcproj2 for VC8 and VC9
|
|
|
|
rem or vcxproj for VC10, VC11 and VC12)
|
2014-04-18 11:45:53 +02:00
|
|
|
rem %2 - Directory (src, lib or lib\vtls)
|
2014-04-16 22:13:35 +02:00
|
|
|
rem %3 - Source filename
|
|
|
|
rem %4 - Output project file
|
2014-04-05 19:24:12 +02:00
|
|
|
rem
|
|
|
|
:element
|
2014-04-16 22:13:35 +02:00
|
|
|
set "SPACES= "
|
|
|
|
if "%2" == "lib\vtls" (
|
2014-05-17 14:32:22 +02:00
|
|
|
set "TABS= "
|
2014-04-05 19:24:12 +02:00
|
|
|
) else (
|
2014-05-17 14:32:22 +02:00
|
|
|
set "TABS= "
|
2014-04-05 19:24:12 +02:00
|
|
|
)
|
2014-04-16 22:13:35 +02:00
|
|
|
|
2014-05-02 00:14:59 +02:00
|
|
|
call :extension %3 ext
|
|
|
|
|
2014-04-27 14:57:30 +02:00
|
|
|
if "%1" == "dsp" (
|
|
|
|
echo # Begin Source File>> %4
|
|
|
|
echo.>> %4
|
2014-05-01 00:24:42 +02:00
|
|
|
echo SOURCE=..\..\..\..\%2\%~3>> %4
|
2014-04-27 14:57:30 +02:00
|
|
|
echo # End Source File>> %4
|
2014-04-27 19:21:47 +02:00
|
|
|
) else if "%1" == "vcproj1" (
|
|
|
|
echo %TABS%^<File>> %4
|
2014-05-11 19:20:52 +02:00
|
|
|
echo %TABS% RelativePath="..\..\..\..\%2\%~3"^>>> %4
|
2014-04-27 19:21:47 +02:00
|
|
|
echo %TABS%^</File^>>> %4
|
|
|
|
) else if "%1" == "vcproj2" (
|
2014-04-18 11:45:53 +02:00
|
|
|
echo %TABS%^<File>> %4
|
2014-05-11 19:20:52 +02:00
|
|
|
echo %TABS% RelativePath="..\..\..\..\%2\%~3">> %4
|
2014-04-18 11:45:53 +02:00
|
|
|
echo %TABS%^>>> %4
|
|
|
|
echo %TABS%^</File^>>> %4
|
|
|
|
) else if "%1" == "vcxproj" (
|
2014-04-16 22:13:35 +02:00
|
|
|
if "%ext%" == "c" (
|
2014-05-01 00:24:42 +02:00
|
|
|
echo %SPACES%^<ClCompile Include=^"..\..\..\..\%2\%~3^" /^>>> %4
|
2014-04-16 22:13:35 +02:00
|
|
|
) else if "%ext%" == "h" (
|
2014-05-01 00:24:42 +02:00
|
|
|
echo %SPACES%^<ClInclude Include=^"..\..\..\..\%2\%~3^" /^>>> %4
|
2014-04-16 22:13:35 +02:00
|
|
|
) else if "%ext%" == "rc" (
|
2014-05-01 00:24:42 +02:00
|
|
|
echo %SPACES%^<ResourceCompile Include=^"..\..\..\..\%2\%~3^" /^>>> %4
|
2014-04-16 22:13:35 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
exit /B
|
|
|
|
|
|
|
|
rem Returns the extension for a given filename.
|
|
|
|
rem
|
|
|
|
rem %1 - The filename
|
|
|
|
rem %2 - The return value
|
|
|
|
rem
|
|
|
|
:extension
|
2014-05-01 00:24:42 +02:00
|
|
|
set fname=%~1
|
2014-04-16 22:13:35 +02:00
|
|
|
set ename=
|
|
|
|
:loop1
|
|
|
|
if "%fname%"=="" (
|
|
|
|
set %2=
|
|
|
|
exit /B
|
|
|
|
)
|
|
|
|
|
|
|
|
if not "%fname:~-1%"=="." (
|
|
|
|
set ename=%fname:~-1%%ename%
|
|
|
|
set fname=%fname:~0,-1%
|
|
|
|
goto loop1
|
|
|
|
)
|
|
|
|
|
|
|
|
set %2=%ename%
|
2014-04-05 19:24:12 +02:00
|
|
|
exit /B
|
|
|
|
|
2014-11-02 14:00:31 +01:00
|
|
|
:syntax
|
|
|
|
rem Display the help
|
|
|
|
echo.
|
|
|
|
echo Usage: generate [compiler]
|
2014-04-05 19:24:12 +02:00
|
|
|
echo.
|
2014-11-02 14:00:31 +01:00
|
|
|
echo Compiler:
|
|
|
|
echo.
|
|
|
|
echo vc6 - Use Visual Studio 6
|
|
|
|
echo vc7 - Use Visual Studio .NET
|
|
|
|
echo vc7.1 - Use Visual Studio .NET 2003
|
|
|
|
echo vc8 - Use Visual Studio 2005
|
|
|
|
echo vc9 - Use Visual Studio 2008
|
|
|
|
echo vc10 - Use Visual Studio 2010
|
|
|
|
echo vc11 - Use Visual Studio 2012
|
|
|
|
echo vc12 - Use Visual Studio 2013
|
|
|
|
goto error
|
|
|
|
|
|
|
|
:unknown
|
|
|
|
echo.
|
|
|
|
echo Error: Unknown argument '%1'
|
|
|
|
goto error
|
|
|
|
|
|
|
|
:nodos
|
|
|
|
echo.
|
|
|
|
echo Error: Only a Windows NT based Operating System is supported
|
|
|
|
goto error
|
|
|
|
|
|
|
|
:error
|
|
|
|
endlocal
|
|
|
|
exit /B 1
|
|
|
|
|
|
|
|
:success
|
|
|
|
endlocal
|
|
|
|
exit /B 0
|