aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZachary Pierson <zacpiersonhehe@gmail.com>2017-02-10 23:33:30 -0600
committerZachary Pierson <zacpiersonhehe@gmail.com>2017-02-10 23:33:30 -0600
commit3424b2badd347b76ced3f4107d98a12bb50ae49b (patch)
treea0c42a0859e6cc1a665808618993652edb32992d /src
parent3445a28c4a58fb52db89aeb66ba4356582680e1d (diff)
Added ability to use -framework on MacOS
Diffstat (limited to 'src')
-rw-r--r--src/main.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index 734afa50a..e7f656cfa 100644
--- a/src/main.c
+++ b/src/main.c
@@ -375,8 +375,22 @@ int main(int argc, char **argv) {
char lib_str_buf[1024] = {0};
for_array(i, ir_gen.module.foreign_library_paths) {
String lib = ir_gen.module.foreign_library_paths.e[i];
- isize len = gb_snprintf(lib_str_buf, gb_size_of(lib_str_buf),
- " -l%.*s ", LIT(lib));
+
+ // NOTE(zangent): Sometimes, you have to use -framework on MacOS.
+ // This allows you to specify '-f' in a #foreign_system_library,
+ // without having to implement any new syntax specifically for MacOS.
+ #if defined(GB_SYSTEM_OSX)
+ if(lib.len > 2 && lib.text[0] == '-' && lib.text[1] == 'f') {
+ isize len = gb_snprintf(lib_str_buf, gb_size_of(lib_str_buf),
+ " -framework %.*s ", (int)(lib.len) - 2, lib.text + 2);
+ } else {
+ isize len = gb_snprintf(lib_str_buf, gb_size_of(lib_str_buf),
+ " -l%.*s ", LIT(lib));
+ }
+ #else
+ isize len = gb_snprintf(lib_str_buf, gb_size_of(lib_str_buf),
+ " -l%.*s ", LIT(lib));
+ #endif
lib_str = gb_string_appendc(lib_str, lib_str_buf);
}