grbc/spec/datatypes.md
2024-10-12 20:24:10 -04:00

3.4 KiB

GRBC datatypes

PackageConfig

struct PackageConfig {
    /// Name of the package
    string name; 

    /// List of libraries to include
    Array<TargetInfo> libraries;

    /// List of include directories
    Array<path> include_dirs;

    /// Extra compiler flags
    Array<string> compile_flags;

    /// Extra linker flags
    Array<string> linker_flags;
};

Package

struct Package {
    /// Name of the package
    string name;

    /// File path to the compiled library
    string file_name;

    /// Compiler flags used in this package
    string compile_flags;
    
    /// Linker flags used in this package
    string linker_flags;
};

LibraryConfig

struct LibraryConfig {
    /// Name of the library
    string name;

    /// List of files to compile
    Array<path> files;

    /// Type of library
    LibraryType lib_type;

    /// Package config for the library, leave empty to disable
    PackageConfig package_config{};

    /// Requirments of the library
    Array<Package> requirements;

    /// Compiler flags
    Array<string> compile_flags;

    /// Linker flags
    Array<string> linker_flags;

    /// Include directories
    Array<string> include_dirs;

    /// Optional list of properties
    Array<Property> properties;
};

LibraryType

enum LibraryType {
    LibraryType_Shared,
    LibraryType_Static
};

ExecutableConfig

struct ExecutableConfig {
    /// Name of the executable
    string name;

    /// Type of language
    LanguageType language_type;

    /// List of files to compile
    Array<path> files;

    /// Requirments of the executable
    Array<Package> requirements;

    /// Compiler flags
    Array<string> compile_flags;

    /// Linker flags
    Array<string> linker_flags;

    /// Include directories
    Array<string> include_dirs;

    /// Optional list of properties
    Array<Property> properties;
};

TargetInfo

struct TargetInfo {
    /// Name of the target
    string name;

    /// List of compile commands for this target. should produce an executable, or library.
    Array<string> compile_commands;
};

PlatformType

enum PlatformType {
    PlatformType_Win32,
    PlatformType_Linux 
};

GlobalConfig

struct GlobalConfig {
    /// Version of the grbc executable
    string engine_version;

    /// Architecture string
    string architecture;

    /// Platform to target (pulled from the target config)
    PlatformTarget target;

    /// Path to the platform.hcfg, in_memory if not on-disk
    string platform_config;
};

Platform

struct Platform {
    /// Name of the platform
    string name;

    /// C++ compiler
    string cxx_compiler;

    /// C compiler
    string cc_compiler;

    /// Do these compilers produce 32bit code?
    bool is_64bit;

    /// Type of the platform
    PlatformType platform_type;
};

LanguageType

enum LanguageType {
    LanguageType_CPP,
    LanguageType_C
};

TaskConfig

struct TaskConfig {
    /// Name of the task, can have spaces unlike task_id
    string task_name;

    /// ID used when invoking the task, ex: ```ninja task:helloworld```
    string task_id;

    /// Shell script to be executed when this task is called
    string shell_script;
};

Property

struct Property {
    /// Property name
    std::string name;

    /// Property value
    std::string value;
};