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 rem Generate VC8 project files
26 call :generate vc8 Windows\VC8\src\curlsrc.tmpl Windows\VC8\src\curlsrc.vcproj
27 call :generate vc8 Windows\VC8\lib\libcurl.tmpl Windows\VC8\lib\libcurl.vcproj
29 rem Generate VC9 project files
30 call :generate vc9 Windows\VC9\src\curlsrc.tmpl Windows\VC9\src\curlsrc.vcproj
31 call :generate vc9 Windows\VC9\lib\libcurl.tmpl Windows\VC9\lib\libcurl.vcproj
33 rem Generate VC10 project files
34 call :generate vc10 Windows\VC10\src\curlsrc.tmpl Windows\VC10\src\curlsrc.vcxproj
35 call :generate vc10 Windows\VC10\lib\libcurl.tmpl Windows\VC10\lib\libcurl.vcxproj
39 rem Main generate function.
42 rem %2 - Input template file
43 rem %3 - Output project file
49 echo Error: Cannot open %CD%\%2
59 for /f "delims=" %%i in (%2) do (
60 if "%%i" == "CURL_SRC_C_FILES" (
61 for /f %%c in ('dir /b ..\src\*.c') do call :element %1 src %%c %3
62 ) else if "%%i" == "CURL_SRC_H_FILES" (
63 for /f %%h in ('dir /b ..\src\*.h') do call :element %1 src %%h %3
64 ) else if "%%i" == "CURL_SRC_RC_FILES" (
65 for /f %%r in ('dir /b ..\src\*.rc') do call :element %1 src %%r %3
66 ) else if "%%i" == "CURL_LIB_C_FILES" (
67 for /f %%c in ('dir /b ..\lib\*.c') do call :element %1 lib %%c %3
68 ) else if "%%i" == "CURL_LIB_H_FILES" (
69 for /f %%h in ('dir /b ..\lib\*.h') do call :element %1 lib %%h %3
70 ) else if "%%i" == "CURL_LIB_RC_FILES" (
71 for /f %%r in ('dir /b ..\lib\*.rc') do call :element %1 lib %%r %3
72 ) else if "%%i" == "CURL_LIB_VTLS_C_FILES" (
73 for /f %%c in ('dir /b ..\lib\vtls\*.c') do call :element %1 lib\vtls %%c %3
74 ) else if "%%i" == "CURL_LIB_VTLS_H_FILES" (
75 for /f %%h in ('dir /b ..\lib\vtls\*.h') do call :element %1 lib\vtls %%h %3
82 rem Generates a single file xml element.
85 rem %2 - Directory (eg src, lib or lib\vtls)
86 rem %3 - Source filename
87 rem %4 - Output project file
91 if "%2" == "lib\vtls" (
97 call :extension %3 ext
101 echo %SPACES%^<ClCompile Include=^"..\..\..\..\%2\%3^" /^>>> %4
102 ) else if "%ext%" == "h" (
103 echo %SPACES%^<ClInclude Include=^"..\..\..\..\%2\%3^" /^>>> %4
104 ) else if "%ext%" == "rc" (
105 echo %SPACES%^<ResourceCompile Include=^"..\..\..\..\%2\%3^" /^>>> %4
108 echo %TABS%^<File>> %4
109 echo %TABS% RelativePath="..\..\..\..\%2\%3">> %4
111 echo %TABS%^</File^>>> %4
116 rem Returns the extension for a given filename.
118 rem %1 - The filename
119 rem %2 - The return value
130 if not "%fname:~-1%"=="." (
131 set ename=%fname:~-1%%ename%
132 set fname=%fname:~0,-1%