demotool/c-buildcfg.hh

59 lines
1.6 KiB
C++

#pragma once
#ifndef REAL_BUILD
# include "externals.hh"
#endif
/*= BUILD CONFIGURATIONS =====================================================*/
// Build configuration
struct T_BuildConfiguration
{
// Targets -------------------------------------------------------------
// Resolutions
bool resolutionChooser{ true };
T_Array< std::pair< uint32_t , uint32_t > > resolutions;
// Enable optimizer?
bool optimize{ false };
// Constant folding ----------------------------------------------------
// Main toggle
bool constantFolding{ false };
// Optimize $width and $height away if the size is fixed
bool cfFixedSize{ false };
// Get rid of (get-input) for constant or undefined curves
bool cfInputs{ false };
// Dead code elimination -----------------------------------------------
bool deadCodeElimination{ false };
};
// Table of avaiable build configurations
using T_BuildConfigurations = T_KeyValueTable< T_String , T_BuildConfiguration >;
// Build configurations loader
struct T_BuildConfigurationLoader : public ebcl::A_PrivateImplementation
{
T_BuildConfigurationLoader( ) noexcept;
// Load build configurations from the specified path; may throw
// X_StreamError or X_SRDErrors
T_BuildConfigurations load( T_String const& path );
};
/*----------------------------------------------------------------------------*/
// Logger
using F_OPGenLog = std::function< T_StringBuilder( ) >;
using F_OPLogger = std::function< void( F_OPGenLog , uint32_t ) >;
// Runtime configuration (logger, etc.)
struct T_BuildRuntimeConfiguration
{
F_OPLogger logger{ [](auto,auto){} };
};