mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Fix issue resolving paths for builds. Changed default output to a.out as per @gdm85's suggestion. Fixes to test project from @gdm85's pull req.
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
module bar;
|
||||
|
||||
import baz::foo;
|
||||
import testbaz;
|
||||
import testbaz::zab;
|
||||
|
||||
public func void test()
|
||||
func void test()
|
||||
{
|
||||
Foo x;
|
||||
baz::foo::test();
|
||||
|
||||
@@ -2,19 +2,19 @@ module baz::foo;
|
||||
|
||||
import bar;
|
||||
|
||||
public struct Foo
|
||||
struct Foo
|
||||
{
|
||||
int a;
|
||||
}
|
||||
|
||||
extern func void printf(char *hello);
|
||||
|
||||
func void ofke()
|
||||
private func void ofke()
|
||||
{}
|
||||
|
||||
func void exple() {}
|
||||
private func void exple() {}
|
||||
|
||||
public func void test()
|
||||
func void test()
|
||||
{
|
||||
printf("Hello from baz::foo::test()!\n");
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
module testbaz::zab;
|
||||
|
||||
public struct Zab
|
||||
struct Zab
|
||||
{
|
||||
double a;
|
||||
}
|
||||
@@ -206,6 +206,7 @@ typedef struct
|
||||
const char *name;
|
||||
const char *version;
|
||||
const char *langrev;
|
||||
const char **source_dirs;
|
||||
const char **sources;
|
||||
const char **libraries;
|
||||
const char *cpu;
|
||||
|
||||
@@ -119,7 +119,7 @@ void init_default_build_target(BuildTarget *target, BuildOptions *options, const
|
||||
{
|
||||
*target = (BuildTarget) {
|
||||
.type = TARGET_TYPE_EXECUTABLE,
|
||||
.sources = options->files,
|
||||
.source_dirs = options->files,
|
||||
.name = name,
|
||||
.optimization_level = OPTIMIZATION_DEFAULT,
|
||||
.size_optimization_level = SIZE_OPTIMIZATION_NONE,
|
||||
|
||||
@@ -152,7 +152,7 @@ void project_add_target(Project *project, TomlValue *wrapped_table, const char *
|
||||
target->version = get_valid_string(table, "version", type, false);
|
||||
if (!target->version) target->version = "1.0.0";
|
||||
target->langrev = get_valid_string(table, "langrev", type, false);
|
||||
target->sources = get_valid_array(table, "sources", type, true);
|
||||
target->source_dirs = get_valid_array(table, "sources", type, true);
|
||||
target->libraries = get_valid_array(table, "libs", type, false);
|
||||
static const char *debug_infos[3] = {
|
||||
[DEBUG_INFO_FULL] = "full",
|
||||
|
||||
@@ -444,9 +444,9 @@ void compiler_compile(void)
|
||||
static void target_expand_source_names(BuildTarget *target)
|
||||
{
|
||||
const char **files = NULL;
|
||||
VECEACH(target->sources, i)
|
||||
VECEACH(target->source_dirs, i)
|
||||
{
|
||||
const char *name = target->sources[i];
|
||||
const char *name = target->source_dirs[i];
|
||||
size_t name_len = strlen(name);
|
||||
if (name_len < 1) goto INVALID_NAME;
|
||||
if (name[name_len - 1] == '*')
|
||||
@@ -482,7 +482,7 @@ static void target_expand_source_names(BuildTarget *target)
|
||||
|
||||
void compile_target(BuildOptions *options)
|
||||
{
|
||||
init_default_build_target(&active_target, options, "foo.out");
|
||||
init_default_build_target(&active_target, options, "a.out");
|
||||
compile();
|
||||
}
|
||||
|
||||
@@ -494,9 +494,9 @@ void compile_file_list(BuildOptions *options)
|
||||
|
||||
void compile()
|
||||
{
|
||||
target_expand_source_names(&active_target);
|
||||
global_context.sources = active_target.sources;
|
||||
symtab_init(active_target.symtab_size ? active_target.symtab_size : 64 * 1024);
|
||||
target_expand_source_names(&active_target);
|
||||
target_setup(&active_target);
|
||||
|
||||
if (!vec_size(active_target.sources)) error_exit("No files to compile.");
|
||||
|
||||
Reference in New Issue
Block a user