Crafter.Build/Crafter.Build-Configuration.cppm

69 lines
2.7 KiB
Text
Raw Normal View History

2024-12-29 01:04:33 +01:00
/*
Crafter.Build
2025-04-29 00:15:14 +02:00
Copyright (C) 2025 Catcrafts®
2024-12-31 20:32:00 +01:00
Catcrafts.net
2024-12-29 01:04:33 +01:00
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
2024-12-31 20:32:00 +01:00
version 3.0 of the License, or (at your option) any later version.
2024-12-29 01:04:33 +01:00
2025-04-29 00:15:14 +02:00
This library is distributed in the hope that it will be useful,
2024-12-29 01:04:33 +01:00
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
2024-12-31 20:32:00 +01:00
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2024-12-29 01:04:33 +01:00
*/
2024-12-28 21:00:12 +01:00
module;
#include <string>
#include <vector>
2024-12-29 17:53:46 +01:00
#include "json.hpp"
#include <unordered_map>
2025-05-15 15:25:06 +02:00
#include <format>
2024-12-28 21:00:12 +01:00
export module Crafter.Build:Configuration;
2024-12-29 17:53:46 +01:00
import :Dependency;
2025-04-24 19:21:09 +02:00
import :Shader;
2024-12-29 17:53:46 +01:00
namespace fs = std::filesystem;
2024-12-28 21:00:12 +01:00
export namespace Crafter::Build {
2025-05-15 15:25:06 +02:00
struct Define {
std::string name;
std::string value;
std::string ToString() const {
return std::format(" -D {}={}", name, value);
}
};
2024-12-28 21:00:12 +01:00
class Configuration {
public:
std::string name;
std::string standard;
2024-12-29 17:53:46 +01:00
std::vector<fs::path> sourceFiles;
2025-04-24 19:21:09 +02:00
std::vector<fs::path> c_files;
2024-12-29 17:53:46 +01:00
std::vector<fs::path> moduleFiles;
2025-04-24 19:21:09 +02:00
std::vector<Shader> shaderFiles;
2025-01-02 02:53:39 +01:00
std::vector<fs::path> additionalFiles;
2025-04-24 19:21:09 +02:00
std::vector<std::string> includeDirs;
2025-05-15 15:25:06 +02:00
std::vector<Define> defines;
2024-12-28 21:00:12 +01:00
std::string optimizationLevel;
std::string buildDir;
std::string outputDir;
2024-12-29 01:38:25 +01:00
std::string type;
std::string target;
2025-02-03 22:06:54 +01:00
std::string march;
2025-04-24 19:21:09 +02:00
bool debug;
std::vector<std::string> libs;
std::vector<std::string> lib_paths;
2024-12-29 17:53:46 +01:00
std::vector<Dependency> dependencies;
std::unordered_map<std::string, nlohmann::json> additionalProperties;
2025-02-03 22:06:54 +01:00
std::vector<std::string> flags;
2025-04-29 00:15:14 +02:00
bool verbose = false;
2025-05-15 15:25:06 +02:00
Configuration(std::string name, std::string standard, std::vector<fs::path> sourceFiles, std::vector<fs::path> moduleFiles, std::string optimizationLevel, std::string buildDir, std::string outputDir, std::string type, std::string target, std::string march, std::vector<Dependency> dependencies, std::vector<fs::path> additionalFiles, std::vector<std::string> flags, bool debug, std::vector<std::string> libs, std::vector<std::string> lib_paths, std::vector<fs::path> c_files, std::vector<Shader> shaderFiles, std::vector<std::string> includeDirs, bool verbose, std::vector<Define> defines);
2024-12-30 20:18:23 +01:00
Configuration(const nlohmann::json& configs, const nlohmann::json& config, fs::path workingDir);
2024-12-28 21:00:12 +01:00
};
}