Code

Display CMS adjustment per-desktop view
[inkscape.git] / cxxtest / sample / msvc / FixFiles.bat
1 @rem = '--*-Perl-*--
2 @echo off
3 if "%OS%" == "Windows_NT" goto WinNT
4 perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
5 goto endofperl
6 :WinNT
7 perl -x -S %0 %*
8 if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
9 if %errorlevel% == 9009 echo You do not have Perl in your PATH.
10 if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul
11 goto endofperl
12 @rem ';
13 #!/usr/bin/perl -w
14 #line 15
15 use strict;
16 use English;
17 use Getopt::Long;
19 $OUTPUT_AUTOFLUSH = 1;
21 sub usage() {
22   print STDERR "Usage: $0 <OPTIONS>\n\n";
23   print STDERR "Fix Makefile and CxxTest_2_Build.dsp for your setup.\n\n";
24   print STDERR "  --cxxtest=DIR   Assume CxxTest is installed in DIR (default: '..\\..')\n";
25   print STDERR "  --tests=SPEC    Use SPEC for the test files (default: '../gui/*.h ../*.h')\n\n";
26   print STDERR "You must specify at least one option.\n";
27   exit -1;
28 }
30 my ($cxxtest, $tests);
31 my ($Makefile, $CxxTest_2_Build);
33 sub main {
34   parseCommandline();
35   fixFiles();
36 }
38 sub parseCommandline() {
39   GetOptions( 'cxxtest=s' => \$cxxtest,
40               'tests=s'   => \$tests,
41             ) or usage();
43   usage() unless (defined($cxxtest) || defined($tests));
44   $cxxtest = '..\\..' unless defined($cxxtest);
45   $tests = '../gui/*.h ../*.h' unless defined($tests);
46 }
48 sub fixFiles() {
49   fixFile( $Makefile, 'Makefile' );
50   fixFile( $CxxTest_2_Build, 'CxxTest_2_Build.dsp' );
51 }
53 sub fixFile($$) {
54   my ($data, $output) = @_;
56   print "$output...";
58   $data =~ s/<TESTS>/$tests/g;
59   $data =~ s/<CXXTEST>/$cxxtest/g;
61   open OUTPUT, ">$output" or die "Cannot create output file \"$output\"\n";
62   print OUTPUT $data;
63   close OUTPUT;
65   print "OK\n";
66 }
68 $Makefile =
69 '# Where to look for the tests
70 TESTS            = <TESTS>
72 # Where the CxxTest distribution is unpacked
73 CXXTESTDIR       = <CXXTEST>
75 # Check CXXTESTDIR
76 !if !exist($(CXXTESTDIR)\cxxtestgen.pl)
77 !error Please fix CXXTESTDIR
78 !endif
80 # cxxtestgen needs Perl or Python
81 !if defined(PERL)
82 CXXTESTGEN       = $(PERL) $(CXXTESTDIR)/cxxtestgen.pl
83 !elseif defined(PYTHON)
84 CXXTESTGEN       = $(PYTHON) $(CXXTESTDIR)/cxxtestgen.py
85 !else
86 !error You must define PERL or PYTHON
87 !endif
89 # The arguments to pass to cxxtestgen
90 #  - ParenPrinter is the way MSVC likes its compilation errors
91 #  - --have-eh/--abort-on-fail are nice when you have them
92 CXXTESTGEN_FLAGS = --gui=Win32Gui --runner=ParenPrinter --have-eh --abort-on-fail
94 # How to generate the test runner, "runner.cpp"
95 runner.cpp: $(TESTS)
96         $(CXXTESTGEN) $(CXXTESTGEN_FLAGS) -o $@ $(TESTS)
98 # Command-line arguments to the runner
99 RUNNER_FLAGS = -title "CxxTest Runner"
101 # How to run the tests, which should be in DIR\runner.exe
102 run: $(DIR)\runner.exe
103         $(DIR)\runner.exe $(RUNNER_FLAGS)
104 ';
106 $CxxTest_2_Build = 
107 '# Microsoft Developer Studio Project File - Name="CxxTest_2_Build" - Package Owner=<4>
108 # Microsoft Developer Studio Generated Build File, Format Version 6.00
109 # ** DO NOT EDIT **
111 # TARGTYPE "Win32 (x86) Console Application" 0x0103
113 CFG=CxxTest_2_Build - Win32 Debug
114 !MESSAGE This is not a valid makefile. To build this project using NMAKE,
115 !MESSAGE use the Export Makefile command and run
116 !MESSAGE 
117 !MESSAGE NMAKE /f "CxxTest_2_Build.mak".
118 !MESSAGE 
119 !MESSAGE You can specify a configuration when running NMAKE
120 !MESSAGE by defining the macro CFG on the command line. For example:
121 !MESSAGE 
122 !MESSAGE NMAKE /f "CxxTest_2_Build.mak" CFG="CxxTest_2_Build - Win32 Debug"
123 !MESSAGE 
124 !MESSAGE Possible choices for configuration are:
125 !MESSAGE 
126 !MESSAGE "CxxTest_2_Build - Win32 Release" (based on "Win32 (x86) Console Application")
127 !MESSAGE "CxxTest_2_Build - Win32 Debug" (based on "Win32 (x86) Console Application")
128 !MESSAGE 
130 # Begin Project
131 # PROP AllowPerConfigDependencies 0
132 # PROP Scc_ProjName ""
133 # PROP Scc_LocalPath ""
134 CPP=cl.exe
135 RSC=rc.exe
137 !IF  "$(CFG)" == "CxxTest_2_Build - Win32 Release"
139 # PROP BASE Use_MFC 0
140 # PROP BASE Use_Debug_Libraries 0
141 # PROP BASE Output_Dir "Release"
142 # PROP BASE Intermediate_Dir "Release"
143 # PROP BASE Target_Dir ""
144 # PROP Use_MFC 0
145 # PROP Use_Debug_Libraries 0
146 # PROP Output_Dir "Release"
147 # PROP Intermediate_Dir "Release"
148 # PROP Ignore_Export_Lib 0
149 # PROP Target_Dir ""
150 # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
151 # ADD CPP /nologo /W3 /GX /O2 /I "<CXXTEST>" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
152 # ADD BASE RSC /l 0x40d /d "NDEBUG"
153 # ADD RSC /l 0x40d /d "NDEBUG"
154 BSC32=bscmake.exe
155 # ADD BASE BSC32 /nologo
156 # ADD BSC32 /nologo
157 LINK32=link.exe
158 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
159 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"Release/runner.exe"
161 !ELSEIF  "$(CFG)" == "CxxTest_2_Build - Win32 Debug"
163 # PROP BASE Use_MFC 0
164 # PROP BASE Use_Debug_Libraries 1
165 # PROP BASE Output_Dir "Debug"
166 # PROP BASE Intermediate_Dir "Debug"
167 # PROP BASE Target_Dir ""
168 # PROP Use_MFC 0
169 # PROP Use_Debug_Libraries 1
170 # PROP Output_Dir "Debug"
171 # PROP Intermediate_Dir "Debug"
172 # PROP Ignore_Export_Lib 0
173 # PROP Target_Dir ""
174 # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
175 # ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "<CXXTEST>" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
176 # ADD BASE RSC /l 0x40d /d "_DEBUG"
177 # ADD RSC /l 0x40d /d "_DEBUG"
178 BSC32=bscmake.exe
179 # ADD BASE BSC32 /nologo
180 # ADD BSC32 /nologo
181 LINK32=link.exe
182 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
183 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"Debug/runner.exe" /pdbtype:sept
185 !ENDIF 
187 # Begin Target
189 # Name "CxxTest_2_Build - Win32 Release"
190 # Name "CxxTest_2_Build - Win32 Debug"
191 # Begin Source File
193 SOURCE=.\ReadMe.txt
194 # End Source File
195 # Begin Source File
197 SOURCE=.\runner.cpp
198 # End Source File
199 # End Target
200 # End Project
201 ';
203 main();
205 __END__
206 :endofperl
208 rem
209 rem Local Variables:
210 rem compile-command: "perl FixFiles.bat"
211 rem End:
212 rem