History

clean up msvs project generation

add visual studio 9 to --help remove cpp, cxx, hpp, hxx files from filter add the ability to target project names. this will be necessary to enable obj_int_extract

Johann committed 15 years ago

Commit a1cfcb41 parent 4decd271 file · +189 −166Browse files

Unified · Split

build/make/gen_msvs_proj.sh+189−166
@@ -32,7 +32,7 @@ Options: · 31 unmodified lines
3232 --name=project_name Name of the project (required)
3333 --proj-guid=GUID GUID to use for the project
3434 --module-def=filename File containing export definitions (for DLLs)
35− --ver=version Version (7,8) of visual studio to generate for
35+ --ver=version Version (7,8,9) of visual studio to generate for
3636 -Ipath/to/include Additional include directories
3737 -DFLAG[=value] Preprocessor macros to define
3838 -Lpath/to/lib Additional library search paths
@@ -132,7 +132,7 @@ generate_filter() { · 93 unmodified lines
132132 open_tag Filter \
133133 Name=$name \
134134 Filter=$pats \
135− UniqueIdentifier=`generate_uuid`
135+ UniqueIdentifier=`generate_uuid` \
136136
137137 file_list_sz=${#file_list[@]}
138138 for i in ${!file_list[@]}; do
@@ -145,31 +145,21 @@ generate_filter() { · 6 unmodified lines
145145 if [ "$pat" == "asm" ] && $asm_use_custom_step; then
146146 for plat in "${platforms[@]}"; do
147147 for cfg in Debug Release; do
148− open_tag FileConfiguration \
149− Name="${cfg}|${plat}"
148+ open_tag FileConfiguration \
149+ Name="${cfg}|${plat}" \
150+
150151 tag Tool \
151152 Name="VCCustomBuildTool" \
152153 Description="Assembling \$(InputFileName)" \
153− CommandLine="$(eval echo \$asm_${cfg}_cmdline)"\
154− Outputs="\$(InputName).obj"
154+ CommandLine="$(eval echo \$asm_${cfg}_cmdline)" \
155+ Outputs="\$(InputName).obj" \
156+
155157 close_tag FileConfiguration
156158 done
157159 done
158160 fi
159161
160− if [ "${f##*.}" == "cpp" ]; then
161− for plat in "${platforms[@]}"; do
162− for cfg in Debug Release; do
163− open_tag FileConfiguration \
164− Name="${cfg}|${plat}"
165− tag Tool \
166− Name="VCCLCompilerTool" \
167− CompileAs="2"
168− close_tag FileConfiguration
169− done
170− done
171− fi
172− close_tag File
162+ close_tag File
173163
174164 break
175165 fi
@@ -185,57 +175,61 @@ unset target · 9 unmodified lines
185175 for opt in "$@"; do
186176 optval="${opt#*=}"
187177 case "$opt" in
188− --help|-h) show_help
189− ;;
190− --target=*) target="${optval}"
191− ;;
192− --out=*) outfile="$optval"
193− ;;
194− --name=*) name="${optval}"
195− ;;
196− --proj-guid=*) guid="${optval}"
197− ;;
198− --module-def=*)
199− link_opts="${link_opts} ModuleDefinitionFile=${optval}"
200− ;;
201− --exe) proj_kind="exe"
202− ;;
203− --lib) proj_kind="lib"
204− ;;
205− --static-crt) use_static_runtime=true
206− ;;
207− --ver=*) vs_ver="$optval"
208− case $optval in
209− [789])
210− ;;
211− *) die Unrecognized Visual Studio Version in $opt
212− ;;
213− esac
214− ;;
215− -I*) opt="${opt%/}"
216− incs="${incs}${incs:+;}"${opt##-I}""
217− yasmincs="${yasmincs} ${opt}"
218− ;;
219− -D*) defines="${defines}${defines:+;}${opt##-D}"
220− ;;
221− -L*) # fudge . to $(OutDir)
222− if [ "${opt##-L}" == "." ]; then
223− libdirs="${libdirs}${libdirs:+;}"\$(OutDir)""
224− else
225− # Also try directories for this platform/configuration
226− libdirs="${libdirs}${libdirs:+;}"${opt##-L}""
227− libdirs="${libdirs}${libdirs:+;}"${opt##-L}/\$(PlatformName)/\$(ConfigurationName)""
228− libdirs="${libdirs}${libdirs:+;}"${opt##-L}/\$(PlatformName)""
229− fi
230− ;;
231− -l*) libs="${libs}${libs:+ }${opt##-l}.lib"
232− ;;
233− -*) die_unknown $opt
234− ;;
235− *) file_list[${#file_list[@]}]="$opt"
236− case "$opt" in
237− *.asm) uses_asm=true;;
238− esac
178+ --help|-h) show_help
179+ ;;
180+ --target=*) target="${optval}"
181+ ;;
182+ --out=*) outfile="$optval"
183+ ;;
184+ --name=*) name="${optval}"
185+ ;;
186+ --proj-guid=*) guid="${optval}"
187+ ;;
188+ --module-def=*) link_opts="${link_opts} ModuleDefinitionFile=${optval}"
189+ ;;
190+ --exe) proj_kind="exe"
191+ ;;
192+ --lib) proj_kind="lib"
193+ ;;
194+ --static-crt) use_static_runtime=true
195+ ;;
196+ --ver=*)
197+ vs_ver="$optval"
198+ case "$optval" in
199+ [789])
200+ ;;
201+ *) die Unrecognized Visual Studio Version in $opt
202+ ;;
203+ esac
204+ ;;
205+ -I*)
206+ opt="${opt%/}"
207+ incs="${incs}${incs:+;}"${opt##-I}""
208+ yasmincs="${yasmincs} ${opt}"
209+ ;;
210+ -D*) defines="${defines}${defines:+;}${opt##-D}"
211+ ;;
212+ -L*) # fudge . to $(OutDir)
213+ if [ "${opt##-L}" == "." ]; then
214+ libdirs="${libdirs}${libdirs:+;}"\$(OutDir)""
215+ else
216+ # Also try directories for this platform/configuration
217+ libdirs="${libdirs}${libdirs:+;}"${opt##-L}""
218+ libdirs="${libdirs}${libdirs:+;}"${opt##-L}/\$(PlatformName)/\$(ConfigurationName)""
219+ libdirs="${libdirs}${libdirs:+;}"${opt##-L}/\$(PlatformName)""
220+ fi
221+ ;;
222+ -l*) libs="${libs}${libs:+ }${opt##-l}.lib"
223+ ;;
224+ -*) die_unknown $opt
225+ ;;
226+ *)
227+ file_list[${#file_list[@]}]="$opt"
228+ case "$opt" in
229+ *.asm) uses_asm=true
230+ ;;
231+ esac
232+ ;;
239233 esac
240234 done
241235 outfile=${outfile:-/dev/stdout}
@@ -278,8 +272,7 @@ done · 36 unmodified lines
278272
279273 # List Keyword for this target
280274 case "$target" in
281− x86*)
282− keyword="ManagedCProj"
275+ x86*) keyword="ManagedCProj"
283276 ;;
284277 *) die "Unsupported target $target!"
285278 esac
@@ -296,155 +289,185 @@ case "$target" in · 10 unmodified lines
296289 asm_Release_cmdline="yasm -Xvc -f \$(PlatformName) ${yasmincs} "\$(InputPath)""
297290 ;;
298291 *) die "Unsupported target $target!"
292+ ;;
299293 esac
300294
301295 generate_vcproj() {
302296 case "$proj_kind" in
303− exe) vs_ConfigurationType=1
304− ;;
305− *) vs_ConfigurationType=4
306− ;;
297+ exe) vs_ConfigurationType=1
298+ ;;
299+ *) vs_ConfigurationType=4
300+ ;;
307301 esac
308302
309303 echo "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>"
310− open_tag VisualStudioProject \
311− ProjectType="Visual C++" \
312− Version="${vs_ver_id}" \
313− Name="${name}" \
314− ProjectGUID="{${guid}}" \
315− RootNamespace="${name}" \
316− Keyword="${keyword}"
317−
318− open_tag Platforms
304+ open_tag VisualStudioProject \
305+ ProjectType="Visual C++" \
306+ Version="${vs_ver_id}" \
307+ Name="${name}" \
308+ ProjectGUID="{${guid}}" \
309+ RootNamespace="${name}" \
310+ Keyword="${keyword}" \
311+
312+ open_tag Platforms
319313 for plat in "${platforms[@]}"; do
320− tag Platform Name="$plat"
314+ tag Platform Name="$plat"
321315 done
322316 close_tag Platforms
323317
324− open_tag ToolFiles
318+ open_tag ToolFiles
325319 case "$target" in
326320 x86*) $uses_asm && tag ToolFile RelativePath="$self_dirname/../x86-msvs/yasm.rules"
327321 ;;
328322 esac
329323 close_tag ToolFiles
330324
331− open_tag Configurations
325+ open_tag Configurations
332326 for plat in "${platforms[@]}"; do
333327 plat_no_ws=`echo $plat | sed 's/[^A-Za-z0-9_]/_/g'`
334− open_tag Configuration \
335− Name="Debug|$plat" \
336− OutputDirectory="\$(SolutionDir)$plat_no_ws/\$(ConfigurationName)" \
337− IntermediateDirectory="$plat_no_ws/\$(ConfigurationName)/${name}" \
338− ConfigurationType="$vs_ConfigurationType" \
339− CharacterSet="1"
328+ open_tag Configuration \
329+ Name="Debug|$plat" \
330+ OutputDirectory="\$(SolutionDir)$plat_no_ws/\$(ConfigurationName)" \
331+ IntermediateDirectory="$plat_no_ws/\$(ConfigurationName)/${name}" \
332+ ConfigurationType="$vs_ConfigurationType" \
333+ CharacterSet="1" \
340334
341335 case "$target" in
342− x86*) tag Tool \
343− Name="VCCLCompilerTool" \
344− Optimization="0" \
345− AdditionalIncludeDirectories="$incs" \
346− PreprocessorDefinitions="WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;$defines" \
347− RuntimeLibrary="$debug_runtime" \
348− UsePrecompiledHeader="0" \
349− WarningLevel="3" \
350− DebugInformationFormat="1" \
351− Detect64BitPortabilityProblems="true" \
352−
353− $uses_asm && tag Tool Name="YASM" IncludePaths="$incs" Debug="1"
336+ x86*)
337+ case "$name" in
338+ *)
339+ tag Tool \
340+ Name="VCCLCompilerTool" \
341+ Optimization="0" \
342+ AdditionalIncludeDirectories="$incs" \
343+ PreprocessorDefinitions="WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;$defines" \
344+ RuntimeLibrary="$debug_runtime" \
345+ UsePrecompiledHeader="0" \
346+ WarningLevel="3" \
347+ DebugInformationFormat="1" \
348+ Detect64BitPortabilityProblems="true" \
349+
350+ $uses_asm && tag Tool Name="YASM" IncludePaths="$incs" Debug="1"
351+ ;;
352+ esac
354353 ;;
355354 esac
356355
357356 case "$proj_kind" in
358357 exe)
359358 case "$target" in
360− x86*) tag Tool \
361− Name="VCLinkerTool" \
362− AdditionalDependencies="$debug_libs \$(NoInherit)" \
363− AdditionalLibraryDirectories="$libdirs" \
364− GenerateDebugInformation="true" \
365− ProgramDatabaseFile="\$(OutDir)/${name}.pdb" \
366−
359+ x86*)
360+ case "$name" in
361+ *)
362+ tag Tool \
363+ Name="VCLinkerTool" \
364+ AdditionalDependencies="$debug_libs \$(NoInherit)" \
365+ AdditionalLibraryDirectories="$libdirs" \
366+ GenerateDebugInformation="true" \
367+ ProgramDatabaseFile="\$(OutDir)/${name}.pdb" \
368+ ;;
369+ esac
367370 ;;
368371 esac
369372 ;;
370373 lib)
371374 case "$target" in
372− *) tag Tool \
373− Name="VCLibrarianTool" \
374− OutputFile="\$(OutDir)/${name}${lib_sfx}d.lib" \
375− ;;
375+ x86*)
376+ tag Tool \
377+ Name="VCLibrarianTool" \
378+ OutputFile="\$(OutDir)/${name}${lib_sfx}d.lib" \
379+
380+ ;;
376381 esac
377382 ;;
378− dll) tag Tool \
379− Name="VCLinkerTool" \
380− AdditionalDependencies="\$(NoInherit)" \
381− LinkIncremental="2" \
382− GenerateDebugInformation="true" \
383− AssemblyDebug="1" \
384− TargetMachine="1" \
385− $link_opts
383+ dll)
384+ tag Tool \
385+ Name="VCLinkerTool" \
386+ AdditionalDependencies="\$(NoInherit)" \
387+ LinkIncremental="2" \
388+ GenerateDebugInformation="true" \
389+ AssemblyDebug="1" \
390+ TargetMachine="1" \
391+ $link_opts \
392+
393+ ;;
386394 esac
387395
388396 close_tag Configuration
389397
390− open_tag Configuration \
391− Name="Release|$plat" \
392− OutputDirectory="\$(SolutionDir)$plat_no_ws/\$(ConfigurationName)" \
393− IntermediateDirectory="$plat_no_ws/\$(ConfigurationName)/${name}" \
394− ConfigurationType="$vs_ConfigurationType" \
395− CharacterSet="1" \
396− WholeProgramOptimization="0"
398+ open_tag Configuration \
399+ Name="Release|$plat" \
400+ OutputDirectory="\$(SolutionDir)$plat_no_ws/\$(ConfigurationName)" \
401+ IntermediateDirectory="$plat_no_ws/\$(ConfigurationName)/${name}" \
402+ ConfigurationType="$vs_ConfigurationType" \
403+ CharacterSet="1" \
404+ WholeProgramOptimization="0" \
397405
398− case "$target" in
399− x86*) tag Tool \
400− Name="VCCLCompilerTool" \
401− AdditionalIncludeDirectories="$incs" \
402− PreprocessorDefinitions="WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;$defines" \
403− RuntimeLibrary="$release_runtime" \
404− UsePrecompiledHeader="0" \
405− WarningLevel="3" \
406− DebugInformationFormat="0" \
407− Detect64BitPortabilityProblems="true"
408−
409− $uses_asm && tag Tool Name="YASM" IncludePaths="$incs"
410− ;;
406+ case "$target" in
407+ x86*)
408+ case "$name" in
409+ *)
410+ tag Tool \
411+ Name="VCCLCompilerTool" \
412+ AdditionalIncludeDirectories="$incs" \
413+ PreprocessorDefinitions="WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;$defines" \
414+ RuntimeLibrary="$release_runtime" \
415+ UsePrecompiledHeader="0" \
416+ WarningLevel="3" \
417+ DebugInformationFormat="0" \
418+ Detect64BitPortabilityProblems="true" \
419+
420+ $uses_asm && tag Tool Name="YASM" IncludePaths="$incs"
421+ ;;
411422 esac
423+ ;;
424+ esac
412425
413426 case "$proj_kind" in
414427 exe)
415428 case "$target" in
416− x86*) tag Tool \
417− Name="VCLinkerTool" \
418− AdditionalDependencies="$libs \$(NoInherit)" \
419− AdditionalLibraryDirectories="$libdirs" \
429+ x86*)
430+ case "$name" in
431+ *)
432+ tag Tool \
433+ Name="VCLinkerTool" \
434+ AdditionalDependencies="$libs \$(NoInherit)" \
435+ AdditionalLibraryDirectories="$libdirs" \
436+
437+ ;;
438+ esac
420439 ;;
421440 esac
422441 ;;
423− lib)
442+ lib)
424443 case "$target" in
425− *) tag Tool \
426− Name="VCLibrarianTool" \
427− OutputFile="\$(OutDir)/${name}${lib_sfx}.lib" \
428− ;;
444+ x86*)
445+ tag Tool \
446+ Name="VCLibrarianTool" \
447+ OutputFile="\$(OutDir)/${name}${lib_sfx}.lib" \
448+
449+ ;;
429450 esac
430− ;;
431− dll) # note differences to debug version: LinkIncremental, AssemblyDebug
432− tag Tool \
433− Name="VCLinkerTool" \
434− AdditionalDependencies="\$(NoInherit)" \
435− LinkIncremental="1" \
436− GenerateDebugInformation="true" \
437− TargetMachine="1" \
438− $link_opts
451+ ;;
452+ dll) # note differences to debug version: LinkIncremental, AssemblyDebug
453+ tag Tool \
454+ Name="VCLinkerTool" \
455+ AdditionalDependencies="\$(NoInherit)" \
456+ LinkIncremental="1" \
457+ GenerateDebugInformation="true" \
458+ TargetMachine="1" \
459+ $link_opts \
460+
461+ ;;
439462 esac
440463
441464 close_tag Configuration
442465 done
443466 close_tag Configurations
444467
445− open_tag Files
446− generate_filter srcs "Source Files" "cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
447− generate_filter hdrs "Header Files" "h;hpp;hxx;hm;inl;inc;xsd"
468+ open_tag Files
469+ generate_filter srcs "Source Files" "c;def;odl;idl;hpj;bat;asm;asmx"
470+ generate_filter hdrs "Header Files" "h;hm;inl;inc;xsd"
448471 generate_filter resrcs "Resource Files" "rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
449472 generate_filter resrcs "Build Files" "mk"
450473 close_tag Files

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t