- Renamed build script for brief target descriptor generation

- Created new TargetService class
- Moved brief target descriptor mapping to new TargetService class
- Replaced CMake custom commands with custom targets, for TDF validation and brief target descriptor generation build scripts
- Moved BriefTargetDescriptor into separate header file
This commit is contained in:
Nav
2024-03-02 01:59:55 +00:00
parent e75ce8b403
commit 4aa8ed30de
12 changed files with 182 additions and 123 deletions

View File

@@ -0,0 +1,48 @@
#pragma once
#include <string>
#include <map>
#include <cstdint>
#include <optional>
#include <functional>
#include "src/Targets/BriefTargetDescriptor.hpp"
namespace Services
{
class TargetService
{
public:
/**
* Performs a lookup for the given target configuration value, to retrieve the corresponding brief target
* descriptor object.
*
* @param configValue
* The target configuration value to lookup.
*
* @return
* A BriefTargetDescriptor object, if found, otherwise, std::nullopt.
*/
static std::optional<Targets::BriefTargetDescriptor> briefDescriptor(const std::string& configValue);
/**
* Provides access to the internal mapping of the brief target descriptor objects of all targets supported by
* Bloom. See TargetService::descriptorsByConfigValue for more.
*
* @return
*/
static const std::map<std::string, Targets::BriefTargetDescriptor>& briefDescriptorsByConfigValue();
private:
/**
* This mapping contains brief target descriptor objects for every target supported by Bloom, mapped by their
* configuration value. The contents is generated by a build script and stored in an ASCII text file, located
* at GENERATED_BRIEF_TARGET_DESCRIPTOR_MAPPING_PATH.
*
* See build/scripts/GenerateBriefTargetDescriptors.php and the root CMakeLists.txt for more.
*/
static const inline std::map<std::string, Targets::BriefTargetDescriptor> descriptorsByConfigValue = {
#include GENERATED_BRIEF_TARGET_DESCRIPTOR_MAPPING_PATH
};
};
}