Browse Source

Reduce lengthy compile commands by removing dup include-paths

default_compile_flags
vector-of-bool 3 years ago
parent
commit
84dc581963
2 changed files with 18 additions and 1 deletions
  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 View File

#include <dds/util/signal.hpp> #include <dds/util/signal.hpp>
#include <dds/util/time.hpp> #include <dds/util/time.hpp>


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

#include <string> #include <string>
#include <vector> #include <vector>


extend(spec.external_include_dirs, env.ureqs.include_paths(use)); extend(spec.external_include_dirs, env.ureqs.include_paths(use));
} }
extend(spec.definitions, _rules.defs()); 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); return env.toolchain.create_compile_command(spec, dds::fs::current_path(), env.knobs);
} }



+ 12
- 1
src/dds/util/algo.hpp View File

c.insert(c.end(), il.begin(), il.end()); 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> template <typename T>
using ref_vector = std::vector<std::reference_wrapper<T>>; using ref_vector = std::vector<std::reference_wrapper<T>>;


} // namespace dds
} // namespace dds

Loading…
Cancel
Save