summaryrefslogtreecommitdiff
path: root/src/rebuild.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2022-07-10 17:24:16 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2022-07-15 10:11:05 +0200
commitae1871ca0ffcac3e8bd337f8d8bb4e7fd6c59295 (patch)
treed15df8a03fab6bdacebb6ba53c8ad30c290781fc /src/rebuild.cc
parent2a55edcc40372403fb2de8ed20ed5c44464d416e (diff)
Make tools abstraction around compiler options to better support tool agnostic arguments.
Diffstat (limited to 'src/rebuild.cc')
-rw-r--r--src/rebuild.cc25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/rebuild.cc b/src/rebuild.cc
index 3e0e78d..a82e0cc 100644
--- a/src/rebuild.cc
+++ b/src/rebuild.cc
@@ -13,6 +13,8 @@
#include "tasks.h"
#include "build.h"
#include "execute.h"
+#include "tools.h"
+#include "util.h"
std::array<BuildConfigurationEntry, 1024> configFiles;
std::size_t numConfigFiles{0};
@@ -143,19 +145,28 @@ bool recompileCheck(const Settings& global_settings, int argc, char* argv[],
BuildConfiguration config;
config.name = "ctor";
- config.flags.cxxflags =
- std::vector<std::string>({ "-s", "-O3", "-std=c++20" });
+ config.system = OutputSystem::Build;
+
+ auto tool_chain = getToolChain(config.system);
+
+ append(config.flags.cxxflags,
+ getOption(tool_chain, opt::optimization, "3"));
+ append(config.flags.cxxflags,
+ getOption(tool_chain, opt::cpp_std, "c++20"));
if(hasConfiguration(cfg::ctor_includedir))
{
- config.flags.cxxflags.push_back("-I"s + getConfiguration(cfg::ctor_includedir));
+ append(config.flags.cxxflags,
+ getOption(tool_chain, opt::include_path,
+ getConfiguration(cfg::ctor_includedir)));
}
if(hasConfiguration(cfg::ctor_libdir))
{
- config.flags.ldflags.push_back("-L"s + getConfiguration(cfg::ctor_libdir));
+ append(config.flags.ldflags,
+ getOption(tool_chain, opt::library_path,
+ getConfiguration(cfg::ctor_libdir)));
}
- config.flags.ldflags.push_back("-lctor");
- config.flags.ldflags.push_back("-pthread");
-
+ append(config.flags.ldflags, getOption(tool_chain, opt::link, "ctor"));
+ append(config.flags.ldflags, getOption(tool_chain, opt::threads));
Settings settings{global_settings};
settings.verbose = -1; // Make check completely silent.