Crafter.Build/interfaces/Crafter.Build-Configuration.cppm
2025-11-09 20:29:30 +01:00

70 lines
2.4 KiB
C++

/*
Crafter® Build
Copyright (C) 2025 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 "../lib/json.hpp"
export module Crafter.Build:Configuration;
import std;
import :Implementation;
import :Shader;
import :Module;
namespace fs = std::filesystem;
namespace Crafter {
export struct Define {
std::string name;
std::string value;
Define(std::string&& name, std::string&& value): name(std::move(name)), value(std::move(value)) { }
};
export class Dependency {
public:
std::string path;
std::string configuration;
std::string commit;
std::string branch;
Dependency(std::string&& path, std::string&& configuration, std::string&& commit, std::string&& branch): path(std::move(path)), configuration(std::move(configuration)), commit(std::move(commit)), branch(std::move(branch)) { }
};;
export enum ConfigurationType {
CRAFTER_CONFIGURATION_TYPE_EXECUTABLE,
CRAFTER_CONFIGURATION_TYPE_LIBRARY,
CRAFTER_CONFIGURATION_TYPE_SHARED_LIBRARY,
};
export class Configuration {
public:
std::string name;
std::string standard;
std::vector<std::unique_ptr<Module>> interfaces;
std::vector<Implementation> implementations;
std::vector<Dependency> dependencies;
std::vector<Shader> shaders;
std::vector<fs::path> additionalFiles;
std::vector<Define> defines;
ConfigurationType type;
std::string target;
std::string march;
bool debug;
std::vector<std::string> libs;
Configuration(std::string&& name);
Configuration(const nlohmann::json& configs, const nlohmann::json& config, fs::path workingDir);
void SetDataFromJson(const nlohmann::json& configs, const nlohmann::json& config, fs::path workingDir);
};
}