mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Merge branch 'master' of https://github.com/odin-lang/Odin
This commit is contained in:
@@ -12,7 +12,7 @@ endif
|
|||||||
all: debug demo
|
all: debug demo
|
||||||
|
|
||||||
demo:
|
demo:
|
||||||
./odin run examples/demo.odin
|
./odin run examples/demo
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
$(CC) src/main.cpp $(DISABLED_WARNINGS) $(CFLAGS) -g $(LDFLAGS) -o odin
|
$(CC) src/main.cpp $(DISABLED_WARNINGS) $(CFLAGS) -g $(LDFLAGS) -o odin
|
||||||
|
|||||||
+3
-2
@@ -3,6 +3,7 @@ package os
|
|||||||
foreign import dl "system:dl"
|
foreign import dl "system:dl"
|
||||||
foreign import libc "system:c"
|
foreign import libc "system:c"
|
||||||
|
|
||||||
|
import "core:runtime"
|
||||||
import "core:strings"
|
import "core:strings"
|
||||||
|
|
||||||
OS :: "osx";
|
OS :: "osx";
|
||||||
@@ -287,8 +288,8 @@ dlerror :: proc() -> string {
|
|||||||
|
|
||||||
|
|
||||||
_alloc_command_line_arguments :: proc() -> []string {
|
_alloc_command_line_arguments :: proc() -> []string {
|
||||||
args := make([]string, len(__args__));
|
args := make([]string, len(runtime.args__));
|
||||||
for arg, i in __args__ {
|
for arg, i in runtime.args__ {
|
||||||
args[i] = string(arg);
|
args[i] = string(arg);
|
||||||
}
|
}
|
||||||
return args;
|
return args;
|
||||||
|
|||||||
+1
-1
@@ -822,7 +822,7 @@ ReadDirectoryError read_directory(String path, Array<FileInfo> *fi) {
|
|||||||
|
|
||||||
return ReadDirectory_None;
|
return ReadDirectory_None;
|
||||||
}
|
}
|
||||||
#elif defined(GB_SYSTEM_LINUX)
|
#elif defined(GB_SYSTEM_LINUX) || defined(GB_SYSTEM_OSX)
|
||||||
|
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -992,12 +992,12 @@ int main(int arg_count, char **arg_ptr) {
|
|||||||
// the system library paths for the library file).
|
// the system library paths for the library file).
|
||||||
if (string_ends_with(lib, str_lit(".a"))) {
|
if (string_ends_with(lib, str_lit(".a"))) {
|
||||||
// static libs, absolute full path relative to the file in which the lib was imported from
|
// static libs, absolute full path relative to the file in which the lib was imported from
|
||||||
lib_str = gb_string_append_fmt(lib_str, " -l:%.*s ", LIT(lib));
|
lib_str = gb_string_append_fmt(lib_str, " -l:\"%.*s\" ", LIT(lib));
|
||||||
} else if (string_ends_with(lib, str_lit(".so"))) {
|
} else if (string_ends_with(lib, str_lit(".so"))) {
|
||||||
// dynamic lib, relative path to executable
|
// dynamic lib, relative path to executable
|
||||||
// NOTE(vassvik): it is the user's responsibility to make sure the shared library files are visible
|
// NOTE(vassvik): it is the user's responsibility to make sure the shared library files are visible
|
||||||
// at runtimeto the executable
|
// at runtimeto the executable
|
||||||
lib_str = gb_string_append_fmt(lib_str, " -l:%s/%.*s ", cwd, LIT(lib));
|
lib_str = gb_string_append_fmt(lib_str, " -l:\"%s/%.*s\" ", cwd, LIT(lib));
|
||||||
} else {
|
} else {
|
||||||
// dynamic or static system lib, just link regularly searching system library paths
|
// dynamic or static system lib, just link regularly searching system library paths
|
||||||
lib_str = gb_string_append_fmt(lib_str, " -l%.*s ", LIT(lib));
|
lib_str = gb_string_append_fmt(lib_str, " -l%.*s ", LIT(lib));
|
||||||
@@ -1085,7 +1085,7 @@ int main(int arg_count, char **arg_ptr) {
|
|||||||
remove_temp_files(output_base);
|
remove_temp_files(output_base);
|
||||||
|
|
||||||
if (run_output) {
|
if (run_output) {
|
||||||
system_exec_command_line_app("odin run", false, "%.*s", LIT(output_base));
|
system_exec_command_line_app("odin run", false, "\"%.*s\"", LIT(output_base));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+2
-2
@@ -51,7 +51,7 @@ u64 osx_time_stamp__freq(void) {
|
|||||||
|
|
||||||
u64 unix_time_stamp_time_now(void) {
|
u64 unix_time_stamp_time_now(void) {
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts);
|
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||||
|
|
||||||
return (ts.tv_sec * 1000000000) + ts.tv_nsec;
|
return (ts.tv_sec * 1000000000) + ts.tv_nsec;
|
||||||
}
|
}
|
||||||
@@ -61,7 +61,7 @@ u64 unix_time_stamp__freq(void) {
|
|||||||
|
|
||||||
if (freq == 0) {
|
if (freq == 0) {
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
clock_getres(CLOCK_PROCESS_CPUTIME_ID, &ts);
|
clock_getres(CLOCK_MONOTONIC, &ts);
|
||||||
freq = cast(u64) ((1.0 / ts.tv_nsec) * 1000000000.0);
|
freq = cast(u64) ((1.0 / ts.tv_nsec) * 1000000000.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user