forked from mathstuf/gdal-svn
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmakegdal_gen.bat
196 lines (169 loc) · 6.45 KB
/
makegdal_gen.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
@echo off
:: ****************************************************************************
:: $Id: $
::
:: Name: makegdal_gen.bat
:: Project: GDAL
:: Purpose: Generate MS Visual Studio 2003...N project files
:: Author: Ivan Lucena, [email protected]
::
:: ****************************************************************************
:: Copyright (c) 2007, Ivan Lucena
::
:: Permission is hereby granted, free of charge, to any person obtaining a
:: copy of this software and associated documentation files (the "Software"),
:: to deal in the Software without restriction, including without limitation
:: the rights to use, copy, modify, merge, publish, distribute, sublicense,
:: and/or sell copies of the Software, and to permit persons to whom the
:: Software is furnished to do so, subject to the following conditions:
::
:: The above copyright notice and this permission notice shall be included
:: in all copies or substantial portions of the Software.
::
:: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
:: OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
:: FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
:: THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
:: LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
:: FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
:: DEALINGS IN THE SOFTWARE.
:: ****************************************************************************
:: *********************
:: Usage
:: *********************
if "%1"=="" (
echo Usage: makegdal_gen "MS Visual C++ version" ^> makegdalNN.vcproj
echo Examples:
echo makegdal_gen 7.10 ^> makegdal71.vcproj
echo makegdal_gen 8.00 ^> makegdal80.vcproj
goto :end
)
:: *********************
:: Get Visual C++ version
:: *********************
set _vcver_=%1
set _clver_=1310
if "%_vcver_%"=="6.00" (
set _clver_=1200
)
if "%_vcver_%"=="7.00" (
set _clver_=1300
)
if "%_vcver_%"=="7.10" (
set _clver_=1310
)
if "%_vcver_%"=="8.00" (
set _clver_=1400
)
if "%_vcver_%"=="9.00" (
set _clver_=1500
)
:: *********************
:: Get GDAL Version
:: *********************
for /f %%v in (VERSION) do set _gdalver_=%%v
set _gdalnum_=%_gdalver_:.=%
set _gdalnum_=%_gdalnum_:~0,2%
:: **********************************************
:: Main file generator
:: **********************************************
echo ^<?xml version="1.0" encoding="Windows-1252"?^>
echo ^<VisualStudioProject
echo ProjectType="Visual C++"
echo Version="%_vcver_%"
echo Name="makegdal%_vcnum_%"
echo ProjectGUID="{769DD10E-E284-46BE-9172-A35184250A3A}"
echo Keyword="MakeFileProj"^>
echo ^<Platforms^>
echo ^<Platform Name="Win32"/^>
echo ^</Platforms^>
echo ^<Configurations^>
echo ^<Configuration
echo Name="Debug|Win32"
echo OutputDirectory="$(ConfigurationName)"
echo IntermediateDirectory="$(ConfigurationName)"
echo ConfigurationType="0"^>
echo ^<Tool
echo Name="VCNMakeTool"
echo BuildCommandLine= ^"cd $(ProjectDir) ^&^& nmake -f makefile.vc MSVC_VER=%_clver_% DEBUG=1 ^&^& nmake -f makefile.vc MSVC_VER=%_clver_% DEBUG=1 install^"
echo ReBuildCommandLine=^"cd $(ProjectDir) ^&^& nmake -f makefile.vc MSVC_VER=%_clver_% DEBUG=1 clean^ ^&^& nmake -f makefile.vc MSVC_VER=%_clver_% DEBUG=1 ^&^& nmake -f makefile.vc MSVC_VER=%_clver_% DEBUG=1 install^"
echo CleanCommandLine= ^"cd $(ProjectDir) ^&^& nmake -f makefile.vc MSVC_VER=%_clver_% DEBUG=1 clean^"
echo Output="gdal%_gdalnum_%.dll"/^>
echo ^</Configuration^>
echo ^<Configuration
echo Name="Release|Win32"
echo OutputDirectory="$(ConfigurationName)"
echo IntermediateDirectory="$(ConfigurationName)"
echo ConfigurationType="0"^>
echo ^<Tool
echo Name="VCNMakeTool"
echo BuildCommandLine= ^"cd $(ProjectDir) ^&^& nmake -f makefile.vc MSVC_VER=%_clver_% ^&^& nmake -f makefile.vc MSVC_VER=%_clver_% install^"
echo ReBuildCommandLine=^"cd $(ProjectDir) ^&^& nmake -f makefile.vc MSVC_VER=%_clver_% clean^ ^&^& nmake -f makefile.vc MSVC_VER=%_clver_% ^&^& nmake -f makefile.vc MSVC_VER=%_clver_% install^"
echo CleanCommandLine= ^"cd $(ProjectDir) ^&^& nmake -f makefile.vc MSVC_VER=%_clver_% clean^"
echo Output="gdal%_gdalnum_%.dll"/^>
echo ^</Configuration^>
echo ^</Configurations^>
echo ^<References^>
echo ^</References^>
echo ^<Files^>
call :create_filter . "*.vc;*.opt" "Make Files" " "
call :create_filter . "*.h" "Include Files" " "
call :create_filter . "*.c;*.cpp" "Source Files" " "
echo ^</Files^>
echo ^<Globals^>
echo ^</Globals^>
echo ^</VisualStudioProject^>
goto :end
:: **********************************************
:create_filter
:: **********************************************
set _path_=%1
set _mask_=%2
set _name_=%3
set _tabs_=" "%4
set _next_=" "%_tabs_%
:: *********************
:: remove quotes
:: *********************
set _name_=%_name_:"=%
set _mask_=%_mask_:"=%
set _tabs_=%_tabs_:"=%
set _next_=%_next_:"=%
:: *********************
:: stop folders
:: *********************
for %%d in (data debian dist_docs docs html m4 pymod swig vb6) do (
if "%_name_%"=="%%d" (
goto :end
)
)
:: *********************
:: check whole folder tree
:: *********************
set _find_=0
for /R %%f in (%_mask_%) do set _find_=1
if %_find_%==0 (
goto :end
)
:: *********************
:: create filter
:: *********************
echo %_tabs_%^<Filter Name="%_name_%" Filter="%_mask_%"^>
:: *********************
:: add files
:: *********************
for %%f in (%_mask_%) do (
echo %_next_%^<File RelativePath="%_path_%\%%f" /^>
)
:: *********************
:: clib all the branches
:: *********************
for /D %%d in (*) do (
cd %%d
call :create_filter %_path_%\%%d "%_mask_%" %%d "%_tabs_%"
cd ..
)
echo %_tabs_%^</Filter^>
:: **********************************************
:end
:: **********************************************