]> git.tdb.fi Git - builder.git/commitdiff
Split SystemTools into GnuTools and ClangTools
authorMikko Rasa <tdb@tdb.fi>
Sat, 28 Aug 2021 11:16:44 +0000 (14:16 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sat, 28 Aug 2021 11:16:44 +0000 (14:16 +0300)
source/builder.cpp
source/clangtools.cpp [new file with mode: 0644]
source/clangtools.h [new file with mode: 0644]
source/gnutools.cpp [new file with mode: 0644]
source/gnutools.h [new file with mode: 0644]
source/systemtools.cpp [deleted file]
source/systemtools.h [deleted file]

index 3ad6146349fbaf331fa2779e97407e4ff2aa6f6a..b49bc7577909471b81459be1ee13c76e0651d194 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"
 
@@ -85,9 +86,13 @@ void Builder::set_temp_directory(const FS::Path &p)
 
 void Builder::add_default_tools()
 {
-       if(current_arch->get_system()=="android")
+       const string &sys = current_arch->get_system();
+       if(sys=="android")
                toolchain.add_toolchain(new AndroidTools(*this, *current_arch));
-       toolchain.add_toolchain(new SystemTools(*this, *current_arch));
+       else if((sys=="darwin" || sys=="freebsd") && vfs.find_binary("clang"))
+               toolchain.add_toolchain(new ClangTools(*this, *current_arch));
+       else
+               toolchain.add_toolchain(new GnuTools(*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
new file mode 100644 (file)
index 0000000..d0910ff
--- /dev/null
@@ -0,0 +1,17 @@
+#include "builder.h"
+#include "clangcompiler.h"
+#include "clangtools.h"
+#include "gnuarchiver.h"
+#include "gnulinker.h"
+
+using namespace std;
+
+ClangTools::ClangTools(Builder &builder, const Architecture &arch)
+{
+       add_tool(new ClangCompiler(builder, arch, "CC"));
+       add_tool(new ClangCompiler(builder, arch, "CXX"));
+       add_tool(new ClangCompiler(builder, arch, "OBJC"));
+
+       add_tool(new GnuLinker(builder, arch));
+       add_tool(new GnuArchiver(builder, arch));
+}
diff --git a/source/clangtools.h b/source/clangtools.h
new file mode 100644 (file)
index 0000000..ba86cc3
--- /dev/null
@@ -0,0 +1,15 @@
+#ifndef CLANGTOOLS_H_
+#define CLANGTOOLS_H_
+
+#include "toolchain.h"
+
+class Architecture;
+class Builder;
+
+class ClangTools: public Toolchain
+{
+public:
+       ClangTools(Builder &, const Architecture &);
+};
+
+#endif
diff --git a/source/gnutools.cpp b/source/gnutools.cpp
new file mode 100644 (file)
index 0000000..fdd6e79
--- /dev/null
@@ -0,0 +1,19 @@
+#include "builder.h"
+#include "gnuarchiver.h"
+#include "gnucompiler.h"
+#include "gnulinker.h"
+#include "gnutools.h"
+#include "mingwdlltool.h"
+
+GnuTools::GnuTools(Builder &builder, const Architecture &arch)
+{
+       add_tool(new GnuCompiler(builder, arch, "CC"));
+       add_tool(new GnuCompiler(builder, arch, "CXX"));
+       add_tool(new GnuCompiler(builder, arch, "OBJC"));
+
+       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 (file)
index 0000000..98e2856
--- /dev/null
@@ -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
diff --git a/source/systemtools.cpp b/source/systemtools.cpp
deleted file mode 100644 (file)
index c35b4ae..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-#include "architecture.h"
-#include "builder.h"
-#include "clangcompiler.h"
-#include "gnuarchiver.h"
-#include "gnucompiler.h"
-#include "gnulinker.h"
-#include "mingwdlltool.h"
-#include "systemtools.h"
-#include "vcxprojectgenerator.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 ClangCompiler(builder, arch, "CC"));
-               add_tool(new ClangCompiler(builder, arch, "CXX"));
-               add_tool(new ClangCompiler(builder, arch, "OBJC"));
-       }
-       else
-       {
-               add_tool(new GnuCompiler(builder, arch, "CC"));
-               add_tool(new GnuCompiler(builder, arch, "CXX"));
-               add_tool(new GnuCompiler(builder, arch, "OBJC"));
-       }
-
-       add_tool(new GnuLinker(builder, arch));
-       add_tool(new GnuArchiver(builder, arch));
-
-       if(arch.get_system()=="windows")
-       {
-               add_tool(new MingwDllTool(builder, arch));
-               add_tool(new VcxProjectGenerator(builder));
-       }
-}
diff --git a/source/systemtools.h b/source/systemtools.h
deleted file mode 100644 (file)
index ac90a05..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef SYSTEMTOOLS_H_
-#define SYSTEMTOOLS_H_
-
-#include "toolchain.h"
-
-class Architecture;
-class Builder;
-
-class SystemTools: public Toolchain
-{
-public:
-       SystemTools(Builder &, const Architecture &);
-};
-
-#endif