Bladeren bron

Reduce lengthy compile commands by removing dup include-paths

default_compile_flags
vector-of-bool 3 jaren geleden
bovenliggende
commit
84dc581963
2 gewijzigde bestanden met toevoegingen van 18 en 1 verwijderingen
  1. +6
    -0
      src/dds/build/plan/compile_file.cpp
  2. +12
    -1
      src/dds/util/algo.hpp

+ 6
- 0
src/dds/build/plan/compile_file.cpp Bestand weergeven

@@ -5,6 +5,9 @@
#include <dds/util/signal.hpp>
#include <dds/util/time.hpp>

#include <range/v3/algorithm/sort.hpp>
#include <range/v3/algorithm/unique.hpp>

#include <string>
#include <vector>

@@ -24,6 +27,9 @@ compile_command_info compile_file_plan::generate_compile_command(build_env_ref e
extend(spec.external_include_dirs, env.ureqs.include_paths(use));
}
extend(spec.definitions, _rules.defs());
// Avoid huge command lines by shrinking down the list of #include dirs
sort_unique_erase(spec.external_include_dirs);
sort_unique_erase(spec.include_dirs);
return env.toolchain.create_compile_command(spec, dds::fs::current_path(), env.knobs);
}


+ 12
- 1
src/dds/util/algo.hpp Bestand weergeven

@@ -35,7 +35,18 @@ void extend(Container& c, std::initializer_list<Item> il) {
c.insert(c.end(), il.begin(), il.end());
}

template <typename Container>
void unique_erase(Container& c) noexcept {
c.erase(std::unique(c.begin(), c.end()), c.end());
}

template <typename Container>
void sort_unique_erase(Container& c) noexcept {
std::sort(c.begin(), c.end());
unique_erase(c);
}

template <typename T>
using ref_vector = std::vector<std::reference_wrapper<T>>;

} // namespace dds
} // namespace dds

Laden…
Annuleren
Opslaan