grbc/include/grbc/generator.h
2024-09-29 15:24:13 -04:00

60 lines
1.2 KiB
C++

#pragma once
#include "grbc/spec.h"
#include <string>
#include <vector>
enum GeneratorTargetType {
GeneratorTargetType_Executable,
GeneratorTargetType_SharedLibrary,
GeneratorTargetType_StaticLibrary
};
struct GeneratorResult {
std::string file_name;
std::string content;
};
struct GeneratorCompileCommand {
LanguageType language_type;
std::string source_file;
std::string object_file;
std::string compiler_flags;
};
struct GeneratorLinkTargetCommand {
std::vector<std::string> object_files;
std::vector<std::string> libraries; // Libraries which need to be built before this
std::string linker_flags;
std::string output_name;
GeneratorTargetType target_type;
};
struct GeneratorTarget {
std::vector<GeneratorCompileCommand> compile_commands;
std::vector<GeneratorLinkTargetCommand> link_target_commands;
};
struct GeneratorTask {
std::string description, id;
std::string shell_script;
};
typedef GeneratorResult (*Generator_Run)();
struct Generator {
/// Name of the generator, used in grbc_build(...)
std::string name;
/// Function pointer for this generator
Generator_Run func;
};
/**
* Ninja generator main function
*/
GeneratorResult ninja_generator();