Skip to content

Commit

Permalink
Add generic FilesTarget for files only packages.
Browse files Browse the repository at this point in the history
  • Loading branch information
egorpugin committed Apr 26, 2024
1 parent f9434ef commit a2a232a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/sw/driver/sw.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ using sw::ValaExecutable;

using sw::PythonLibrary;

using sw::FilesTarget;

//
using sw::ConfigureFlags;
using sw::PrecompiledHeader;
Expand Down
23 changes: 23 additions & 0 deletions src/sw/driver/target/other.h
Original file line number Diff line number Diff line change
Expand Up @@ -330,4 +330,27 @@ struct SW_DRIVER_CPP_API PythonLibrary : Target
SW_TARGET_ADD_DEPENDENCIES(PythonLibrary, addSourceDependency)
};

struct FilesTarget : Target, SourceFileTargetOptions
{
FilesTarget(TargetBase &parent, const PackageId &id)
: Target(parent, id), SourceFileTargetOptions(static_cast<Target &>(*this))
{
}

using Target::operator+=;
using Target::operator=;
using Target::add;
SW_TARGET_USING_ASSIGN_OPS(SourceFileTargetOptions);

Files gatherAllFiles() const override
{
Files files;
for (auto &f : *this)
files.insert(f.first);
return files;
}

SW_TARGET_ADD_DEPENDENCIES(FilesTarget, addSourceDependency)
};

}

0 comments on commit a2a232a

Please sign in to comment.