From 88e3ad4afa2010507227c0c0ffb9d1ce08f61e2a Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Fri, 24 May 2013 18:38:57 +0300 Subject: [PATCH] Group most existing tools in sub-toolchains --- source/builder.cpp | 21 ++++----------------- source/builtintools.cpp | 11 +++++++++++ source/builtintools.h | 14 ++++++++++++++ source/gnutools.cpp | 17 +++++++++++++++++ source/gnutools.h | 15 +++++++++++++++ 5 files changed, 61 insertions(+), 17 deletions(-) create mode 100644 source/builtintools.cpp create mode 100644 source/builtintools.h create mode 100644 source/gnutools.cpp create mode 100644 source/gnutools.h diff --git a/source/builder.cpp b/source/builder.cpp index b73618f..cf49f41 100644 --- a/source/builder.cpp +++ b/source/builder.cpp @@ -11,19 +11,13 @@ #include #include "binarypackage.h" #include "builder.h" -#include "copy.h" +#include "builtintools.h" #include "datatool.h" -#include "gnuarchiver.h" -#include "gnuccompiler.h" -#include "gnucxxcompiler.h" -#include "gnulinker.h" +#include "gnutools.h" #include "installedfile.h" -#include "mingwdlltool.h" #include "package.h" -#include "pkgconfiggenerator.h" #include "sharedlibrary.h" #include "sourcepackage.h" -#include "tar.h" #include "task.h" #include "virtualtarget.h" @@ -81,15 +75,8 @@ void Builder::set_temp_directory(const FS::Path &p) void Builder::add_default_tools() { - toolchain.add_tool(new GnuCCompiler(*this, *current_arch)); - toolchain.add_tool(new GnuCxxCompiler(*this, *current_arch)); - toolchain.add_tool(new GnuLinker(*this, *current_arch)); - toolchain.add_tool(new GnuArchiver(*this, *current_arch)); - toolchain.add_tool(new Copy(*this)); - toolchain.add_tool(new Tar(*this)); - toolchain.add_tool(new PkgConfigGenerator(*this)); - if(current_arch->get_system()=="windows") - toolchain.add_tool(new MingwDllTool(*this, *current_arch)); + toolchain.add_toolchain(new GnuTools(*this, *current_arch)); + toolchain.add_toolchain(new BuiltinTools(*this)); toolchain.add_tool(new DataTool(*this)); } diff --git a/source/builtintools.cpp b/source/builtintools.cpp new file mode 100644 index 0000000..db1d4f3 --- /dev/null +++ b/source/builtintools.cpp @@ -0,0 +1,11 @@ +#include "builtintools.h" +#include "copy.h" +#include "pkgconfiggenerator.h" +#include "tar.h" + +BuiltinTools::BuiltinTools(Builder &builder) +{ + add_tool(new Copy(builder)); + add_tool(new Tar(builder)); + add_tool(new PkgConfigGenerator(builder)); +} diff --git a/source/builtintools.h b/source/builtintools.h new file mode 100644 index 0000000..e3b0256 --- /dev/null +++ b/source/builtintools.h @@ -0,0 +1,14 @@ +#ifndef BUILTINTOOLS_H_ +#define BUILTINTOOLS_H_ + +#include "toolchain.h" + +class Builder; + +class BuiltinTools: public Toolchain +{ +public: + BuiltinTools(Builder &); +}; + +#endif diff --git a/source/gnutools.cpp b/source/gnutools.cpp new file mode 100644 index 0000000..20463e6 --- /dev/null +++ b/source/gnutools.cpp @@ -0,0 +1,17 @@ +#include "architecture.h" +#include "gnuarchiver.h" +#include "gnuccompiler.h" +#include "gnucxxcompiler.h" +#include "gnulinker.h" +#include "gnutools.h" +#include "mingwdlltool.h" + +GnuTools::GnuTools(Builder &builder, const Architecture &arch) +{ + add_tool(new GnuCCompiler(builder, arch)); + add_tool(new GnuCxxCompiler(builder, arch)); + add_tool(new GnuLinker(builder, arch)); + add_tool(new GnuArchiver(builder, arch)); + if(arch.get_system()=="windows") + add_tool(new MingwDllTool(builder, arch)); +} diff --git a/source/gnutools.h b/source/gnutools.h new file mode 100644 index 0000000..98e2856 --- /dev/null +++ b/source/gnutools.h @@ -0,0 +1,15 @@ +#ifndef GNUTOOLS_H_ +#define GNUTOOLS_H_ + +#include "toolchain.h" + +class Architecture; +class Builder; + +class GnuTools: public Toolchain +{ +public: + GnuTools(Builder &, const Architecture &); +}; + +#endif -- 2.45.2