git/contrib/buildsystems/Generators.pm
Marius Storm-Olsen 259d87c354 Add scripts to generate projects for other buildsystems (MSVC vcproj, QMake)
These scripts generate projects for the MSVC IDE (.vcproj files) or
QMake (.pro files), based on the output of a 'make -n MSVC=1 V=1' run.

This enables us to simply do the necesarry changes in the Makefile, and you
can update the other buildsystems by regenerating the files. Keeping the
other buildsystems up-to-date with main development.

The generator system is designed to easily drop in pm's for other
buildsystems as well, if someone has an itch. However, the focus has been
Windows development, so the 'engine' might need patches to support any
platform.

Also add some .gitignore entries for MSVC files.

Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-18 20:00:42 -07:00

43 lines
1.1 KiB
Perl

package Generators;
require Exporter;
use strict;
use File::Basename;
no strict 'refs';
use vars qw($VERSION @AVAILABLE);
our $VERSION = '1.00';
our(@ISA, @EXPORT, @EXPORT_OK, @AVAILABLE);
@ISA = qw(Exporter);
BEGIN {
local(*D);
my $me = $INC{"Generators.pm"};
die "Couldn't find myself in \@INC, which is required to load the generators!" if ("$me" eq "");
$me = dirname($me);
if (opendir(D,"$me/Generators")) {
foreach my $gen (readdir(D)) {
next if ($gen =~ /^\.\.?$/);
require "${me}/Generators/$gen";
$gen =~ s,\.pm,,;
push(@AVAILABLE, $gen);
}
closedir(D);
my $gens = join(', ', @AVAILABLE);
}
push @EXPORT_OK, qw(available);
}
sub available {
return @AVAILABLE;
}
sub generate {
my ($gen, $git_dir, $out_dir, $rel_dir, %build_structure) = @_;
return eval("Generators::${gen}::generate(\$git_dir, \$out_dir, \$rel_dir, \%build_structure)") if grep(/^$gen$/, @AVAILABLE);
die "Generator \"${gen}\" is not available!\nAvailable generators are: @AVAILABLE\n";
}
1;