Skip to content
34 changes: 17 additions & 17 deletions buildcc/lib/target/include/target/api/target_info_getter.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,23 @@ template <typename T> class TargetInfoGetter {
const TargetConfig &GetConfig() const;

// Target Storer
const internal::fs_unordered_set &GetCurrentSourceFiles() const;
const internal::fs_unordered_set &GetCurrentHeaderFiles() const;
const internal::fs_unordered_set &GetCurrentPchFiles() const;
const std::vector<fs::path> &GetTargetLibDeps() const;
const std::vector<std::string> &GetCurrentExternalLibDeps() const;
const internal::fs_unordered_set &GetCurrentIncludeDirs() const;
const internal::fs_unordered_set &GetCurrentLibDirs() const;
const std::unordered_set<std::string> &GetCurrentPreprocessorFlags() const;
const std::unordered_set<std::string> &GetCurrentCommonCompileFlags() const;
const std::unordered_set<std::string> &GetCurrentPchCompileFlags() const;
const std::unordered_set<std::string> &GetCurrentPchObjectFlags() const;
const std::unordered_set<std::string> &GetCurrentAsmCompileFlags() const;
const std::unordered_set<std::string> &GetCurrentCCompileFlags() const;
const std::unordered_set<std::string> &GetCurrentCppCompileFlags() const;
const std::unordered_set<std::string> &GetCurrentLinkFlags() const;
const internal::fs_unordered_set &GetCurrentCompileDependencies() const;
const internal::fs_unordered_set &GetCurrentLinkDependencies() const;
const fs_unordered_set &GetSourceFiles() const;
const fs_unordered_set &GetHeaderFiles() const;
const fs_unordered_set &GetPchFiles() const;
const std::vector<fs::path> &GetLibDeps() const;
const std::vector<std::string> &GetExternalLibDeps() const;
const fs_unordered_set &GetIncludeDirs() const;
const fs_unordered_set &GetLibDirs() const;
const std::unordered_set<std::string> &GetPreprocessorFlags() const;
const std::unordered_set<std::string> &GetCommonCompileFlags() const;
const std::unordered_set<std::string> &GetPchCompileFlags() const;
const std::unordered_set<std::string> &GetPchObjectFlags() const;
const std::unordered_set<std::string> &GetAsmCompileFlags() const;
const std::unordered_set<std::string> &GetCCompileFlags() const;
const std::unordered_set<std::string> &GetCppCompileFlags() const;
const std::unordered_set<std::string> &GetLinkFlags() const;
const fs_unordered_set &GetCompileDependencies() const;
const fs_unordered_set &GetLinkDependencies() const;
};

} // namespace buildcc::base
Expand Down
4 changes: 2 additions & 2 deletions buildcc/lib/target/include/target/base/generator_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class GeneratorLoader : public LoaderInterface {
return loaded_input_files_;
}

const internal::fs_unordered_set &GetLoadedOutputFiles() const noexcept {
const fs_unordered_set &GetLoadedOutputFiles() const noexcept {
return loaded_output_files_;
}

Expand All @@ -58,7 +58,7 @@ class GeneratorLoader : public LoaderInterface {
fs::path path_;

internal::path_unordered_set loaded_input_files_;
internal::fs_unordered_set loaded_output_files_;
fs_unordered_set loaded_output_files_;
std::vector<std::string> loaded_commands_;
};

Expand Down
4 changes: 2 additions & 2 deletions buildcc/lib/target/include/target/base/target_storer.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ struct TargetStorer {
std::vector<fs::path> current_user_lib_deps;
internal::path_unordered_set current_internal_lib_deps;

internal::fs_unordered_set current_include_dirs;
internal::fs_unordered_set current_lib_dirs;
fs_unordered_set current_include_dirs;
fs_unordered_set current_lib_dirs;

// NOTE, Order matters (user takes care of the order here)
std::vector<std::string> current_user_external_lib_deps;
Expand Down
2 changes: 2 additions & 0 deletions buildcc/lib/target/include/target/common/path.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ inline std::string path_as_string(const fs::path &p) {
return internal::Path::CreateNewPath(p).GetPathAsString();
}

typedef internal::fs_unordered_set fs_unordered_set;

} // namespace buildcc

// FMT specialization
Expand Down
2 changes: 1 addition & 1 deletion buildcc/lib/target/include/target/common/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ template <typename T> std::string aggregate(const T &list) {
return fmt::format("{}", fmt::join(list, " "));
}

std::string aggregate(const buildcc::internal::fs_unordered_set &paths);
std::string aggregate(const buildcc::fs_unordered_set &paths);

std::string aggregate_with_prefix(const std::string &prefix,
const fs_unordered_set &dirs);
Expand Down
2 changes: 1 addition & 1 deletion buildcc/lib/target/include/target/friend/compile_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class CompileObject {
GetObjectDataMap() const {
return object_files_;
}
internal::fs_unordered_set GetCompiledSources() const;
fs_unordered_set GetCompiledSources() const;
tf::Task &GetTask() { return compile_task_; }

private:
Expand Down
2 changes: 1 addition & 1 deletion buildcc/lib/target/include/target/generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class Generator : public BuilderInterface {

// Serialization
internal::RelationalPathFiles current_input_files_;
internal::fs_unordered_set current_output_files_;
fs_unordered_set current_output_files_;
std::vector<std::string> current_commands_;
bool parallel_{false};

Expand Down
2 changes: 1 addition & 1 deletion buildcc/lib/target/include/target/private/schema_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ create_fbs_vector_string(flatbuffers::FlatBufferBuilder &builder,

inline std::vector<flatbuffers::Offset<flatbuffers::String>>
create_fbs_vector_string(flatbuffers::FlatBufferBuilder &builder,
const buildcc::internal::fs_unordered_set &fslist) {
const buildcc::fs_unordered_set &fslist) {
std::vector<flatbuffers::Offset<flatbuffers::String>> strs;
std::transform(
fslist.begin(), fslist.end(), std::back_inserter(strs),
Expand Down
4 changes: 2 additions & 2 deletions buildcc/lib/target/include/target/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ class Target : public BuilderInterface,
// Recompilation checks
void RecheckPaths(const internal::path_unordered_set &previous_path,
const internal::path_unordered_set &current_path);
void RecheckDirs(const internal::fs_unordered_set &previous_dirs,
const internal::fs_unordered_set &current_dirs);
void RecheckDirs(const fs_unordered_set &previous_dirs,
const fs_unordered_set &current_dirs);
void RecheckFlags(const std::unordered_set<std::string> &previous_flags,
const std::unordered_set<std::string> &current_flags);
void RecheckExternalLib(
Expand Down
41 changes: 17 additions & 24 deletions buildcc/lib/target/src/api/target_info_getter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,135 +64,128 @@ const TargetConfig &TargetInfoGetter<T>::GetConfig() const {

// Target Storer
template <typename T>
const internal::fs_unordered_set &
TargetInfoGetter<T>::GetCurrentSourceFiles() const {
const fs_unordered_set &TargetInfoGetter<T>::GetSourceFiles() const {
const T &t = static_cast<const T &>(*this);

return t.storer_.current_source_files.user;
}

template <typename T>
const internal::fs_unordered_set &
TargetInfoGetter<T>::GetCurrentHeaderFiles() const {
const fs_unordered_set &TargetInfoGetter<T>::GetHeaderFiles() const {
const T &t = static_cast<const T &>(*this);

return t.storer_.current_header_files.user;
}

template <typename T>
const internal::fs_unordered_set &
TargetInfoGetter<T>::GetCurrentPchFiles() const {
const fs_unordered_set &TargetInfoGetter<T>::GetPchFiles() const {
const T &t = static_cast<const T &>(*this);

return t.storer_.current_pch_files.user;
}

template <typename T>
const std::vector<fs::path> &TargetInfoGetter<T>::GetTargetLibDeps() const {
const std::vector<fs::path> &TargetInfoGetter<T>::GetLibDeps() const {
const T &t = static_cast<const T &>(*this);

return t.storer_.current_user_lib_deps;
}

template <typename T>
const std::vector<std::string> &
TargetInfoGetter<T>::GetCurrentExternalLibDeps() const {
TargetInfoGetter<T>::GetExternalLibDeps() const {
const T &t = static_cast<const T &>(*this);

return t.storer_.current_user_external_lib_deps;
}

template <typename T>
const internal::fs_unordered_set &
TargetInfoGetter<T>::GetCurrentIncludeDirs() const {
const fs_unordered_set &TargetInfoGetter<T>::GetIncludeDirs() const {
const T &t = static_cast<const T &>(*this);

return t.storer_.current_include_dirs;
}

template <typename T>
const internal::fs_unordered_set &
TargetInfoGetter<T>::GetCurrentLibDirs() const {
const fs_unordered_set &TargetInfoGetter<T>::GetLibDirs() const {
const T &t = static_cast<const T &>(*this);

return t.storer_.current_lib_dirs;
}

template <typename T>
const std::unordered_set<std::string> &
TargetInfoGetter<T>::GetCurrentPreprocessorFlags() const {
TargetInfoGetter<T>::GetPreprocessorFlags() const {
const T &t = static_cast<const T &>(*this);

return t.storer_.current_preprocessor_flags;
}

template <typename T>
const std::unordered_set<std::string> &
TargetInfoGetter<T>::GetCurrentCommonCompileFlags() const {
TargetInfoGetter<T>::GetCommonCompileFlags() const {
const T &t = static_cast<const T &>(*this);

return t.storer_.current_common_compile_flags;
}

template <typename T>
const std::unordered_set<std::string> &
TargetInfoGetter<T>::GetCurrentPchCompileFlags() const {
TargetInfoGetter<T>::GetPchCompileFlags() const {
const T &t = static_cast<const T &>(*this);

return t.storer_.current_pch_compile_flags;
}

template <typename T>
const std::unordered_set<std::string> &
TargetInfoGetter<T>::GetCurrentPchObjectFlags() const {
TargetInfoGetter<T>::GetPchObjectFlags() const {
const T &t = static_cast<const T &>(*this);

return t.storer_.current_pch_object_flags;
}

template <typename T>
const std::unordered_set<std::string> &
TargetInfoGetter<T>::GetCurrentAsmCompileFlags() const {
TargetInfoGetter<T>::GetAsmCompileFlags() const {
const T &t = static_cast<const T &>(*this);

return t.storer_.current_asm_compile_flags;
}

template <typename T>
const std::unordered_set<std::string> &
TargetInfoGetter<T>::GetCurrentCCompileFlags() const {
TargetInfoGetter<T>::GetCCompileFlags() const {
const T &t = static_cast<const T &>(*this);

return t.storer_.current_c_compile_flags;
}

template <typename T>
const std::unordered_set<std::string> &
TargetInfoGetter<T>::GetCurrentCppCompileFlags() const {
TargetInfoGetter<T>::GetCppCompileFlags() const {
const T &t = static_cast<const T &>(*this);

return t.storer_.current_cpp_compile_flags;
}

template <typename T>
const std::unordered_set<std::string> &
TargetInfoGetter<T>::GetCurrentLinkFlags() const {
TargetInfoGetter<T>::GetLinkFlags() const {
const T &t = static_cast<const T &>(*this);

return t.storer_.current_link_flags;
}

template <typename T>
const internal::fs_unordered_set &
TargetInfoGetter<T>::GetCurrentCompileDependencies() const {
const fs_unordered_set &TargetInfoGetter<T>::GetCompileDependencies() const {
const T &t = static_cast<const T &>(*this);

return t.storer_.current_compile_dependencies.user;
}

template <typename T>
const internal::fs_unordered_set &
TargetInfoGetter<T>::GetCurrentLinkDependencies() const {
const fs_unordered_set &TargetInfoGetter<T>::GetLinkDependencies() const {
const T &t = static_cast<const T &>(*this);

return t.storer_.current_link_dependencies.user;
Expand Down
2 changes: 1 addition & 1 deletion buildcc/lib/target/src/common/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace buildcc::internal {

// Aggregates

std::string aggregate(const buildcc::internal::fs_unordered_set &paths) {
std::string aggregate(const buildcc::fs_unordered_set &paths) {
std::vector<std::string> agg;
std::transform(
paths.begin(), paths.end(), std::back_inserter(agg),
Expand Down
17 changes: 8 additions & 9 deletions buildcc/lib/target/src/target/build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,15 @@ void Target::Build() {
// Target default arguments
command_.AddDefaultArguments({
{kIncludeDirs, internal::aggregate_with_prefix(config_.prefix_include_dir,
GetCurrentIncludeDirs())},
{kLibDirs, internal::aggregate_with_prefix(config_.prefix_lib_dir,
GetCurrentLibDirs())},
GetIncludeDirs())},
{kLibDirs,
internal::aggregate_with_prefix(config_.prefix_lib_dir, GetLibDirs())},

{kPreprocessorFlags, internal::aggregate(GetCurrentPreprocessorFlags())},
{kCommonCompileFlags,
internal::aggregate(GetCurrentCommonCompileFlags())},
{kPreprocessorFlags, internal::aggregate(GetPreprocessorFlags())},
{kCommonCompileFlags, internal::aggregate(GetCommonCompileFlags())},
// TODO, Cache more flags here
// ASM, C and CPP flags
{kLinkFlags, internal::aggregate(GetCurrentLinkFlags())},
{kLinkFlags, internal::aggregate(GetLinkFlags())},

// Toolchain executables here
{kAsmCompiler, toolchain_.GetAsmCompiler()},
Expand All @@ -104,8 +103,8 @@ void Target::Build() {
// PCH Compile
if (state_.ContainsPch()) {
command_.AddDefaultArguments({
{kPchCompileFlags, internal::aggregate(GetCurrentPchCompileFlags())},
{kPchObjectFlags, internal::aggregate(GetCurrentPchObjectFlags())},
{kPchCompileFlags, internal::aggregate(GetPchCompileFlags())},
{kPchObjectFlags, internal::aggregate(GetPchObjectFlags())},
{kPchObjectOutput, fmt::format("{}", compile_pch_.GetObjectPath())},
});

Expand Down
18 changes: 9 additions & 9 deletions buildcc/lib/target/src/target/friend/compile_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ void CompileObject::CacheCompileCommands() {
}
}

internal::fs_unordered_set CompileObject::GetCompiledSources() const {
internal::fs_unordered_set compiled_sources;
fs_unordered_set CompileObject::GetCompiledSources() const {
fs_unordered_set compiled_sources;
for (const auto &p : object_files_) {
compiled_sources.insert(p.second.output);
}
Expand Down Expand Up @@ -145,19 +145,19 @@ void CompileObject::BuildObjectCompile(
target_.dirty_ = true;
} else {
target_.RecheckFlags(loader.GetLoadedPreprocessorFlags(),
target_.GetCurrentPreprocessorFlags());
target_.GetPreprocessorFlags());
target_.RecheckFlags(loader.GetLoadedCommonCompileFlags(),
target_.GetCurrentCommonCompileFlags());
target_.GetCommonCompileFlags());
target_.RecheckFlags(loader.GetLoadedPchObjectFlags(),
target_.GetCurrentPchObjectFlags());
target_.GetPchObjectFlags());
target_.RecheckFlags(loader.GetLoadedAsmCompileFlags(),
target_.GetCurrentAsmCompileFlags());
target_.GetAsmCompileFlags());
target_.RecheckFlags(loader.GetLoadedCCompileFlags(),
target_.GetCurrentCCompileFlags());
target_.GetCCompileFlags());
target_.RecheckFlags(loader.GetLoadedCppCompileFlags(),
target_.GetCurrentCppCompileFlags());
target_.GetCppCompileFlags());
target_.RecheckDirs(loader.GetLoadedIncludeDirs(),
target_.GetCurrentIncludeDirs());
target_.GetIncludeDirs());
target_.RecheckPaths(loader.GetLoadedHeaders(),
storer.current_header_files.internal);
target_.RecheckPaths(loader.GetLoadedCompileDependencies(),
Expand Down
Loading