DEKI/ENGINE docs
Deki 0.19.0
Modular C++ 2D engine for embedded displays and desktop
Loading...
Searching...
No Matches
DekiEditor::CMakeGen Namespace Reference

Classes

struct  FrameworkDependency
 One thing a package needs from a build framework, from package.json: "dependencies": { "<framework id>": [ "bare-name", { "name": "...", ... } ] }. More...
struct  FeatureEntry
 One entry of a package's "features": a compile definition the package brings, the component types it provides, and whether it may be left out. More...
struct  PackageEntry
 Package manifest data, parsed from package.json and package.cmake. More...

Enumerations

enum class  TransformWidth { None = 0 , TwoD = 2 , ThreeD = 3 }
 The transform width a build compiles into Deki::Object (see deki-engine/include/deki/Object.h and COMPATIBILITY.md). More...

Functions

std::vector< std::string > MissingCapabilities (const PackageEntry &pkg, const std::set< std::string > &platformCapabilities)
 What pkg needs that platformCapabilities does not offer.
bool PackageSupportsPlatform (const PackageEntry &pkg, const std::set< std::string > &platformCapabilities)
 True when MissingCapabilities is empty.
std::vector< PackageEntry > ScanPackageManifests (const std::string &projectPath)
 Reads every package manifest in the project's packages/ directory.
bool FeatureInBuild (const FeatureEntry &feature, const std::vector< std::string > &packageDefines)
 Whether a feature is compiled into a build with these defines: always when no feature plan is in force (the editor's own build), else when its define is.
std::vector< std::string > RequiredPackagesInBuild (const PackageEntry &pkg, const std::vector< std::string > &packageDefines)
 The packages pkg needs in a build with these defines: the package's own requires plus those of each feature in the build.
std::set< std::string > ResolveActivePackages (const std::vector< PackageEntry > &allPackages, const std::vector< std::string > &packageDefines, const std::set< std::string > &platformCapabilities={})
 The packages active for these build defines, transitive dependencies included.
std::vector< std::string > ReadProjectTags (const std::string &projectPath)
 deki.json "tags", or an empty list when there is none.
TransformWidth ResolveTransformWidth (const std::vector< PackageEntry > &allPackages, const std::set< std::string > &activeIds, const std::vector< std::string > &projectTags, std::string *why=nullptr)
 The widest transform anything active declares.
TransformWidth ResolveProjectTransformWidth (const std::vector< PackageEntry > &allPackages, const std::vector< std::string > &projectTags, std::string *why=nullptr)
 The width for a project, which is what a build must compile.
std::vector< std::string > TransformDefines (TransformWidth width)
 The compile definitions for a width: none, DEKI_TRANSFORM_2D, or both.
void EmitEngineCoreSourceCollection (std::ostream &out, const std::vector< std::string > &extraExclusions={})
 Writes the CMake that collects the engine core sources (GLOB_RECURSE plus the standard exclusions).
std::string CMakeIdentifier (const std::string &name)
 A name as CMake spells it after string(MAKE_C_IDENTIFIER): every character outside [A-Za-z0-9] becomes '', and a leading digit gets a '' in front.
std::string EscapeCppString (const std::string &s)
 s escaped to sit between double quotes in generated C++: backslashes, quotes and newlines escaped.
std::string EscapeCMakeString (const std::string &s)
 s escaped to sit between double quotes in generated CMake: backslashes, quotes, $ and ; escaped so it stays one literal argument.
void EmitActivePackageSources (std::ostream &out, const std::vector< PackageEntry > &allPackages, const std::set< std::string > &activePackageIds, const std::vector< std::string > &sourceExcludeRegexes={}, bool excludeGenerated=false)
 Writes one GLOB_RECURSE per active package, leaving out editor/.
void EmitGeneratedFileSources (std::ostream &out, const std::string &enginePath, const std::vector< PackageEntry > &allPackages, const std::set< std::string > &activePackageIds)
 Writes the .gen.cpp sources of the active packages only.
void EmitProjectSourceCollection (std::ostream &out, const std::string &relPath="${DEKI_PROJECT_PATH}/src", bool excludePluginExports=false)
 Writes the CMake that collects the project's own sources from src/.
void EmitPlatformDefines (std::ostream &out, const std::string &targetName, const PlatformConfig &config, const std::vector< std::string > &packageDefines, const std::vector< std::string > &skipDefines={})
 Writes the target_compile_definitions block.
void EmitIncludePaths (std::ostream &out, const std::string &targetName, const std::string &projectSrcRelPath="${DEKI_PROJECT_PATH}/src", const std::vector< std::string > &extraPaths={})
 Writes the target_include_directories block.
std::string GeneratePackageInitFile (const std::filesystem::path &outputDir, const std::vector< PackageEntry > &allPackages, const std::set< std::string > &activePackageIds, const std::filesystem::path &projectSrcPath="", bool engineDefinesSystemInit=false)
 Generates a package_init.cpp that calls each package's RegisterComponents() and registers project components with ComponentFactory, for embedded builds.
bool WriteIfChanged (const std::filesystem::path &filePath, const std::string &content)
 Writes content only if the file differs, so unchanged files cause no rebuild.

Enumeration Type Documentation

◆ TransformWidth

The transform width a build compiles into Deki::Object (see deki-engine/include/deki/Object.h and COMPATIBILITY.md).

A package that reads or writes an object's position, rotation or scale carries "transform_2d" in its package.json "tags"; one that needs the third axis carries "transform_3d"; a project's own scripts declare the same in deki.json. The build takes the widest across the active packages and the project. If nothing declares one, the object has no transform.

Enumerator
None 
TwoD 
ThreeD 

Function Documentation

◆ MissingCapabilities()

std::vector< std::string > DekiEditor::CMakeGen::MissingCapabilities ( const PackageEntry & pkg,
const std::set< std::string > & platformCapabilities )

What pkg needs that platformCapabilities does not offer.

Empty means it can build there. A package that requires nothing builds anywhere, and so does any package when the capability set is empty (no target in hand).

◆ PackageSupportsPlatform()

bool DekiEditor::CMakeGen::PackageSupportsPlatform ( const PackageEntry & pkg,
const std::set< std::string > & platformCapabilities )

True when MissingCapabilities is empty.

◆ ScanPackageManifests()

std::vector< PackageEntry > DekiEditor::CMakeGen::ScanPackageManifests ( const std::string & projectPath)

Reads every package manifest in the project's packages/ directory.

◆ FeatureInBuild()

bool DekiEditor::CMakeGen::FeatureInBuild ( const FeatureEntry & feature,
const std::vector< std::string > & packageDefines )

Whether a feature is compiled into a build with these defines: always when no feature plan is in force (the editor's own build), else when its define is.

◆ RequiredPackagesInBuild()

std::vector< std::string > DekiEditor::CMakeGen::RequiredPackagesInBuild ( const PackageEntry & pkg,
const std::vector< std::string > & packageDefines )

The packages pkg needs in a build with these defines: the package's own requires plus those of each feature in the build.

◆ ResolveActivePackages()

std::set< std::string > DekiEditor::CMakeGen::ResolveActivePackages ( const std::vector< PackageEntry > & allPackages,
const std::vector< std::string > & packageDefines,
const std::set< std::string > & platformCapabilities = {} )

The packages active for these build defines, transitive dependencies included.

platformCapabilities drops packages the target cannot satisfy, along with dependency edges to them; empty means no platform filtering.

◆ ReadProjectTags()

std::vector< std::string > DekiEditor::CMakeGen::ReadProjectTags ( const std::string & projectPath)

deki.json "tags", or an empty list when there is none.

◆ ResolveTransformWidth()

TransformWidth DekiEditor::CMakeGen::ResolveTransformWidth ( const std::vector< PackageEntry > & allPackages,
const std::set< std::string > & activeIds,
const std::vector< std::string > & projectTags,
std::string * why = nullptr )

The widest transform anything active declares.

why receives one line for the build log saying who declared what, or that nothing did.

◆ ResolveProjectTransformWidth()

TransformWidth DekiEditor::CMakeGen::ResolveProjectTransformWidth ( const std::vector< PackageEntry > & allPackages,
const std::vector< std::string > & projectTags,
std::string * why = nullptr )

The width for a project, which is what a build must compile.

It ignores which packages a given target ends up with, so all targets of a project agree on what a Deki::Object is. Otherwise a board without deki-3d would compile a narrower object and a scene authored with a third axis would lose it there without warning. The cost is a board carrying a wider object than it needs.

◆ TransformDefines()

std::vector< std::string > DekiEditor::CMakeGen::TransformDefines ( TransformWidth width)

The compile definitions for a width: none, DEKI_TRANSFORM_2D, or both.

◆ EmitEngineCoreSourceCollection()

void DekiEditor::CMakeGen::EmitEngineCoreSourceCollection ( std::ostream & out,
const std::vector< std::string > & extraExclusions = {} )

Writes the CMake that collects the engine core sources (GLOB_RECURSE plus the standard exclusions).

◆ CMakeIdentifier()

std::string DekiEditor::CMakeGen::CMakeIdentifier ( const std::string & name)

A name as CMake spells it after string(MAKE_C_IDENTIFIER): every character outside [A-Za-z0-9] becomes '', and a leading digit gets a '' in front.

◆ EscapeCppString()

std::string DekiEditor::CMakeGen::EscapeCppString ( const std::string & s)

s escaped to sit between double quotes in generated C++: backslashes, quotes and newlines escaped.

◆ EscapeCMakeString()

std::string DekiEditor::CMakeGen::EscapeCMakeString ( const std::string & s)

s escaped to sit between double quotes in generated CMake: backslashes, quotes, $ and ; escaped so it stays one literal argument.

◆ EmitActivePackageSources()

void DekiEditor::CMakeGen::EmitActivePackageSources ( std::ostream & out,
const std::vector< PackageEntry > & allPackages,
const std::set< std::string > & activePackageIds,
const std::vector< std::string > & sourceExcludeRegexes = {},
bool excludeGenerated = false )

Writes one GLOB_RECURSE per active package, leaving out editor/.

sourceExcludeRegexes leave stripped components out (FeatureResolver); excludeGenerated leaves out the package's checked-in generated/ when the build regenerates reflection itself.

◆ EmitGeneratedFileSources()

void DekiEditor::CMakeGen::EmitGeneratedFileSources ( std::ostream & out,
const std::string & enginePath,
const std::vector< PackageEntry > & allPackages,
const std::set< std::string > & activePackageIds )

Writes the .gen.cpp sources of the active packages only.

◆ EmitProjectSourceCollection()

void DekiEditor::CMakeGen::EmitProjectSourceCollection ( std::ostream & out,
const std::string & relPath = "${DEKI_PROJECT_PATH}/src",
bool excludePluginExports = false )

Writes the CMake that collects the project's own sources from src/.

◆ EmitPlatformDefines()

void DekiEditor::CMakeGen::EmitPlatformDefines ( std::ostream & out,
const std::string & targetName,
const PlatformConfig & config,
const std::vector< std::string > & packageDefines,
const std::vector< std::string > & skipDefines = {} )

Writes the target_compile_definitions block.

◆ EmitIncludePaths()

void DekiEditor::CMakeGen::EmitIncludePaths ( std::ostream & out,
const std::string & targetName,
const std::string & projectSrcRelPath = "${DEKI_PROJECT_PATH}/src",
const std::vector< std::string > & extraPaths = {} )

Writes the target_include_directories block.

◆ GeneratePackageInitFile()

std::string DekiEditor::CMakeGen::GeneratePackageInitFile ( const std::filesystem::path & outputDir,
const std::vector< PackageEntry > & allPackages,
const std::set< std::string > & activePackageIds,
const std::filesystem::path & projectSrcPath = "",
bool engineDefinesSystemInit = false )

Generates a package_init.cpp that calls each package's RegisterComponents() and registers project components with ComponentFactory, for embedded builds.

Returns the generated file's path, to add to the sources.

engineDefinesSystemInit true: the engine core already defines deki_init_package_systems()/deki_shutdown_package_systems() (the static desktop simulator links the committed empty AllPackageInit.gen.cpp stub). This file must not define them again, or the link fails; the package *_InitSystem() calls go at the end of DekiRegisterProjectPackages() instead. False (the default, firmware): the engine leaves the stub out and this file defines both functions.

◆ WriteIfChanged()

bool DekiEditor::CMakeGen::WriteIfChanged ( const std::filesystem::path & filePath,
const std::string & content )

Writes content only if the file differs, so unchanged files cause no rebuild.