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 ***************************************************************************
23 setlocal ENABLEDELAYEDEXPANSION
25 echo Generating VC8 project files
26 call :generate vcproj Windows\VC8\src\curlsrc.tmpl Windows\VC8\src\curlsrc.vcproj
27 call :generate vcproj Windows\VC8\lib\libcurl.tmpl Windows\VC8\lib\libcurl.vcproj
30 echo Generating VC9 project files
31 call :generate vcproj Windows\VC9\src\curlsrc.tmpl Windows\VC9\src\curlsrc.vcproj
32 call :generate vcproj Windows\VC9\lib\libcurl.tmpl Windows\VC9\lib\libcurl.vcproj
35 echo Generating VC10 project files
36 call :generate vcxproj Windows\VC10\src\curlsrc.tmpl Windows\VC10\src\curlsrc.vcxproj
37 call :generate vcxproj Windows\VC10\lib\libcurl.tmpl Windows\VC10\lib\libcurl.vcxproj
40 echo Generating VC11 project files
41 call :generate vcxproj Windows\VC11\src\curlsrc.tmpl Windows\VC11\src\curlsrc.vcxproj
42 call :generate vcxproj Windows\VC11\lib\libcurl.tmpl Windows\VC11\lib\libcurl.vcxproj
46 rem Main generate function.
48 rem %1 - Project Type (dsp, vcproj or vcxproj)
49 rem %2 - Input template file
50 rem %3 - Output project file
55 echo Error: Cannot open %CD%\%2
64 for /f "delims=" %%i in (%2) do (
65 if "%%i" == "CURL_SRC_C_FILES" (
66 for /f %%c in ('dir /b ..\src\*.c') do call :element %1 src %%c %3
67 ) else if "%%i" == "CURL_SRC_H_FILES" (
68 for /f %%h in ('dir /b ..\src\*.h') do call :element %1 src %%h %3
69 ) else if "%%i" == "CURL_SRC_RC_FILES" (
70 for /f %%r in ('dir /b ..\src\*.rc') do call :element %1 src %%r %3
71 ) else if "%%i" == "CURL_LIB_C_FILES" (
72 for /f %%c in ('dir /b ..\lib\*.c') do call :element %1 lib %%c %3
73 ) else if "%%i" == "CURL_LIB_H_FILES" (
74 for /f %%h in ('dir /b ..\lib\*.h') do call :element %1 lib %%h %3
75 ) else if "%%i" == "CURL_LIB_RC_FILES" (
76 for /f %%r in ('dir /b ..\lib\*.rc') do call :element %1 lib %%r %3
77 ) else if "%%i" == "CURL_LIB_VTLS_C_FILES" (
78 for /f %%c in ('dir /b ..\lib\vtls\*.c') do call :element %1 lib\vtls %%c %3
79 ) else if "%%i" == "CURL_LIB_VTLS_H_FILES" (
80 for /f %%h in ('dir /b ..\lib\vtls\*.h') do call :element %1 lib\vtls %%h %3
87 rem Generates a single file xml element.
89 rem %1 - Project Type (dsp, vcproj or vcxproj)
90 rem %2 - Directory (src, lib or lib\vtls)
91 rem %3 - Source filename
92 rem %4 - Output project file
96 if "%2" == "lib\vtls" (
102 call :extension %3 ext
104 if "%1" == "vcproj" (
105 echo %TABS%^<File>> %4
106 echo %TABS% RelativePath="..\..\..\..\%2\%3">> %4
108 echo %TABS%^</File^>>> %4
109 ) else if "%1" == "vcxproj" (
111 echo %SPACES%^<ClCompile Include=^"..\..\..\..\%2\%3^" /^>>> %4
112 ) else if "%ext%" == "h" (
113 echo %SPACES%^<ClInclude Include=^"..\..\..\..\%2\%3^" /^>>> %4
114 ) else if "%ext%" == "rc" (
115 echo %SPACES%^<ResourceCompile Include=^"..\..\..\..\%2\%3^" /^>>> %4
121 rem Returns the extension for a given filename.
123 rem %1 - The filename
124 rem %2 - The return value
135 if not "%fname:~-1%"=="." (
136 set ename=%fname:~-1%%ename%
137 set fname=%fname:~0,-1%