init
This commit is contained in:
commit
45c2bf9426
25 changed files with 1692 additions and 0 deletions
165
spec/datatypes.md
Normal file
165
spec/datatypes.md
Normal 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
|
||||
};
|
||||
```
|
16
spec/ext.md
Normal file
16
spec/ext.md
Normal file
|
@ -0,0 +1,16 @@
|
|||
# GRBC extensions
|
||||
Extensions can be loaded at runtime using grbc_ext(...), functions are then dumped into the runtime
|
||||
|
||||
## How extensions work
|
||||
Extensions are built into the grbc executable, or can be compiled as a shared library and put into ```/usr/local/share/grbc/extensions```, ```C:\GRBC\Extensions\```, or ```~/.local/share/grbc/extensions```
|
||||
|
||||
## Extension list
|
||||
* GRBC_EXT_pkg_config [NOSUPPORT]
|
||||
* GRBC_EXT_multi_file [NOSUPPORT]
|
||||
* GRBC_EXT_cmake [NOSUPPORT]
|
||||
|
||||
## GRBC_EXT_pkg_config
|
||||
Pkg config support. UNIX only
|
||||
|
||||
## GRBC_EXT_multi_file
|
||||
Multi file GRBC scripts, supported on all systems.
|
23
spec/ext/GRBC_EXT_multi_file.md
Normal file
23
spec/ext/GRBC_EXT_multi_file.md
Normal file
|
@ -0,0 +1,23 @@
|
|||
# GRBC_EXT_multi_file
|
||||
Multiple file support
|
||||
|
||||
## Support
|
||||
GRBC_EXT_multi_file is supported on all systems
|
||||
|
||||
## Example
|
||||
```lua
|
||||
-- No need to check since its always present!
|
||||
grbc_ext("GRBC_EXT_multi_file")
|
||||
|
||||
|
||||
-- Load a project from a folder which contains an HConfig file
|
||||
grbc_multi_file_import("FusionVk")
|
||||
|
||||
-- Load a project from a file besides HConfig
|
||||
grbc_multi_file_import("OtherProject.hcfg")
|
||||
```
|
||||
|
||||
## Functions
|
||||
|
||||
### grbc_multi_file_import(file_path: String) -> Void
|
||||
Import a project from the given folder
|
71
spec/functions.md
Normal file
71
spec/functions.md
Normal file
|
@ -0,0 +1,71 @@
|
|||
# GRBC functions
|
||||
See [datatypes.md](./datatypes.md) for data types/structures
|
||||
|
||||
## [X] grbc_get_config() -> GlobalConfig
|
||||
Get the config
|
||||
|
||||
## [X] grbc_want_version(version: String) -> Void
|
||||
Assure grbc is running on ```version```
|
||||
|
||||
## [X] grbc_log(message: String) -> Void
|
||||
Log ```message``` to the console
|
||||
|
||||
## grbc_is_win32() -> Boolean
|
||||
Check if we are targeting win32
|
||||
|
||||
## grbc_is_linux() -> Boolean
|
||||
Check if we are targeting a Linux system
|
||||
|
||||
## grbc_get_platform() -> PlatformType
|
||||
Return the current platform
|
||||
|
||||
## grbc_is_64bit() -> Boolean
|
||||
Check if we are targeting a 64bit system
|
||||
|
||||
## grbc_is_32bit() -> Boolean
|
||||
Check if we are targeting a 32bit system
|
||||
|
||||
## [X] grbc_executable(executable_config: ExecutableConfig) -> TargetInfo
|
||||
Create a new executable and add it to the build list
|
||||
|
||||
## grbc_library(library_config: LibraryConfig) -> TargetInfo
|
||||
Create a new library and add it to the build list
|
||||
|
||||
## [X] grbc_create_package(package_config: PackageConfig) -> Package
|
||||
Create a new package
|
||||
|
||||
## [X] grbc_file(file_path: String) -> Path
|
||||
Used when listing source files, should perform pre-checks on the file and return its path
|
||||
|
||||
## grbc_file_optional(file_type: OptionalFileType, file_path: String) -> Path
|
||||
If file_type is true then file_path is returned, otherwise a blank string
|
||||
|
||||
## grbc_has_ext(extension_name: String) -> Boolean
|
||||
Check if the given extension is supported
|
||||
|
||||
## grbc_ext(extension_name: String) -> Void
|
||||
Load the given extension into the script
|
||||
|
||||
## [X] grbc_exception(exception_string: String) -> Void
|
||||
Throw an exception
|
||||
|
||||
## [X] grbc_set_platform(current_platform: Platform) -> Void
|
||||
Set the current platform
|
||||
|
||||
## [X] grbc_load_platform(file_path: String) -> Void
|
||||
Load a platform config file from file_path
|
||||
|
||||
## [X] grbc_find_compiler(compiler_name: String) -> String
|
||||
Find the given executable in the users PATH, and return the full path
|
||||
|
||||
## [X] grbc_build(generator_id: String) -> Void
|
||||
Output the final build script, using the given generator. "ninja" is the one provided by default
|
||||
|
||||
## [X] grbc_object_file(file_path: String) -> String
|
||||
Convert the given file path to an object file path
|
||||
|
||||
## [X] grbc_replace_string(string: String, substring: Char, replacement: Char) -> String
|
||||
Replace substring in string with replacement
|
||||
|
||||
## [X] grbc_include_dirs_to_cflags(include_dirs: Array<String>) -> String
|
||||
Generate compiler flags to include the given directories
|
Loading…
Add table
Add a link
Reference in a new issue