This commit is contained in:
Hunter 2024-09-27 20:02:30 -04:00
commit 45c2bf9426
25 changed files with 1692 additions and 0 deletions

165
spec/datatypes.md Normal file
View file

@ -0,0 +1,165 @@
# GRBC datatypes
## PackageConfig
```c++
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
```c++
struct Package {
/// Name of the package
string name;
/// Compiler flags used in this package
string compile_flags;
/// Linker flags used in this package
string linker_flags;
};
```
## LibraryConfig
```c++
struct LibraryConfig {
/// Name of the library
string name;
/// List of files to compile
Array<path> files;
/// Type of library
LibraryType lib_type;
/// 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;
};
```
## LibraryType
```c++
enum LibraryType {
LibraryType_Shared,
LibraryType_Static
};
```
## ExecutableConfig
```c++
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;
};
```
## TargetInfo
```c++
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
```c++
enum PlatformType {
PlatformType_Win32,
PlatformType_Linux
};
```
## GlobalConfig
```c++
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 target.hcfg
path target_config;
};
```
## OptionalFileType
```
enum OptionalFileType {
OFileType_IsWin32,
OFileType_IsUnix,
OFileType_IsLinux
};
```
## Platform
```c++
struct Platform {
/// Name of the platform
string name;
/// C++ compiler
string cxx_compiler;
/// C compiler
string cc_compiler;
/// Type of the platform
PlatformType platform_type;
};
```
## LanguageType
```c++
enum LanguageType {
LanguageType_CPP,
LanguageType_C
};
```