kerep-headers
This commit is contained in:
@@ -1,20 +1,17 @@
|
||||
#include "CompilationScenario.h"
|
||||
#include "unistd.h"
|
||||
|
||||
void CompilationScenario_construct(CompilationScenario* ptr){
|
||||
ptr->compiler = "UNDEFINED_COMPILER";
|
||||
ptr->obj_dir = "obj";
|
||||
ptr->out_dir = "bin";
|
||||
ptr->args_pre = Autoarr_create(Pointer, 32, 32);
|
||||
ptr->out_file = "bin/out";
|
||||
ptr->args = Autoarr_create(Pointer, 32, 32);
|
||||
ptr->sources = Autoarr_create(Pointer, 32, 32);
|
||||
ptr->args_post = Autoarr_create(Pointer, 32, 32);
|
||||
ptr->defines = Autoarr_create(Pointer, 32, 32);
|
||||
}
|
||||
|
||||
void CompilationScenario_destruct(CompilationScenario* ptr){
|
||||
Autoarr_freeWithoutMembers(ptr->args_pre, true);
|
||||
Autoarr_freeWithoutMembers(ptr->args, true);
|
||||
Autoarr_freeWithoutMembers(ptr->sources, true);
|
||||
Autoarr_freeWithoutMembers(ptr->args_post, true);
|
||||
Autoarr_freeWithoutMembers(ptr->defines, true);
|
||||
}
|
||||
|
||||
#define Dtsod_setStrField(FIELD) \
|
||||
@@ -40,11 +37,9 @@ Maybe CompilationScenario_tryApplyOptions(CompilationScenario* sc, Hashtable* dt
|
||||
Unitype val = UniNull;
|
||||
Dtsod_setStrField(compiler);
|
||||
Dtsod_setStrField(obj_dir);
|
||||
Dtsod_setStrField(out_dir);
|
||||
Dtsod_addArrField(args_pre, char);
|
||||
Dtsod_setStrField(out_file);
|
||||
Dtsod_addArrField(args, char);
|
||||
Dtsod_addArrField(sources, char);
|
||||
Dtsod_addArrField(args_post, char);
|
||||
Dtsod_addArrField(defines, char);
|
||||
|
||||
try(CompilationScenario_tryApplyPlatformSpecificOptions(sc, dtsod), _m0, ;);
|
||||
|
||||
@@ -101,3 +96,34 @@ Maybe CompilationScenario_applyProjectOptions(CompilationScenario* sc, Hashtable
|
||||
try(CompilationScenario_applyTaskOptions(sc, dtsod, task), _m2, ;);
|
||||
return MaybeNull;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
universal compilation:
|
||||
pre-compilation tools
|
||||
parallel foreach src
|
||||
apply proj settings
|
||||
apply lang settings
|
||||
apply dir settings
|
||||
if platform, settings or src were changed
|
||||
compile object to onj/lang
|
||||
concurrent add obj to obj_ar
|
||||
post-compilation tools
|
||||
example: if linkage enabled
|
||||
apply proj linker settings
|
||||
link
|
||||
post-link tools
|
||||
move files to general_out_dir
|
||||
*/
|
||||
|
||||
Maybe CompilationScenario_exec(CompilationScenario* sc){
|
||||
/*const char ** compiler_args;
|
||||
Autoarr_foreach(sc->sources, arg,
|
||||
int rzlt = -1;
|
||||
if(rzlt != 0){
|
||||
kprintf("\nprocess exited with code %i\n", rzlt);
|
||||
return false;
|
||||
}
|
||||
);*/
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
#include "../../GraphC/dependencies/kerep/src/DtsodParser/DtsodV24.h"
|
||||
#include "../kerep-headers/DtsodParser/DtsodV24.h"
|
||||
|
||||
extern const char* os;
|
||||
extern const char* arch;
|
||||
|
||||
typedef struct {
|
||||
const char* language;
|
||||
const char* compiler;
|
||||
const char* obj_dir;
|
||||
const char* out_dir;
|
||||
Autoarr(Pointer)* args_pre;
|
||||
const char* out_file;
|
||||
Autoarr(Pointer)* args;
|
||||
Autoarr(Pointer)* sources;
|
||||
Autoarr(Pointer)* args_post;
|
||||
Autoarr(Pointer)* defines;
|
||||
} CompilationScenario;
|
||||
|
||||
/* Public Functions */
|
||||
@@ -23,6 +22,10 @@ void CompilationScenario_destruct(CompilationScenario* ptr);
|
||||
///@return Maybe<void>
|
||||
Maybe CompilationScenario_applyProjectOptions(CompilationScenario* sc, Hashtable* dtsod, const char* configuration, const char* task);
|
||||
|
||||
/// compiles project using given scenario
|
||||
/// @return Maybe<void>
|
||||
Maybe CompilationScenario_exec(CompilationScenario* sc);
|
||||
|
||||
|
||||
/* Internal Functions */
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "../../GraphC/dependencies/kerep/src/base/base.h"
|
||||
#include "../../GraphC/dependencies/kerep/src/Filesystem/filesystem.h"
|
||||
#include "../../GraphC/dependencies/kerep/src/DtsodParser/DtsodV24.h"
|
||||
#include "../kerep-headers/base/base.h"
|
||||
#include "../kerep-headers/Filesystem/filesystem.h"
|
||||
#include "../kerep-headers/DtsodParser/DtsodV24.h"
|
||||
#include "CompilationScenario.h"
|
||||
|
||||
#ifndef OS
|
||||
@@ -93,8 +93,10 @@ int main(const int argc, const char** argv){
|
||||
Hashtable* proj_dtsod = _m3.value.VoidPtr;
|
||||
CompilationScenario proj_sc;
|
||||
CompilationScenario_construct(&proj_sc);
|
||||
|
||||
tryLast(CompilationScenario_applyProjectOptions(&proj_sc, proj_dtsod, configuration, task), _m4, free(proj_file_text))
|
||||
|
||||
if(!CompilationScenario_exec(&proj_sc))
|
||||
throw("compilation error");
|
||||
|
||||
CompilationScenario_destruct(&proj_sc);
|
||||
Hashtable_free(proj_dtsod);
|
||||
|
||||
Reference in New Issue
Block a user