example project file

This commit is contained in:
Timerix22 2024-05-02 07:37:26 +05:00
parent 6fe1d5a511
commit d873ee19c1
4 changed files with 52 additions and 5 deletions

1
.vscode/launch.json vendored
View File

@ -12,6 +12,7 @@
"linux": {
"program": "${workspaceFolder}/bin/cbuild",
},
"args": [ "-p", "../example.proj.dtsod", "exe"],
"preLaunchTask": "build",
"stopAtEntry": false,
"externalConsole": false,

View File

@ -7,7 +7,7 @@ WARN="-Wall -Wextra -Wno-discarded-qualifiers -Wno-unused-parameter"
ARGS_DEBUG="-O0 -g"
ARGS_RELEASE="-O2 -flto=auto -fdata-sections -ffunction-sections -Wl,--gc-sections"
if [ "$1" -eq "debug" ]; then
if [[ "$1" = "debug" ]]; then
ARGS=$ARGS_DEBUG
else
ARGS=$ARGS_RELEASE

48
example.proj.dtsod Normal file
View File

@ -0,0 +1,48 @@
cbuild_version: 0;
import: [ "c", "c++", "gcc", "./some_local_file.dtsod" ];
gcc: {
src_languages: [ "c" ],
src_dirs: [ "src" ],
};
configurations: {
release: {
preprocess_sources: {
src_languages: [ "c", "c++" ],
src_dirs: [ "src" ],
},
gcc: {
pre_args: [ "-O2" ],
post_args: [ "-Wl,--gc-sections" ],
};
};
};
tasks: {
exe: {
pre_tasks: [ ],
tool_order: [ "preprocess_sources", "gcc", "g++", "g++-link" ],
#g++: [ ... ],
};
};
languages: [
{
aliases: [ "c" ],
file_extensions: [ "c" ],
},
{
aliases: [ "c-header" ],
file_extensions: [ "h" ],
}
];
tools: [
{
aliases: [ "gcc" ],
exe_file: "gcc",
supported_languages: [ "c" ]; # set to "any" to use with any lang
parallel: false,
}
];

View File

@ -138,7 +138,6 @@ Maybe CompilationScenario_applyConfigurationOptions(CompilationScenario* sc, Has
try(CompilationScenario_tryApplyConditionalOptions(sc, dtsod, configuration), _m0, ;);
if(!_m0.value.Bool)
safethrow(cptr_concat("configuration '", configuration, "' not found"), ;);
return MaybeNull;
}
@ -146,7 +145,6 @@ Maybe CompilationScenario_applyTaskOptions(CompilationScenario* sc, Hashtable* d
try(CompilationScenario_tryApplyConditionalOptions(sc, dtsod, task), _m0, ;);
if(!_m0.value.Bool)
safethrow(cptr_concat("task '", task, "' not found"), ;);
return MaybeNull;
}
@ -155,7 +153,7 @@ Maybe CompilationScenario_tryRegisterLanguages(CompilationScenario* sc, Hashtabl
if(!Hashtable_tryGet(dtsod, "languages", &val))
return SUCCESS(UniFalse);
if(!UniCheckTypePtr(val, Hashtable))
if(!UniCheckTypePtr(val, Autoarr(Unitype)))
safethrow(ERR_WRONGTYPE, ;);
Autoarr(Unitype)* languages_serializad = val.VoidPtr;
@ -206,7 +204,7 @@ Maybe CompilationScenario_tryRegisterTools(CompilationScenario* sc, Hashtable* d
if(!Hashtable_tryGet(dtsod, "tools", &val))
return SUCCESS(UniFalse);
if(!UniCheckTypePtr(val, Hashtable))
if(!UniCheckTypePtr(val, Autoarr(Unitype)))
safethrow(ERR_WRONGTYPE, ;);
Autoarr(Unitype)* tools_serializad = val.VoidPtr;