]> git.tdb.fi Git - builder.git/commitdiff
Combine the gnu and clang toolchains into SystemToolchain
authorMikko Rasa <tdb@tdb.fi>
Fri, 1 Dec 2017 07:12:13 +0000 (09:12 +0200)
committerMikko Rasa <tdb@tdb.fi>
Fri, 1 Dec 2017 07:12:13 +0000 (09:12 +0200)
source/builder.cpp
source/clangtools.cpp [deleted file]
source/clangtools.h [deleted file]
source/gnutools.cpp [deleted file]
source/gnutools.h [deleted file]
source/systemtools.cpp [new file with mode: 0644]
source/systemtools.h [new file with mode: 0644]

index e453a84eb73e178c4633799a59afc34810568933..9836e5c52448bc7f8fd3149905cf3a039f0a1b03 100644 (file)
 #include "binarypackage.h"
 #include "builder.h"
 #include "builtintools.h"
-#include "clangtools.h"
 #include "datatool.h"
-#include "gnutools.h"
 #include "installedfile.h"
 #include "package.h"
 #include "sharedlibrary.h"
 #include "sourcepackage.h"
+#include "systemtools.h"
 #include "task.h"
 #include "virtualtarget.h"
 
@@ -77,12 +76,9 @@ void Builder::set_temp_directory(const FS::Path &p)
 
 void Builder::add_default_tools()
 {
-       bool use_clang = (current_arch->get_system()=="darwin" || current_arch->get_system()=="freebsd");
-       if(use_clang && vfs.find_binary("clang"))
-               toolchain.add_toolchain(new ClangTools(*this, *current_arch));
        if(current_arch->get_system()=="android")
                toolchain.add_toolchain(new AndroidTools(*this, *current_arch));
-       toolchain.add_toolchain(new GnuTools(*this, *current_arch));
+       toolchain.add_toolchain(new SystemTools(*this, *current_arch));
        toolchain.add_toolchain(new BuiltinTools(*this));
        toolchain.add_tool(new DataTool(*this));
 }
diff --git a/source/clangtools.cpp b/source/clangtools.cpp
deleted file mode 100644 (file)
index a4f005c..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "clangccompiler.h"
-#include "clangcxxcompiler.h"
-#include "clangobjccompiler.h"
-#include "clangtools.h"
-
-ClangTools::ClangTools(Builder &builder, const Architecture &arch)
-{
-       add_tool(new ClangCCompiler(builder, arch));
-       add_tool(new ClangCxxCompiler(builder, arch));
-       add_tool(new ClangObjCCompiler(builder, arch));
-}
diff --git a/source/clangtools.h b/source/clangtools.h
deleted file mode 100644 (file)
index bdfa118..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef CLANGTOOLS_H_
-#define CLANGTOOLS_H_
-
-#include "toolchain.h"
-
-class ClangTools: public Toolchain
-{
-public:
-       ClangTools(Builder &, const Architecture &);
-};
-
-#endif
diff --git a/source/gnutools.cpp b/source/gnutools.cpp
deleted file mode 100644 (file)
index 0dc2749..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#include "architecture.h"
-#include "gnuarchiver.h"
-#include "gnuccompiler.h"
-#include "gnucxxcompiler.h"
-#include "gnulinker.h"
-#include "gnuobjccompiler.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 GnuObjCCompiler(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
deleted file mode 100644 (file)
index 98e2856..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef GNUTOOLS_H_
-#define GNUTOOLS_H_
-
-#include "toolchain.h"
-
-class Architecture;
-class Builder;
-
-class GnuTools: public Toolchain
-{
-public:
-       GnuTools(Builder &, const Architecture &);
-};
-
-#endif
diff --git a/source/systemtools.cpp b/source/systemtools.cpp
new file mode 100644 (file)
index 0000000..bf90cf0
--- /dev/null
@@ -0,0 +1,36 @@
+#include "architecture.h"
+#include "builder.h"
+#include "clangccompiler.h"
+#include "clangcxxcompiler.h"
+#include "clangobjccompiler.h"
+#include "gnuarchiver.h"
+#include "gnuccompiler.h"
+#include "gnucxxcompiler.h"
+#include "gnulinker.h"
+#include "gnuobjccompiler.h"
+#include "mingwdlltool.h"
+#include "systemtools.h"
+
+using namespace std;
+
+SystemTools::SystemTools(Builder &builder, const Architecture &arch)
+{
+       const string &sys = arch.get_system();
+       if((sys=="darwin" || sys=="freebsd") && builder.get_vfs().find_binary("clang"))
+       {
+               add_tool(new ClangCCompiler(builder, arch));
+               add_tool(new ClangCxxCompiler(builder, arch));
+               add_tool(new ClangObjCCompiler(builder, arch));
+       }
+       else
+       {
+               add_tool(new GnuCCompiler(builder, arch));
+               add_tool(new GnuCxxCompiler(builder, arch));
+               add_tool(new GnuObjCCompiler(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/systemtools.h b/source/systemtools.h
new file mode 100644 (file)
index 0000000..ac90a05
--- /dev/null
@@ -0,0 +1,15 @@
+#ifndef SYSTEMTOOLS_H_
+#define SYSTEMTOOLS_H_
+
+#include "toolchain.h"
+
+class Architecture;
+class Builder;
+
+class SystemTools: public Toolchain
+{
+public:
+       SystemTools(Builder &, const Architecture &);
+};
+
+#endif