added option to compile for app or lib
This commit is contained in:
parent
c527c99392
commit
5fb10bca88
|
@ -28,6 +28,10 @@ TargetConfig default_target_config_from_args(int argc, char *argv[]) {
|
|||
config.print_asm = true;
|
||||
} else if (strcmp(option, "--print-ir") == 0) {
|
||||
config.print_ir = true;
|
||||
} else if (strcmp(option, "--mode=app") == 0) {
|
||||
config.mode = Application;
|
||||
} else if (strcmp(option, "--mode=lib") == 0) {
|
||||
config.mode = Library;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,9 +44,10 @@ void print_help(void) {
|
|||
"Compile file(s): gsc <options> [files]",
|
||||
"Build project (build.toml): gsc [directory] [target]|all",
|
||||
"Options:",
|
||||
" --print-ast print resulting abstract syntax tree to a file",
|
||||
" --print-asm print resulting assembly language to a file",
|
||||
" --print-ir print resulting LLVM-IR to a file"
|
||||
" --print-ast print resulting abstract syntax tree to a file",
|
||||
" --print-asm print resulting assembly language to a file",
|
||||
" --print-ir print resulting LLVM-IR to a file",
|
||||
" --mode=[app|lib] set the compilation mode to either application or library"
|
||||
};
|
||||
|
||||
for (unsigned int i = 0; i < sizeof(lines) / sizeof(const char *); i++) {
|
||||
|
|
|
@ -8,11 +8,26 @@
|
|||
#include <toml.h>
|
||||
#include <glib.h>
|
||||
|
||||
typedef enum TargetCompilationMode_t {
|
||||
Application,
|
||||
Library
|
||||
} TargetCompilationMode;
|
||||
|
||||
typedef struct TargetConfig_t {
|
||||
char* name;
|
||||
bool print_ast;
|
||||
bool print_asm;
|
||||
bool print_ir;
|
||||
// root module file which imports all submodules
|
||||
char* root_module;
|
||||
// output directory for binaries
|
||||
char* output_directory;
|
||||
// output directory for intermediate representations (LLVM-IR, Assembly, ...)
|
||||
char* archive_directory;
|
||||
// mode of compilation
|
||||
TargetCompilationMode mode;
|
||||
// number between 1 and 3
|
||||
int optimization_level;
|
||||
} TargetConfig;
|
||||
|
||||
typedef struct ProjectConfig_t {
|
||||
|
|
Loading…
Reference in New Issue