Rewrite LLVM bindings #53
@ -77,6 +77,8 @@ O = bits u32
|
||||
[extern] memcpy = fn [cc(c)] (destination: &u8, source: &u8, byte_count: u64) &u8;
|
||||
[extern] exit = fn [cc(c)] (exit_code: int) noreturn;
|
||||
|
||||
[extern] getenv = fn [cc(c)] (env: &u8) &u8;
|
||||
|
||||
[extern] realpath = fn [cc(c)] (source_path: &u8, resolved_path: &u8) &u8;
|
||||
[extern] mkdir = fn [cc(c)] (path: &u8, mode: mode_t) int;
|
||||
|
||||
@ -18356,6 +18358,16 @@ compile_file = fn (arena: &Arena, compile_options: CompileFile, envp: &&u8) []u8
|
||||
.value = CMAKE_PREFIX_PATH,
|
||||
};
|
||||
|
||||
if (is_compiler)
|
||||
{
|
||||
>cmake_prefix_path_cstr = getenv("CMAKE_PREFIX_PATH");
|
||||
if (cmake_prefix_path_cstr)
|
||||
{
|
||||
>cmake_prefix_path_value = c_string_to_slice(cmake_prefix_path_cstr);
|
||||
cmake_prefix_path_definition.value = cmake_prefix_path_value;
|
||||
}
|
||||
}
|
||||
|
||||
>objects = [ output_object_path ][..];
|
||||
>c_abi_library = "build/libc_abi.a";
|
||||
>llvm_bindings_library = "build/libllvm_bindings.a";
|
||||
|
@ -221,6 +221,16 @@ fn String compile_file(Arena* arena, Compile options)
|
||||
.value = cmake_prefix_path,
|
||||
};
|
||||
|
||||
if (is_compiler)
|
||||
{
|
||||
auto cmake_prefix_path_cstr = os_get_environment_variable("CMAKE_PREFIX_PATH");
|
||||
if (cmake_prefix_path_cstr)
|
||||
{
|
||||
auto cmake_prefix_path_string = c_string_to_slice(cmake_prefix_path_cstr);
|
||||
cmake_prefix_path_definition.value = cmake_prefix_path_string;
|
||||
}
|
||||
}
|
||||
|
||||
String objects[] = {
|
||||
output_object_path,
|
||||
};
|
||||
|
@ -225,3 +225,9 @@ Execution os_execute(Arena* arena, Slice<char* const> arguments, Slice<char* con
|
||||
|
||||
return execution;
|
||||
}
|
||||
|
||||
extern "C" char* getenv(const char*);
|
||||
char* os_get_environment_variable(const char* env)
|
||||
{
|
||||
return getenv(env);
|
||||
}
|
||||
|
@ -719,3 +719,4 @@ struct Execution
|
||||
};
|
||||
|
||||
Execution os_execute(Arena* arena, Slice<char* const> arguments, Slice<char* const> environment, ExecuteOptions options);
|
||||
char* os_get_environment_variable(const char* env);
|
||||
|
Loading…
x
Reference in New Issue
Block a user