Browse Source

Merge branch 'develop' into feature/pkg-id-type

default_compile_flags
vector-of-bool 5 years ago
parent
commit
60427b068e
4 changed files with 25 additions and 12 deletions
  1. +2
    -5
      src/dds/build.cpp
  2. +23
    -4
      src/dds/build/plan/compile_exec.cpp
  3. +0
    -2
      src/dds/package_manifest.cpp
  4. +0
    -1
      src/dds/package_manifest.hpp

+ 2
- 5
src/dds/build.cpp View File

@@ -133,6 +133,7 @@ void prepare_catch2_driver(library_build_params& lib_params,

if (test_driver == test_lib::catch_) {
// Don't generate a test library helper
return;
}

std::string fname;
@@ -141,9 +142,6 @@ void prepare_catch2_driver(library_build_params& lib_params,
if (test_driver == test_lib::catch_main) {
fname = "catch-main.cpp";
definition = "CATCH_CONFIG_MAIN";
} else if (test_driver == test_lib::catch_runner) {
fname = "catch-runner.cpp";
definition = "CATCH_CONFIG_RUNNER";
} else {
assert(false && "Impossible: Invalid `test_driver` for catch library");
std::terminate();
@@ -179,8 +177,7 @@ void prepare_test_driver(library_build_params& lib_params,
const package_manifest& man,
build_env_ref env) {
auto& test_driver = *man.test_driver;
if (test_driver == test_lib::catch_ || test_driver == test_lib::catch_main
|| test_driver == test_lib::catch_runner) {
if (test_driver == test_lib::catch_ || test_driver == test_lib::catch_main) {
prepare_catch2_driver(lib_params, test_driver, params, env);
} else {
assert(false && "Unreachable");

+ 23
- 4
src/dds/build/plan/compile_exec.cpp View File

@@ -10,6 +10,7 @@
#include <spdlog/spdlog.h>

#include <algorithm>
#include <atomic>
#include <cassert>
#include <thread>

@@ -77,16 +78,30 @@ struct compile_file_full {
compile_command_info cmd_info;
};

std::optional<deps_info> do_compile(const compile_file_full& cf, build_env_ref env) {
struct compile_counter {
std::atomic_size_t n;
const std::size_t max;
const std::size_t max_digits;
};

std::optional<deps_info>
do_compile(const compile_file_full& cf, build_env_ref env, compile_counter& counter) {
fs::create_directories(cf.object_file_path.parent_path());
auto source_path = cf.plan.source_path();
auto msg = fmt::format("[{}] Compile: {:40}",
auto msg = fmt::format("[{}] Compile: {}",
cf.plan.qualifier(),
fs::relative(source_path, cf.plan.source().basis_path).string());
spdlog::info(msg);
auto&& [dur_ms, proc_res]
= timed<std::chrono::milliseconds>([&] { return run_proc(cf.cmd_info.command); });
spdlog::info("{} - {:>7n}ms", msg, dur_ms.count());

auto nth = counter.n.fetch_add(1);
spdlog::info("{:60} - {:>7n}ms [{:{}}/{}]",
msg,
dur_ms.count(),
nth,
counter.max_digits,
counter.max);

const bool compiled_okay = proc_res.okay();
const auto compile_retc = proc_res.retc;
@@ -192,10 +207,14 @@ bool dds::detail::compile_all(const ref_vector<const compile_file_plan>& compile
| views::transform([&](auto&& plan) { return realize_plan(plan, env); }) //
| views::filter([&](auto&& real) { return should_compile(real, env); });

const auto total = compiles.size();
const auto max_digits = fmt::format("{}", total).size();
compile_counter counter{{0}, total, max_digits};

std::vector<deps_info> all_new_deps;
std::mutex mut;
auto okay = parallel_run(each_realized, njobs, [&](const compile_file_full& full) {
auto new_dep = do_compile(full, env);
auto new_dep = do_compile(full, env, counter);
if (new_dep) {
std::unique_lock lk{mut};
all_new_deps.push_back(std::move(*new_dep));

+ 0
- 2
src/dds/package_manifest.cpp View File

@@ -37,8 +37,6 @@ package_manifest package_manifest::load_from_file(const fs::path& fpath) {
auto& test_driver_str = *opt_test_driver;
if (test_driver_str == "Catch-Main") {
ret.test_driver = test_lib::catch_main;
} else if (test_driver_str == "Catch-Runner") {
ret.test_driver = test_lib::catch_runner;
} else if (test_driver_str == "Catch") {
ret.test_driver = test_lib::catch_;
} else {

+ 0
- 1
src/dds/package_manifest.hpp View File

@@ -14,7 +14,6 @@ namespace dds {
enum class test_lib {
catch_,
catch_main,
catch_runner,
};

struct package_manifest {

Loading…
Cancel
Save