This commit is contained in:
parent
659103a123
commit
03717b5f33
9 changed files with 230 additions and 14 deletions
39
interfaces/Crafter.Build-Asset.cppm
Normal file
39
interfaces/Crafter.Build-Asset.cppm
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
Crafter® Build
|
||||
Copyright (C) 2026 Catcrafts®
|
||||
Catcrafts.net
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License version 3.0 as published by the Free Software Foundation;
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
module;
|
||||
#include "Crafter.Build-Api.h"
|
||||
export module Crafter.Build:Asset;
|
||||
import std;
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
namespace Crafter {
|
||||
// Compress a build-time asset (.png/.obj) into its on-disk
|
||||
// SaveCompressed counterpart (.ctex/.cmesh) using Crafter.Asset's
|
||||
// library API in-process. Returns "" on success, an error message
|
||||
// otherwise (matches Shader::Compile's contract).
|
||||
//
|
||||
// Real implementation lives in the impl unit and only compiles when
|
||||
// CRAFTER_BUILD_HAS_ASSET is defined (i.e. when the build links
|
||||
// Crafter.Asset). The bootstrap build.sh produces a stub variant
|
||||
// that errors out at runtime if cfg.assets is non-empty — full
|
||||
// support requires a self-host rebuild via crafter-build itself,
|
||||
// which resolves the Crafter.Asset dep through project.cpp.
|
||||
export CRAFTER_API std::string CompressAsset(const fs::path& input, const fs::path& output);
|
||||
}
|
||||
|
|
@ -125,6 +125,15 @@ export namespace Crafter {
|
|||
std::vector<fs::path> buildFiles;
|
||||
std::vector<Define> defines;
|
||||
std::vector<Shader> shaders;
|
||||
// Source assets (.png, .obj) compressed via Crafter.Asset's
|
||||
// SaveCompressed → .ctex/.cmesh in this configuration's bin dir.
|
||||
// Requires Crafter.Asset in cfg.dependencies (transitively): the
|
||||
// build engine locates it by name and uses its library API to do
|
||||
// the conversion (an auxiliary host-target executable, generated
|
||||
// once per build host, links Crafter.Asset and is invoked per
|
||||
// asset). Forwarded to a consuming executable's bin dir alongside
|
||||
// .spv shaders and cfg.files entries.
|
||||
std::vector<fs::path> assets;
|
||||
std::vector<ExternalDependency> externalDependencies;
|
||||
std::vector<std::string> compileFlags;
|
||||
std::vector<std::string> linkFlags;
|
||||
|
|
|
|||
|
|
@ -24,4 +24,5 @@ export import :Implementation;
|
|||
export import :Shader;
|
||||
export import :External;
|
||||
export import :Test;
|
||||
export import :Progress;
|
||||
export import :Progress;
|
||||
export import :Asset;
|
||||
Loading…
Add table
Add a link
Reference in a new issue