2 rem ***************************************************************************
4 rem * Project ___| | | | _ \| |
5 rem * / __| | | | |_) | |
6 rem * | (__| |_| | _ <| |___
7 rem * \___|\___/|_| \_\_____|
9 rem * Copyright (C) 2014, Steve Holme, <steve_holme@hotmail.com>.
11 rem * This software is licensed as described in the file COPYING, which
12 rem * you should have received as part of this distribution. The terms
13 rem * are also available at http://curl.haxx.se/docs/copyright.html.
15 rem * You may opt to use, copy, modify, merge, publish, distribute and/or sell
16 rem * copies of the Software, and permit persons to whom the Software is
17 rem * furnished to do so, under the terms of the COPYING file.
19 rem * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 rem * KIND, either express or implied.
22 rem ***************************************************************************
24 echo Generating VC6 project files
25 call :generate dsp Windows\VC6\src\curlsrc.tmpl Windows\VC6\src\curlsrc.dsp
26 call :generate dsp Windows\VC6\lib\libcurl.tmpl Windows\VC6\lib\libcurl.dsp
29 echo Generating VC7 project files
30 call :generate vcproj1 Windows\VC7\src\curlsrc.tmpl Windows\VC7\src\curlsrc.vcproj
31 call :generate vcproj1 Windows\VC7\lib\libcurl.tmpl Windows\VC7\lib\libcurl.vcproj
34 echo Generating VC7.1 project files
35 call :generate vcproj1 Windows\VC7.1\src\curlsrc.tmpl Windows\VC7.1\src\curlsrc.vcproj
36 call :generate vcproj1 Windows\VC7.1\lib\libcurl.tmpl Windows\VC7.1\lib\libcurl.vcproj
39 echo Generating VC8 project files
40 call :generate vcproj2 Windows\VC8\src\curlsrc.tmpl Windows\VC8\src\curlsrc.vcproj
41 call :generate vcproj2 Windows\VC8\lib\libcurl.tmpl Windows\VC8\lib\libcurl.vcproj
44 echo Generating VC9 project files
45 call :generate vcproj2 Windows\VC9\src\curlsrc.tmpl Windows\VC9\src\curlsrc.vcproj
46 call :generate vcproj2 Windows\VC9\lib\libcurl.tmpl Windows\VC9\lib\libcurl.vcproj
49 echo Generating VC10 project files
50 call :generate vcxproj Windows\VC10\src\curlsrc.tmpl Windows\VC10\src\curlsrc.vcxproj
51 call :generate vcxproj Windows\VC10\lib\libcurl.tmpl Windows\VC10\lib\libcurl.vcxproj
54 echo Generating VC11 project files
55 call :generate vcxproj Windows\VC11\src\curlsrc.tmpl Windows\VC11\src\curlsrc.vcxproj
56 call :generate vcxproj Windows\VC11\lib\libcurl.tmpl Windows\VC11\lib\libcurl.vcxproj
59 echo Generating VC12 project files
60 call :generate vcxproj Windows\VC12\src\curlsrc.tmpl Windows\VC12\src\curlsrc.vcxproj
61 call :generate vcxproj Windows\VC12\lib\libcurl.tmpl Windows\VC12\lib\libcurl.vcxproj
65 rem Main generate function.
67 rem %1 - Project Type (dsp for VC6, vcproj1 for VC7 and VC7.1, vcproj2 for VC8 and VC9
68 rem or vcxproj for VC10, VC11 and VC12)
69 rem %2 - Input template file
70 rem %3 - Output project file
75 echo Error: Cannot open %CD%\%2
84 for /f "usebackq delims=" %%i in (`"findstr /n ^^ %2"`) do (
86 setlocal enabledelayedexpansion
89 if "!var!" == "CURL_SRC_C_FILES" (
90 for /f "delims=" %%c in ('dir /b ..\src\*.c') do call :element %1 src "%%c" %3
91 ) else if "!var!" == "CURL_SRC_H_FILES" (
92 for /f "delims=" %%h in ('dir /b ..\src\*.h') do call :element %1 src "%%h" %3
93 ) else if "!var!" == "CURL_SRC_RC_FILES" (
94 for /f "delims=" %%r in ('dir /b ..\src\*.rc') do call :element %1 src "%%r" %3
95 ) else if "!var!" == "CURL_SRC_X_C_FILES" (
96 call :element %1 lib "strtoofft.c" %3
97 call :element %1 lib "strdup.c" %3
98 call :element %1 lib "rawstr.c" %3
99 call :element %1 lib "nonblock.c" %3
100 call :element %1 lib "warnless.c" %3
101 ) else if "!var!" == "CURL_SRC_X_H_FILES" (
102 call :element %1 lib "config-win32.h" %3
103 call :element %1 lib "curl_setup.h" %3
104 call :element %1 lib "strtoofft.h" %3
105 call :element %1 lib "strdup.h" %3
106 call :element %1 lib "rawstr.h" %3
107 call :element %1 lib "nonblock.h" %3
108 call :element %1 lib "warnless.h" %3
109 ) else if "!var!" == "CURL_LIB_C_FILES" (
110 for /f "delims=" %%c in ('dir /b ..\lib\*.c') do call :element %1 lib "%%c" %3
111 ) else if "!var!" == "CURL_LIB_H_FILES" (
112 for /f "delims=" %%h in ('dir /b ..\lib\*.h') do call :element %1 lib "%%h" %3
113 ) else if "!var!" == "CURL_LIB_RC_FILES" (
114 for /f "delims=" %%r in ('dir /b ..\lib\*.rc') do call :element %1 lib "%%r" %3
115 ) else if "!var!" == "CURL_LIB_VTLS_C_FILES" (
116 for /f "delims=" %%c in ('dir /b ..\lib\vtls\*.c') do call :element %1 lib\vtls "%%c" %3
117 ) else if "!var!" == "CURL_LIB_VTLS_H_FILES" (
118 for /f "delims=" %%h in ('dir /b ..\lib\vtls\*.h') do call :element %1 lib\vtls "%%h" %3
127 rem Generates a single file xml element.
129 rem %1 - Project Type (dsp for VC6, vcproj1 for VC7 and VC7.1, vcproj2 for VC8 and VC9
130 rem or vcxproj for VC10, VC11 and VC12)
131 rem %2 - Directory (src, lib or lib\vtls)
132 rem %3 - Source filename
133 rem %4 - Output project file
137 if "%2" == "lib\vtls" (
143 call :extension %3 ext
146 echo # Begin Source File>> %4
148 echo SOURCE=..\..\..\..\%2\%~3>> %4
149 echo # End Source File>> %4
150 ) else if "%1" == "vcproj1" (
151 echo %TABS%^<File>> %4
152 echo %TABS% RelativePath="..\..\..\..\%2\%~3"^>>> %4
153 echo %TABS%^</File^>>> %4
154 ) else if "%1" == "vcproj2" (
155 echo %TABS%^<File>> %4
156 echo %TABS% RelativePath="..\..\..\..\%2\%~3">> %4
158 echo %TABS%^</File^>>> %4
159 ) else if "%1" == "vcxproj" (
161 echo %SPACES%^<ClCompile Include=^"..\..\..\..\%2\%~3^" /^>>> %4
162 ) else if "%ext%" == "h" (
163 echo %SPACES%^<ClInclude Include=^"..\..\..\..\%2\%~3^" /^>>> %4
164 ) else if "%ext%" == "rc" (
165 echo %SPACES%^<ResourceCompile Include=^"..\..\..\..\%2\%~3^" /^>>> %4
171 rem Returns the extension for a given filename.
173 rem %1 - The filename
174 rem %2 - The return value
185 if not "%fname:~-1%"=="." (
186 set ename=%fname:~-1%%ename%
187 set fname=%fname:~0,-1%