Polyphase Game Engine
Loading...
Searching...
No Matches
EngineRuntimeValidator.h
Go to the documentation of this file.
1#pragma once
2
3#if EDITOR
4
8
9#include <cstdint>
10#include <string>
11
12// EngineRuntimeValidator
13//
14// Reads a vendored engine runtime from
15// <Project>/Vendor/PolyphaseRuntime/<Platform>-<Arch>-<Config>/
16// and produces a Validation::Report describing whether the runtime is
17// usable. Stable error codes (each becomes a single Validation::Message):
18//
19// RT_FOLDER_MISSING — vendored runtime folder absent
20// RT_MANIFEST_MISSING — engine-runtime.json absent
21// RT_MANIFEST_PARSE — manifest JSON parse error
22// RT_SCHEMA_VERSION — manifest schemaVersion newer than supported
23// RT_TARGET_MISMATCH — platform/arch/config != requested
24// RT_ABI_MISMATCH — manifest engine.abi != requiredAbi
25// RT_VERSION_OLDER — warning when versions differ but ABI matches
26// RT_BINARY_MISSING — binary.module absent on disk
27// RT_BINARY_HASH — on-disk SHA256 != binary.moduleSha256
28// RT_IMPORTLIB_MISSING — Windows: binary.importLib absent (Warning by
29// default, Error when attemptSymbolProbe is set)
30// RT_RPATH_NONLOCAL — Linux: readelf shows no $ORIGIN rpath
31// (Warning; degrades to silent skip if readelf
32// unavailable)
33// RT_SYMBOL_PROBE_FAILED — when attemptSymbolProbe is set, dlopen +
34// dlsym for each requiredExports entry failed
35//
36// Validators expose the parsed manifest on success so callers can render
37// it back to the user. Update() copies a source runtime into the project's
38// Vendor/ tree and re-runs validation against the copied result.
39
40constexpr uint32_t kRuntimeManifestSchemaVersionSupported = 1;
41
42struct RuntimeValidationOptions
43{
44 std::string projectDir;
45 std::string platform; // "Windows" | "Linux"
46 std::string arch; // "x64"
47 std::string config; // "Debug" | "Release"
48 uint32_t requiredAbi = POLYPHASE_ENGINE_ABI;
49 bool attemptSymbolProbe = false;
50};
51
52struct RuntimeValidationResult
53{
54 Validation::Report report;
55 EngineRuntimeManifest manifest;
56 std::string runtimeFolder; // absolute path that was inspected
57};
58
59struct RuntimeUpdateOptions
60{
61 std::string projectDir;
62 std::string sourceRuntimePath; // directory containing module + manifest
63 std::string platform;
64 std::string arch;
65 std::string config;
66 bool overwrite = true;
67};
68
69// Composes the vendored runtime path for a given option set:
70// <projectDir>/Vendor/PolyphaseRuntime/<Platform>-<Arch>-<Config>
71// Returns an empty string if any of projectDir / platform / arch / config
72// is empty.
73std::string GetProjectRuntimeFolder(const std::string& projectDir,
74 const std::string& platform,
75 const std::string& arch,
76 const std::string& config);
77
78RuntimeValidationResult ValidateProjectRuntime(const RuntimeValidationOptions& opts);
79RuntimeValidationResult UpdateProjectRuntime(const RuntimeUpdateOptions& opts);
80
81#endif // EDITOR
#define POLYPHASE_ENGINE_ABI
Definition PolyphaseAbi.h:13
Definition EngineRuntimeManifest.h:40