3 # Copyright (C) 2005 Apple Computer, Inc.
4 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com>
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Library General Public
8 # License as published by the Free Software Foundation; either
9 # version 2 of the License, or (at your option) any later version.
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Library General Public License for more details.
16 # You should have received a copy of the GNU Library General Public License
17 # aint with this library; see the file COPYING.LIB. If not, write to
18 # the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 # Boston, MA 02110-1301, USA.
22 # This script is a temporary hack.
23 # Files are generated in the source directory, when they really should go
24 # to the DerivedSources directory.
25 # This should also eventually be a build rule driven off of .idl files
26 # however a build rule only solution is blocked by several radars:
27 # <rdar://problems/4251781&4251785>
44 GetOptions
('include=s@' => \
@idlDirectories,
45 'outputdir=s' => \
$outputDirectory,
46 'generator=s' => \
$generator,
47 'defines=s' => \
$defines,
48 'preprocessor=s' => \
$preprocessor);
50 my $idlFile = $ARGV[0];
52 die('Must specify input file.') unless defined($idlFile);
53 die('Must specify IDL search path.') unless @idlDirectories;
54 die('Must specify generator') unless defined($generator);
55 die('Must specify input file.') unless defined($idlFile);
56 die('Must specify output directory.') unless defined($outputDirectory);
57 die('Must specify defines') unless defined($defines);
59 $defines =~ s/^\s+|\s+$//g; # trim whitespace
61 # Parse the given IDL file.
62 my $parser = IDLParser
->new(1);
63 my $document = $parser->Parse($idlFile, $defines, $preprocessor);
65 # Generate desired output for given IDL file.
66 my $codeGen = CodeGenerator
->new(\
@idlDirectories, $generator, $outputDirectory, 0, $preprocessor);
67 $codeGen->ProcessDocument($document, $defines);