fixed devkit not cloning submodules
This commit is contained in:
parent
3a8796a462
commit
01f5ef953d
|
@ -79,6 +79,8 @@ pkg_search_module(GLIB REQUIRED IMPORTED_TARGET glib-2.0)
|
||||||
# TOML-C99 #
|
# TOML-C99 #
|
||||||
# ------------------------------------------------ #
|
# ------------------------------------------------ #
|
||||||
|
|
||||||
|
execute_process(COMMAND git submodule init -- dep/tomlc99)
|
||||||
|
|
||||||
add_custom_command(OUTPUT ${PROJECT_SOURCE_DIR}/dep/tomlc99/toml.c
|
add_custom_command(OUTPUT ${PROJECT_SOURCE_DIR}/dep/tomlc99/toml.c
|
||||||
COMMAND git
|
COMMAND git
|
||||||
ARGS submodule update --init --recursive --checkout
|
ARGS submodule update --init --recursive --checkout
|
||||||
|
|
|
@ -10,5 +10,7 @@ COPY --chown=lorang CMakeLists.txt /home/lorang/
|
||||||
COPY --chown=lorang run-check-test.sh /home/lorang/
|
COPY --chown=lorang run-check-test.sh /home/lorang/
|
||||||
COPY --chown=lorang .env /home/lorang/
|
COPY --chown=lorang .env /home/lorang/
|
||||||
COPY --chown=lorang run-docker-build.sh /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 .
|
RUN cmake .
|
||||||
|
|
|
@ -5,19 +5,20 @@
|
||||||
#include <cfg/opt.h>
|
#include <cfg/opt.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/log.h>
|
#include <sys/log.h>
|
||||||
|
#include <io/files.h>
|
||||||
|
|
||||||
TargetConfig* default_target_config() {
|
TargetConfig* default_target_config() {
|
||||||
DEBUG("generating default target config...");
|
DEBUG("generating default target config...");
|
||||||
|
|
||||||
TargetConfig* config = malloc(sizeof(TargetConfig));
|
TargetConfig* config = malloc(sizeof(TargetConfig));
|
||||||
|
|
||||||
config->name = NULL;
|
config->name = strdup("out");
|
||||||
config->print_ast = false;
|
config->print_ast = false;
|
||||||
config->print_asm = false;
|
config->print_asm = false;
|
||||||
config->print_ir = false;
|
config->print_ir = false;
|
||||||
config->mode = Application;
|
config->mode = Application;
|
||||||
config->archive_directory = NULL;
|
config->archive_directory = strdup("archive");
|
||||||
config->archive_directory = NULL;
|
config->output_directory = strdup("bin");
|
||||||
config->optimization_level = 1;
|
config->optimization_level = 1;
|
||||||
config->root_module = NULL;
|
config->root_module = NULL;
|
||||||
|
|
||||||
|
@ -43,8 +44,10 @@ TargetConfig* default_target_config_from_args(int argc, char *argv[]) {
|
||||||
config->mode = Application;
|
config->mode = Application;
|
||||||
} else if (strcmp(option, "--mode=lib") == 0) {
|
} else if (strcmp(option, "--mode=lib") == 0) {
|
||||||
config->mode = Library;
|
config->mode = Library;
|
||||||
} else {
|
} else if (config->root_module == NULL) {
|
||||||
config->root_module = strdup(option);
|
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");
|
toml_table_t *targets = toml_table_in(root, "target");
|
||||||
if (targets == NULL) {
|
if (targets == NULL) {
|
||||||
printf("Project has no targets\n");
|
print_message(Warning, "Project has no targets");
|
||||||
return PROJECT_SEMANTIC_ERR;
|
return PROJECT_SEMANTIC_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,7 +212,7 @@ int load_project_config(ProjectConfig *config) {
|
||||||
|
|
||||||
FILE *config_file = fopen(PROJECT_CONFIG_FILE, "r");
|
FILE *config_file = fopen(PROJECT_CONFIG_FILE, "r");
|
||||||
if (config_file == NULL) {
|
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");
|
ERROR("project file not found");
|
||||||
return PROJECT_TOML_ERR;
|
return PROJECT_TOML_ERR;
|
||||||
}
|
}
|
||||||
|
@ -220,17 +223,17 @@ int load_project_config(ProjectConfig *config) {
|
||||||
fclose(config_file);
|
fclose(config_file);
|
||||||
|
|
||||||
if (!conf) {
|
if (!conf) {
|
||||||
printf("Invalid project configuration: %s\n\n", err_buf);
|
print_message(Error, "Invalid project configuration: %s", err_buf);
|
||||||
return PROJECT_SEMANTIC_ERR;
|
return PROJECT_SEMANTIC_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
toml_table_t *project = toml_table_in(conf, "project");
|
toml_table_t *project = toml_table_in(conf, "project");
|
||||||
if (project) {
|
if (!project) {
|
||||||
if (parse_project_table(config, project) == PROJECT_OK) {
|
print_message(Error, "Invalid project configuration: missing project table.");
|
||||||
return parse_targets(config, conf);
|
}
|
||||||
}
|
|
||||||
} else {
|
if (parse_project_table(config, project) == PROJECT_OK) {
|
||||||
printf("Invalid project configuration: missing project table\n\n");
|
return parse_targets(config, conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
toml_free(conf);
|
toml_free(conf);
|
||||||
|
|
|
@ -95,6 +95,12 @@ void setup(void) {
|
||||||
DEBUG("finished starting up gemstone...");
|
DEBUG("finished starting up gemstone...");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void setup_target_environment(const TargetConfig* target) {
|
||||||
|
if (target->output_directory) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void build_target(ModuleFileStack *unit, TargetConfig *target) {
|
void build_target(ModuleFileStack *unit, TargetConfig *target) {
|
||||||
print_message(Info, "Compiling file: %s", target->root_module);
|
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);
|
ModuleFile *file = push_file(unit, target->root_module);
|
||||||
|
|
||||||
if (compile_file_to_ast(ast, file) == EXIT_SUCCESS) {
|
if (compile_file_to_ast(ast, file) == EXIT_SUCCESS) {
|
||||||
|
setup_target_environment(target);
|
||||||
|
|
||||||
|
|
||||||
if (target->print_ast) {
|
if (target->print_ast) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue