grbc/spec/functions.md

80 lines
2.7 KiB
Markdown

# GRBC functions
See [datatypes.md](./datatypes.md) for data types/structures
## [X] grbc_get_config() -> GlobalConfig
Get the config as as read-write reference
## [X] grbc_want_version(version: String) -> Void
Assure grbc is running on ```version```
## [X] grbc_log(message: String) -> Void
Log ```message``` to the console
## [X] grbc_is_win32() -> Boolean
Check if we are targeting win32
## [X] grbc_is_linux() -> Boolean
Check if we are targeting a Linux system
## [X] grbc_get_platform() -> PlatformType
Return the current platform
## [X] grbc_is_64bit() -> Boolean
Check if we are targeting a 64bit system
## [X] 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
## [X] grbc_library(library_config: LibraryConfig) -> TargetInfo
Create a new library and add it to the build list
## grbc_pkg(package_name: String) -> Package
Get a package with the given name and return its baked form
## [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
## [X] grbc_compiler_define(define: String, value: String) -> String
Generate a compiler flag to define a variable
## [X] grbc_get_lib_extension(library_type: LibraryType) -> String
Get the given extension for a library file on the current platform
## [X] grbc_bake_package_config(config: PackageConfig) -> Package
Convert a PackageConfig into a Package