Compare commits
1 Commits
da33604123
...
2bfc16c662
Author | SHA1 | Date | |
---|---|---|---|
2bfc16c662 |
@ -18284,7 +18284,7 @@ compile_file = fn (arena: &Arena, compile_options: CompileFile, envp: &&u8) []u8
|
||||
{
|
||||
>builder: ArgumentBuilder = zero;
|
||||
|
||||
add_argument(&builder, "/home/david/dev/llvm/install/llvm_20.1.3_x86_64-linux-Release/bin/llvm-config");
|
||||
add_argument(&builder, arena_join_string(module.arena, [ CMAKE_PREFIX_PATH, "/bin/llvm-config"][..]);
|
||||
add_argument(&builder, "--libdir");
|
||||
add_argument(&builder, "--libs");
|
||||
add_argument(&builder, "--system-libs");
|
||||
|
@ -93,6 +93,7 @@ fn void compile(Arena* arena, Options options)
|
||||
.name = options.name,
|
||||
.path = options.path,
|
||||
.executable = options.executable,
|
||||
.definitions = options.definitions,
|
||||
.objects = options.objects,
|
||||
.library_directories = options.library_directories,
|
||||
.library_names = options.library_names,
|
||||
@ -174,6 +175,13 @@ fn String compile_file(Arena* arena, Compile options)
|
||||
auto file_content = file_read(arena, relative_file_path);
|
||||
auto file_path = path_absolute(arena, relative_file_path);
|
||||
|
||||
Slice<Definition> definitions = {};
|
||||
auto cmake_prefix_path = string_literal(CMAKE_PREFIX_PATH);
|
||||
auto cmake_prefix_path_definition = Definition{
|
||||
.name = string_literal("CMAKE_PREFIX_PATH"),
|
||||
.value = cmake_prefix_path,
|
||||
};
|
||||
|
||||
String objects[] = {
|
||||
output_object_path,
|
||||
};
|
||||
@ -190,9 +198,11 @@ fn String compile_file(Arena* arena, Compile options)
|
||||
|
||||
if (is_compiler)
|
||||
{
|
||||
definitions = { .pointer = &cmake_prefix_path_definition, .length = 1 };
|
||||
|
||||
ArgBuilder builder = {};
|
||||
String llvm_config_parts[] = {
|
||||
string_literal(CMAKE_PREFIX_PATH),
|
||||
cmake_prefix_path,
|
||||
string_literal("/bin/llvm-config"),
|
||||
};
|
||||
builder.add(arena, arena_join_string(arena, array_to_slice(llvm_config_parts)));
|
||||
@ -300,6 +310,7 @@ fn String compile_file(Arena* arena, Compile options)
|
||||
.path = file_path,
|
||||
.executable = output_executable_path,
|
||||
.name = base_name,
|
||||
.definitions = definitions,
|
||||
.objects = object_slice,
|
||||
.library_paths = library_paths,
|
||||
.library_names = library_names,
|
||||
|
@ -1296,6 +1296,12 @@ struct ModuleLLVM
|
||||
u32 debug_tag;
|
||||
};
|
||||
|
||||
struct Definition
|
||||
{
|
||||
String name;
|
||||
String value;
|
||||
};
|
||||
|
||||
struct Module
|
||||
{
|
||||
Arena* arena;
|
||||
@ -1330,6 +1336,7 @@ struct Module
|
||||
String path;
|
||||
String executable;
|
||||
|
||||
Slice<Definition> definitions;
|
||||
Slice<String> objects;
|
||||
Slice<String> library_directories;
|
||||
Slice<String> library_names;
|
||||
@ -1408,6 +1415,7 @@ struct Options
|
||||
String path;
|
||||
String executable;
|
||||
String name;
|
||||
Slice<Definition> definitions;
|
||||
Slice<String> objects;
|
||||
Slice<String> library_paths;
|
||||
Slice<String> library_names;
|
||||
|
@ -3166,6 +3166,25 @@ fn Block* parse_block(Module* module, Scope* parent_scope)
|
||||
void parse(Module* module)
|
||||
{
|
||||
auto scope = &module->scope;
|
||||
|
||||
for (auto definition: module->definitions)
|
||||
{
|
||||
auto definition_global = new_global(module);
|
||||
auto definition_value = new_value(module);
|
||||
*definition_value = {
|
||||
.string_literal = definition.value,
|
||||
.id = ValueId::string_literal,
|
||||
};
|
||||
*definition_global = Global{
|
||||
.variable = {
|
||||
.initial_value = definition_value,
|
||||
.type = get_slice_type(module, uint8(module)),
|
||||
.scope = scope,
|
||||
.name = definition.name,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
while (1)
|
||||
{
|
||||
skip_space(module);
|
||||
|
Loading…
x
Reference in New Issue
Block a user