fixed devkit not cloning submodules

This commit is contained in:
Sven Vogel 2024-06-01 14:52:59 +02:00
parent 3a8796a462
commit 01f5ef953d
4 changed files with 27 additions and 15 deletions

View File

@ -79,6 +79,8 @@ pkg_search_module(GLIB REQUIRED IMPORTED_TARGET glib-2.0)
# TOML-C99 #
# ------------------------------------------------ #
execute_process(COMMAND git submodule init -- dep/tomlc99)
add_custom_command(OUTPUT ${PROJECT_SOURCE_DIR}/dep/tomlc99/toml.c
COMMAND git
ARGS submodule update --init --recursive --checkout

View File

@ -10,5 +10,7 @@ COPY --chown=lorang CMakeLists.txt /home/lorang/
COPY --chown=lorang run-check-test.sh /home/lorang/
COPY --chown=lorang .env /home/lorang/
COPY --chown=lorang run-docker-build.sh /home/lorang/
COPY --chown=lorang dep /home/lorang/dep
COPY --chown=lorang .git /home/lorang/.git
RUN cmake .

View File

@ -5,19 +5,20 @@
#include <cfg/opt.h>
#include <string.h>
#include <sys/log.h>
#include <io/files.h>
TargetConfig* default_target_config() {
DEBUG("generating default target config...");
TargetConfig* config = malloc(sizeof(TargetConfig));
config->name = NULL;
config->name = strdup("out");
config->print_ast = false;
config->print_asm = false;
config->print_ir = false;
config->mode = Application;
config->archive_directory = NULL;
config->archive_directory = NULL;
config->archive_directory = strdup("archive");
config->output_directory = strdup("bin");
config->optimization_level = 1;
config->root_module = NULL;
@ -43,8 +44,10 @@ TargetConfig* default_target_config_from_args(int argc, char *argv[]) {
config->mode = Application;
} else if (strcmp(option, "--mode=lib") == 0) {
config->mode = Library;
} else {
} else if (config->root_module == NULL) {
config->root_module = strdup(option);
} else {
print_message(Warning, "Got more than one file to compile, using first by ignoring others.");
}
}
@ -185,7 +188,7 @@ static int parse_targets(ProjectConfig *config, toml_table_t *root) {
toml_table_t *targets = toml_table_in(root, "target");
if (targets == NULL) {
printf("Project has no targets\n");
print_message(Warning, "Project has no targets");
return PROJECT_SEMANTIC_ERR;
}
@ -209,7 +212,7 @@ int load_project_config(ProjectConfig *config) {
FILE *config_file = fopen(PROJECT_CONFIG_FILE, "r");
if (config_file == NULL) {
printf("Cannot open file %s: %s\n", PROJECT_CONFIG_FILE, strerror(errno));
print_message(Error, "Cannot open file %s: %s", PROJECT_CONFIG_FILE, strerror(errno));
ERROR("project file not found");
return PROJECT_TOML_ERR;
}
@ -220,17 +223,17 @@ int load_project_config(ProjectConfig *config) {
fclose(config_file);
if (!conf) {
printf("Invalid project configuration: %s\n\n", err_buf);
print_message(Error, "Invalid project configuration: %s", err_buf);
return PROJECT_SEMANTIC_ERR;
}
toml_table_t *project = toml_table_in(conf, "project");
if (project) {
if (parse_project_table(config, project) == PROJECT_OK) {
return parse_targets(config, conf);
}
} else {
printf("Invalid project configuration: missing project table\n\n");
if (!project) {
print_message(Error, "Invalid project configuration: missing project table.");
}
if (parse_project_table(config, project) == PROJECT_OK) {
return parse_targets(config, conf);
}
toml_free(conf);

View File

@ -95,6 +95,12 @@ void setup(void) {
DEBUG("finished starting up gemstone...");
}
static void setup_target_environment(const TargetConfig* target) {
if (target->output_directory) {
}
}
void build_target(ModuleFileStack *unit, TargetConfig *target) {
print_message(Info, "Compiling file: %s", target->root_module);
@ -103,8 +109,7 @@ void build_target(ModuleFileStack *unit, TargetConfig *target) {
ModuleFile *file = push_file(unit, target->root_module);
if (compile_file_to_ast(ast, file) == EXIT_SUCCESS) {
setup_target_environment(target);
if (target->print_ast) {