grbc/include/grbc/ext.h
2024-10-12 20:24:10 -04:00

33 lines
988 B
C++

#pragma once
#include "sol/state.hpp"
#include <string>
#define GRBC_EXT_pkg_config_NAME "GRBC_EXT_pkg_config"
#define GRBC_EXT_profiles_NAME "GRBC_EXT_profiles"
#define GRBC_EXT_easy_NAME "GRBC_EXT_easy"
#define GRBC_EXT_dynamic_extensions_NAME "GRBC_EXT_dynamic_extensions"
#define GRBC_EXT_cmake_NAME "GRBC_EXT_cmake"
/// Called when the extension is loaded
typedef void (*EXT_HookInit)(sol::state &lua);
/// Called when the build completes
typedef void (*EXT_HookBuildFinish)();
/// Called everytime that a file is processed
typedef void (*EXT_HookProcessFile)(const std::string &file);
/// Called when the extension is invoked from the command line
typedef void (*EXT_HookInvoke)();
struct Extension {
std::string name;
bool loaded = false;
EXT_HookInit hook_init = nullptr;
EXT_HookBuildFinish build_finish = nullptr;
EXT_HookProcessFile process_file = nullptr;
EXT_HookInvoke invoke = nullptr;
};
void grbc_ext_process_file(const std::string &file);