Crafter.Build/interfaces/Crafter.Build-Configuration.cppm

63 lines
2.2 KiB
Text
Raw Normal View History

2025-10-31 16:50:47 +01:00
/*
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 enum ConfigurationType {
CRAFTER_CONFIGURATION_TYPE_EXECUTABLE,
CRAFTER_CONFIGURATION_TYPE_LIBRARY,
CRAFTER_CONFIGURATION_TYPE_SHARED_LIBRARY,
};
2025-11-16 18:44:41 +01:00
export class Project;
2025-10-31 16:50:47 +01:00
export class Configuration {
public:
std::string name;
std::string standard;
std::vector<std::unique_ptr<Module>> interfaces;
std::vector<Implementation> implementations;
2025-11-16 18:44:41 +01:00
std::vector<fs::path> c_files;
std::vector<std::tuple<std::shared_ptr<Project>, Configuration&>> dependencies;
2025-10-31 16:50:47 +01:00
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);
2025-11-16 18:44:41 +01:00
Configuration(const nlohmann::json& configs, const nlohmann::json& config, fs::path workingDir, const Project& project);
void SetDataFromJson(const nlohmann::json& configs, const nlohmann::json& config, fs::path workingDir, const Project& project);
2025-10-31 16:50:47 +01:00
};
}