Compare commits
1 Commits
98db66fa26
...
149d057403
Author | SHA1 | Date | |
---|---|---|---|
149d057403 |
@ -1045,19 +1045,12 @@ target_compare = fn (a: Target, b: Target) u1
|
|||||||
return is_same_cpu and is_same_os;
|
return is_same_cpu and is_same_os;
|
||||||
}
|
}
|
||||||
|
|
||||||
Definition = struct
|
|
||||||
{
|
|
||||||
name: []u8,
|
|
||||||
value: []u8,
|
|
||||||
}
|
|
||||||
|
|
||||||
CompileOptions = struct
|
CompileOptions = struct
|
||||||
{
|
{
|
||||||
content: []u8,
|
content: []u8,
|
||||||
path: []u8,
|
path: []u8,
|
||||||
executable: []u8,
|
executable: []u8,
|
||||||
name: []u8,
|
name: []u8,
|
||||||
definitions: []Definition,
|
|
||||||
objects: [][]u8,
|
objects: [][]u8,
|
||||||
library_directories: [][]u8,
|
library_directories: [][]u8,
|
||||||
library_names: [][]u8,
|
library_names: [][]u8,
|
||||||
@ -18208,38 +18201,6 @@ compile = fn (arena: &Arena, options: CompileOptions) void
|
|||||||
module.scope.types.first = base_type_allocation;
|
module.scope.types.first = base_type_allocation;
|
||||||
module.scope.types.last = noreturn_type;
|
module.scope.types.last = noreturn_type;
|
||||||
|
|
||||||
for (&definition: options.definitions)
|
|
||||||
{
|
|
||||||
>definition_global = new_global(&module);
|
|
||||||
>definition_value = new_value(&module);
|
|
||||||
>definition_storage = new_value(&module);
|
|
||||||
|
|
||||||
definition_value.& = {
|
|
||||||
.content = {
|
|
||||||
.string_literal = definition.value,
|
|
||||||
},
|
|
||||||
.id = .string_literal,
|
|
||||||
zero,
|
|
||||||
};
|
|
||||||
|
|
||||||
definition_storage.& = {
|
|
||||||
.id = .global,
|
|
||||||
zero,
|
|
||||||
};
|
|
||||||
|
|
||||||
definition_global.& = {
|
|
||||||
.variable = {
|
|
||||||
.storage = definition_storage,
|
|
||||||
.type = get_slice_type(&module, uint8(module)),
|
|
||||||
.scope = &module.scope,
|
|
||||||
.name = definition.name,
|
|
||||||
zero,
|
|
||||||
},
|
|
||||||
.initial_value = definition_value,
|
|
||||||
zero,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
parse(&module);
|
parse(&module);
|
||||||
emit(&module);
|
emit(&module);
|
||||||
}
|
}
|
||||||
@ -18308,12 +18269,6 @@ compile_file = fn (arena: &Arena, compile_options: CompileFile, envp: &&u8) []u8
|
|||||||
>file_path = path_absolute(arena, relative_file_path.pointer);
|
>file_path = path_absolute(arena, relative_file_path.pointer);
|
||||||
>c_abi_object_path = ""; // TODO
|
>c_abi_object_path = ""; // TODO
|
||||||
|
|
||||||
>definitions: []Definition = zero;
|
|
||||||
>cmake_prefix_path_definition: Definition = {
|
|
||||||
.name = "CMAKE_PREFIX_PATH",
|
|
||||||
.value = CMAKE_PREFIX_PATH,
|
|
||||||
};
|
|
||||||
|
|
||||||
>objects = [ output_object_path ][..];
|
>objects = [ output_object_path ][..];
|
||||||
>c_abi_library = "build/libc_abi.a";
|
>c_abi_library = "build/libc_abi.a";
|
||||||
>llvm_bindings_library = "build/libllvm_bindings.a";
|
>llvm_bindings_library = "build/libllvm_bindings.a";
|
||||||
@ -18327,11 +18282,9 @@ compile_file = fn (arena: &Arena, compile_options: CompileFile, envp: &&u8) []u8
|
|||||||
|
|
||||||
if (is_compiler)
|
if (is_compiler)
|
||||||
{
|
{
|
||||||
definitions = { .pointer = &cmake_prefix_path_definition, .length = 1 };
|
|
||||||
|
|
||||||
>builder: ArgumentBuilder = zero;
|
>builder: ArgumentBuilder = zero;
|
||||||
|
|
||||||
add_argument(&builder, arena_join_string(arena, [ CMAKE_PREFIX_PATH, "/bin/llvm-config"][..]));
|
add_argument(&builder, arena_join_string(module.arena, [ CMAKE_PREFIX_PATH, "/bin/llvm-config"][..]);
|
||||||
add_argument(&builder, "--libdir");
|
add_argument(&builder, "--libdir");
|
||||||
add_argument(&builder, "--libs");
|
add_argument(&builder, "--libs");
|
||||||
add_argument(&builder, "--system-libs");
|
add_argument(&builder, "--system-libs");
|
||||||
@ -18444,7 +18397,6 @@ compile_file = fn (arena: &Arena, compile_options: CompileFile, envp: &&u8) []u8
|
|||||||
|
|
||||||
>options: CompileOptions = {
|
>options: CompileOptions = {
|
||||||
.executable = output_executable_path,
|
.executable = output_executable_path,
|
||||||
.definitions = definitions,
|
|
||||||
.objects = objects,
|
.objects = objects,
|
||||||
.library_directories = library_directories,
|
.library_directories = library_directories,
|
||||||
.library_names = library_names,
|
.library_names = library_names,
|
||||||
|
@ -113,17 +113,12 @@ fn void compile(Arena* arena, Options options)
|
|||||||
{
|
{
|
||||||
auto definition_global = new_global(&module);
|
auto definition_global = new_global(&module);
|
||||||
auto definition_value = new_value(&module);
|
auto definition_value = new_value(&module);
|
||||||
auto definition_storage = new_value(&module);
|
|
||||||
*definition_value = {
|
*definition_value = {
|
||||||
.string_literal = definition.value,
|
.string_literal = definition.value,
|
||||||
.id = ValueId::string_literal,
|
.id = ValueId::string_literal,
|
||||||
};
|
};
|
||||||
*definition_storage = {
|
|
||||||
.id = ValueId::global,
|
|
||||||
};
|
|
||||||
*definition_global = Global{
|
*definition_global = Global{
|
||||||
.variable = {
|
.variable = {
|
||||||
.storage = definition_storage,
|
|
||||||
.initial_value = definition_value,
|
.initial_value = definition_value,
|
||||||
.type = get_slice_type(&module, uint8(&module)),
|
.type = get_slice_type(&module, uint8(&module)),
|
||||||
.scope = &module.scope,
|
.scope = &module.scope,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user