summaryrefslogtreecommitdiff
path: root/src/libctor.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libctor.cc')
-rw-r--r--src/libctor.cc54
1 files changed, 37 insertions, 17 deletions
diff --git a/src/libctor.cc b/src/libctor.cc
index 4d0d6d9..d188771 100644
--- a/src/libctor.cc
+++ b/src/libctor.cc
@@ -20,25 +20,29 @@
#include <getoptpp/getoptpp.hpp>
#include "libctor.h"
-#include "settings.h"
#include "configure.h"
#include "rebuild.h"
#include "tasks.h"
#include "build.h"
#include "unittest.h"
+
int main(int argc, char* argv[])
{
+ Settings settings{};
+
+ settings.builddir = getConfiguration(cfg::builddir, settings.builddir);
+ settings.parallel_processes =
+ std::max(1u, std::thread::hardware_concurrency()) * 2 - 1;
+
if(argc > 1 && std::string(argv[1]) == "configure")
{
- return configure(argc, argv);
+ return configure(settings, argc, argv);
}
- Settings settings{};
-
- settings.builddir = getConfiguration(cfg::builddir, "build");
- settings.parallel_processes =
- std::max(1u, std::thread::hardware_concurrency() * 2 - 1);
- settings.verbose = 0;
+ if(argc > 1 && std::string(argv[1]) == "reconfigure")
+ {
+ return reconfigure(settings, argc, argv);
+ }
bool write_compilation_database{false};
std::string compilation_database;
@@ -85,6 +89,13 @@ int main(int argc, char* argv[])
return 0;
});
+ opt.add("quiet", no_argument, 'q',
+ "Be completely silent.",
+ [&]() {
+ settings.verbose = -1;
+ return 0;
+ });
+
opt.add("add", required_argument, 'a',
"Add specified file to the build configurations.",
[&]() {
@@ -148,9 +159,10 @@ int main(int argc, char* argv[])
std::cout << "Usage: " << argv[0] << " [options] [target] ...\n";
std::cout <<
R"_( where target can be either:
- configure - run configuration step (cannot be used with other targets).
- clean - clean all generated files.
- all - build all targets (default)
+ configure - run configuration step (cannot be used with other targets).
+ reconfigure - rerun configuration step with the same arguments as last (cannot be used with other targets).
+ clean - clean all generated files.
+ all - build all targets (default)
or the name of a target which will be built along with its dependencies.
Use '-l' to see a list of possible target names.
@@ -178,6 +190,11 @@ Options:
files.insert(configFiles[i].file);
}
+ for(std::size_t i = 0; i < numExternalConfigFiles; ++i)
+ {
+ files.insert(externalConfigFiles[i].file);
+ }
+
for(const auto& file : files)
{
std::cout << file << "\n";
@@ -189,7 +206,7 @@ Options:
no_default_build = true;
for(const auto& add_file : add_files)
{
- reg(add_file.data(), [](){ return std::vector<BuildConfiguration>{};});
+ reg(add_file.data());
}
for(const auto& remove_file : remove_files)
@@ -198,7 +215,7 @@ Options:
}
// Force rebuild if files were added
- recompileCheck(settings, 1, argv, true, no_relaunch == false);
+ recompileCheck(settings, 1, argv, no_relaunch == false);
}
recompileCheck(settings, argc, argv);
@@ -253,7 +270,7 @@ Options:
{
no_default_build = true;
const auto& c = configuration();
- for(const auto& config : c)
+ for(const auto& config : c.tools)
{
std::cout << config.first << ": " << config.second << "\n";
}
@@ -298,7 +315,8 @@ Options:
auto& targets = getTargets(settings);
for(const auto& target : targets)
{
- if(target.config.type == TargetType::UnitTest)
+ if(target.config.type == TargetType::UnitTest ||
+ target.config.type == TargetType::UnitTestLib)
{
unittest_targets.push_back(target);
}
@@ -320,7 +338,8 @@ Options:
auto& targets = getTargets(settings);
for(const auto& target : targets)
{
- if(target.config.type != TargetType::UnitTest)
+ if(target.config.type != TargetType::UnitTest &&
+ target.config.type != TargetType::UnitTestLib)
{
non_unittest_targets.push_back(target);
}
@@ -349,7 +368,8 @@ Options:
auto& targets = getTargets(settings);
for(const auto& target : targets)
{
- if(target.config.type != TargetType::UnitTest)
+ if(target.config.type != TargetType::UnitTest &&
+ target.config.type != TargetType::UnitTestLib)
{
non_unittest_targets.push_back(target);
}