Commit d91a0e0b authored by Michael Pyne's avatar Michael Pyne
Browse files

Consolidate build system factory.

This makes modularizing the build systems less annoying. I was surprised
that creating a class using a scalar variable instead of the bareword
works without tripping warnings about using references, but it works
just fine in testing here, test suite still passes.
parent 67edf6e7
......@@ -1585,26 +1585,20 @@ EOF
sub buildSystemFromName
{
my ($self, $name) = @_;
my $buildSystem;
given(lc($name)) {
when('generic')
{ $buildSystem = ksb::BuildSystem -> new($self); }
when('qmake')
{ $buildSystem = ksb::BuildSystem::QMake->new($self); }
when('cmake-bootstrap')
{ $buildSystem = ksb::BuildSystem::CMakeBootstrap->new($self); }
when('kde')
{ $buildSystem = KDEBuildSystem -> new($self); }
when('qt')
{ $buildSystem = QtBuildSystem -> new($self); }
when('autotools')
{ $buildSystem = ksb::BuildSystem::Autotools -> new($self); }
default { croak_runtime("Invalid build system $name requested"); }
}
return $buildSystem;
my %buildSystemClasses = (
'generic' => 'ksb::BuildSystem',
'qmake' => 'ksb::BuildSystem::QMake',
'cmake-bootstrap' => 'ksb::BuildSystem::CMakeBootstrap',
'kde' => 'KDEBuildSystem',
'qt' => 'QtBuildSystem',
'autotools' => 'ksb::BuildSystem::Autotools',
);
my $class = $buildSystemClasses{lc $name} // undef;
return $class->new($self) if ($class);
# Past here, no class found
croak_runtime("Invalid build system $name requested");
}
sub buildSystem
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment